132 #include "Vector/vector_dist.hpp"
136 template<
typename vector_type>
137 __global__
void translate_fill_prop(
vector_type vd)
139 auto p = GET_PARTICLE(vd);
141 vd.template getProp<0>(p) = vd.
getPos(p)[0] + vd.
getPos(p)[1];
143 vd.template getProp<1>(p)[0] = vd.
getPos(p)[0];
144 vd.template getProp<1>(p)[1] = vd.
getPos(p)[1];
146 vd.template getProp<2>(p)[0][0] = vd.
getPos(p)[0];
147 vd.template getProp<2>(p)[0][1] = vd.
getPos(p)[1];
148 vd.template getProp<2>(p)[1][0] = vd.
getPos(p)[0] + vd.
getPos(p)[1];
149 vd.template getProp<2>(p)[1][1] = vd.
getPos(p)[1] - vd.
getPos(p)[0];
157 int main(
int argc,
char* argv[])
176 openfpm_init(&argc,&argv);
182 size_t bc[2]={PERIODIC,PERIODIC};
190 const int scalar = 0;
193 const int vector = 1;
205 vd.
getPos(key)[0] = (float)rand() / RAND_MAX;
208 vd.
getPos(key)[1] = (float)rand() / RAND_MAX;
221 vd.template hostToDeviceProp<scalar,vector,tensor>();
227 auto ite = vd.getDomainIteratorGPU();
229 CUDA_LAUNCH(translate_fill_prop,ite,vd.toKernel());
245 for (
int j = 0 ; j < 100 ; j++)
247 auto ite = vd.getDomainIteratorGPU();
249 CUDA_LAUNCH(translate_fill_prop,ite,vd.toKernel());
251 vd.
map(RUN_ON_DEVICE);
252 vd.template ghost_get<0,1,2>(RUN_ON_DEVICE);
258 vd.template deviceToHostProp<0,1,2>();
269 bool active = is_mpi_rdma_cuda_active();
271 std::cout <<
"Is MPI rdma active on CUDA " << active << std::endl;
280 int main(
int argc,
char* argv[])
This class represent an N-dimensional box.
vect_dist_key_dx get()
Get the actual key.
bool write_frame(std::string out, size_t iteration, int opt=VTK_WRITER)
Output particle position and properties.
void deviceToHostPos()
Move the memory from the device to host memory.
auto getPos(vect_dist_key_dx vec_key) -> decltype(vPos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
vector_dist_iterator getDomainIterator() const
Get an iterator that traverse the particles in the domain.
void hostToDevicePos()
Move the memory from the device to host memory.
void map(size_t opt=NONE)
It move all the particles that does not belong to the local processor to the respective processor.
bool write(std::string out, int opt=VTK_WRITER)
Output particle position and properties.
void deviceToHostProp()
Move the memory from the device to host memory.