Commit 0261ed4b authored by incardon's avatar incardon
Browse files

Fixing resize for GPU case

parent 005ae9ee
......@@ -494,6 +494,10 @@ void gpu_copy_device_test()
c3.template get<0>(key) = g.LinId(key);
c3.template get<4>(key)[0] = g.LinId(key) + 2000;
c3.template get<4>(key)[1] = g.LinId(key) + 6000;
c3.template get<4>(key)[2] = g.LinId(key) + 56000;
++it4;
}
......@@ -522,7 +526,11 @@ void gpu_copy_device_test()
if (to_check == true)
{
match = c3.template get<0>(key) == g.LinId(key);
match &= c3.template get<0>(key) == g.LinId(key);
match &= c3.template get<4>(key)[0] == g.LinId(key) + 2000;
match &= c3.template get<4>(key)[1] == g.LinId(key) + 6000;
match &= c3.template get<4>(key)[2] == g.LinId(key) + 56000;
}
++it;
......@@ -565,6 +573,10 @@ void gpu_copy_device_test()
if (to_check == true)
{
match = c3.template get<0>(key) == g.LinId(key);
match &= c3.template get<4>(key)[0] == g.LinId(key) + 2000;
match &= c3.template get<4>(key)[1] == g.LinId(key) + 6000;
match &= c3.template get<4>(key)[2] == g.LinId(key) + 56000;
}
++it3;
......
......@@ -79,9 +79,7 @@ struct ite_gpu
grid_key_dx<dim> start;
grid_key_dx<dim> stop;
};
#endif
#include "copy_grid_fast.hpp"
template<unsigned int dim, typename T>
ite_gpu<dim> getGPUIterator_impl(const grid_sm<dim,T> & g1, grid_key_dx<dim> & key1, grid_key_dx<dim> & key2, size_t n_thr = 1024)
......@@ -95,6 +93,19 @@ ite_gpu<dim> getGPUIterator_impl(const grid_sm<dim,T> & g1, grid_key_dx<dim> & k
// Work to do
ite_gpu<dim> ig;
if (tot_work == 0)
{
ig.thr.x = 0;
ig.thr.y = 0;
ig.thr.z = 0;
ig.wthr.x = 0;
ig.wthr.y = 0;
ig.wthr.z = 0;
return ig;
}
ig.thr.x = 1;
ig.thr.y = 1;
ig.thr.z = 1;
......@@ -151,6 +162,11 @@ ite_gpu<dim> getGPUIterator_impl(const grid_sm<dim,T> & g1, grid_key_dx<dim> & k
return ig;
}
#endif
#include "copy_grid_fast.hpp"
/*! \brief
*
* Implementation of a N-dimensional grid
......@@ -873,13 +889,13 @@ public:
stop.set_d(i,g1.size(i)-1);
}
if (dim == 1)
{
copy_fast_1d_device_memory<is_layout_mlin<layout_base<T>>::value,decltype(grid_new.data_),S> cf1dm(data_,grid_new.data_);
// if (dim == 1)
// {
// copy_fast_1d_device_memory<is_layout_mlin<layout_base<T>>::value,decltype(grid_new.data_),S> cf1dm(data_,grid_new.data_);
boost::mpl::for_each_ref<boost::mpl::range_c<int,0,T::max_prop>>(cf1dm);
}
else if (dim == 2 || dim == 3)
// boost::mpl::for_each_ref<boost::mpl::range_c<int,0,T::max_prop>>(cf1dm);
// }
if (dim <= 3)
{
auto ite = this->getGPUIterator(start,stop);
......
......@@ -236,9 +236,10 @@ namespace openfpm
* Resize the vector and allocate n elements
*
* \param slot number of elements
* \param opt options
*
*/
void resize(size_t slot)
void resize(size_t slot, size_t opt = DATA_ON_DEVICE | DATA_ON_HOST)
{
#ifdef SE_CLASS2
check_valid(this,8);
......@@ -251,7 +252,7 @@ namespace openfpm
//! Resize the memory
size_t sz[1] = {gr};
base.resize(sz);
base.resize(sz,opt);
}
// update the vector size
......@@ -619,7 +620,7 @@ namespace openfpm
#if defined(CUDA_GPU) && defined(__NVCC__)
size_t old_sz = size();
this->resize(size() + v.size());
this->resize(size() + v.size(),DATA_ON_DEVICE);
auto ite = v.getGPUIterator();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment