OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
vector_dist_operators_unit_tests.cu
1 #include "config.h"
2 #define BOOST_TEST_DYN_LINK
3 #include <boost/test/unit_test.hpp>
4 
5 #include "VCluster/VCluster.hpp"
6 #include "Vector/vector_dist.hpp"
7 #include "Operators/Vector/vector_dist_operators.hpp"
8 #include "Operators/Vector/tests/vector_dist_operators_tests_util.hpp"
9 
10 
11 BOOST_AUTO_TEST_SUITE( vector_dist_operators_test_gpu )
12 
13 BOOST_AUTO_TEST_CASE(vector_dist_operators_list_ker_test)
14 {
15  if (create_vcluster().getProcessingUnits() > 3)
16  return;
17 
18  Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0});
19 
20  // Boundary conditions
21  size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
22 
23  // ghost
24  Ghost<3,float> ghost(0.2);
25 
27 
28  typedef decltype(vd.toKernel()) vector_dist_kernel;
29 
30  vector_dist_ker_list<vector_dist_kernel> & vdkl = vd.private_get_vector_dist_ker_list();
31 
32  BOOST_REQUIRE_EQUAL(vdkl.n_entry(),0);
33 
34  {
35  auto vA = getV<A,comp_dev>(vd);
36 
37  BOOST_REQUIRE_EQUAL(vdkl.n_entry(),1);
38 
39  {
40  auto vB = getV<B,comp_dev>(vd);
41  auto vC = getV<C,comp_dev>(vd);
42 
43  auto vVA = getV<VA,comp_dev>(vd);
44  auto vVB = getV<VB,comp_dev>(vd);
45  auto vVC = getV<VC,comp_dev>(vd);
46 
47  BOOST_REQUIRE_EQUAL(vdkl.n_entry(),6);
48 
49  // fill vd with some value
50  fill_values<comp_dev>(vd);
51 
52  vd.map(RUN_ON_DEVICE);
53 
54  // check that the entry has been updated
55  BOOST_REQUIRE_EQUAL(vdkl.check(vd.toKernel()),true);
56 
57  vd.template ghost_get<0,1,2,3,4,5>(RUN_ON_DEVICE);
58 
59  // check that the entry has been updated
60  BOOST_REQUIRE_EQUAL(vdkl.check(vd.toKernel()),true);
61  }
62 
63  BOOST_REQUIRE_EQUAL(vdkl.n_entry(),1);
64  }
65 
66  BOOST_REQUIRE_EQUAL(vdkl.n_entry(),0);
67 }
68 
69 BOOST_AUTO_TEST_CASE( vector_dist_operators_gpu_test )
70 {
71  if (create_vcluster().getProcessingUnits() > 3)
72  return;
73 
74  Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0});
75 
76  // Boundary conditions
77  size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
78 
79  // ghost
80  Ghost<3,float> ghost(0.05);
81 
82  // vector type
84 
86 
89 }
90 
91 BOOST_AUTO_TEST_SUITE_END()
This class implement the point shape in an N-dimensional space.
Definition: Point.hpp:27
Definition: Ghost.hpp:39
Distributed vector.
This class contain a list of all tracked vector_dist_ker around.