130#define SCAN_WITH_CUB <------ MODERNGPU is broken on RTX use CUB library for scan
133#include "Vector/vector_dist.hpp"
137template<
typename vector_type>
140 auto p = GET_PARTICLE(vd);
142 vd.template getProp<0>(p) = vd.
getPos(p)[0] + vd.
getPos(p)[1];
144 vd.template getProp<1>(p)[0] = vd.
getPos(p)[0];
145 vd.template getProp<1>(p)[1] = vd.
getPos(p)[1];
147 vd.template getProp<2>(p)[0][0] = vd.
getPos(p)[0];
148 vd.template getProp<2>(p)[0][1] = vd.
getPos(p)[1];
149 vd.template getProp<2>(p)[1][0] = vd.
getPos(p)[0] + vd.
getPos(p)[1];
150 vd.template getProp<2>(p)[1][1] = vd.
getPos(p)[1] - vd.
getPos(p)[0];
158int main(
int argc,
char* argv[])
177 openfpm_init(&argc,&argv);
183 size_t bc[2]={PERIODIC,PERIODIC};
191 const int scalar = 0;
194 const int vector = 1;
206 vd.
getPos(key)[0] = (float)rand() / RAND_MAX;
209 vd.
getPos(key)[1] = (float)rand() / RAND_MAX;
222 vd.template hostToDeviceProp<scalar,vector,tensor>();
228 auto ite = vd.getDomainIteratorGPU();
230 CUDA_LAUNCH(translate_fill_prop,ite,vd.toKernel());
246 for (
int j = 0 ; j < 100 ; j++)
248 auto ite = vd.getDomainIteratorGPU();
250 CUDA_LAUNCH(translate_fill_prop,ite,vd.toKernel());
252 vd.
map(RUN_ON_DEVICE);
253 vd.template ghost_get<0,1,2>(RUN_ON_DEVICE);
259 vd.template deviceToHostProp<0,1,2>();
270 bool active = is_mpi_rdma_cuda_active();
272 std::cout <<
"Is MPI rdma active on CUDA " << active << std::endl;
281int 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(v_pos.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.