OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
VCluster_unit_test_util_cuda.cuh
1/*
2 * VCluster_unit_test_util_cuda.cuh
3 *
4 * Created on: Dec 21, 2018
5 * Author: i-bird
6 */
7
8#ifndef VCLUSTER_UNIT_TEST_UTIL_CUDA_CUH_
9#define VCLUSTER_UNIT_TEST_UTIL_CUDA_CUH_
10
11
12template<typename T,typename Memory, template <typename> class layout_base> void test_single_all_broadcast_primitives(Vcluster<> & vcl)
13{
15
17
18 if (vcl.getProcessUnitID() == 0)
19 {
20 bdata.add(0);
21 bdata.add(1);
22 bdata.add(2);
23 bdata.add(3);
24 bdata.add(4);
25 bdata.add(5);
26 bdata.add(6);
27 }
28 else
29 {
30 bdata.resize(7);
31 }
32
33 vcl.Bcast(bdata,0);
34 vcl.execute();
35
36 for (size_t i = 0 ; i < bdata.size() ; i++)
37 {BOOST_REQUIRE_EQUAL(i,(size_t)bdata.get(i));}
38
40
41}
42
43template<typename T,typename Memory, template <typename> class layout_base> void test_single_all_broadcast_complex(Vcluster<> & vcl)
44{
46
48
49 if (vcl.getProcessUnitID() == 0)
50 {
51 bdata.add();
52 bdata.template get<0>(bdata.size()-1) = 0;
53 bdata.template get<1>(bdata.size()-1) = 1000;
54 bdata.add();
55 bdata.template get<0>(bdata.size()-1) = 1;
56 bdata.template get<1>(bdata.size()-1) = 1001;
57 bdata.add();
58 bdata.template get<0>(bdata.size()-1) = 2;
59 bdata.template get<1>(bdata.size()-1) = 1002;
60 bdata.add();
61 bdata.template get<0>(bdata.size()-1) = 3;
62 bdata.template get<1>(bdata.size()-1) = 1003;
63 bdata.add();
64 bdata.template get<0>(bdata.size()-1) = 4;
65 bdata.template get<1>(bdata.size()-1) = 1004;
66 bdata.add();
67 bdata.template get<0>(bdata.size()-1) = 5;
68 bdata.template get<1>(bdata.size()-1) = 1005;
69 bdata.add();
70 bdata.template get<0>(bdata.size()-1) = 6;
71 bdata.template get<1>(bdata.size()-1) = 1006;
72 }
73 else
74 {
75 bdata.resize(7);
76 }
77
78 vcl.Bcast(bdata,0);
79 vcl.execute();
80
81 for (size_t i = 0 ; i < bdata.size() ; i++)
82 {
83 BOOST_REQUIRE_EQUAL(i,(size_t)bdata.template get<0>(i));
84 BOOST_REQUIRE_EQUAL(i+1000,(size_t)bdata.template get<1>(i));
85 }
86
88
89}
90
91
92#endif /* VCLUSTER_UNIT_TEST_UTIL_CUDA_CUH_ */
void execute()
Execute all the requests.
bool Bcast(openfpm::vector< T, Mem, layout_base > &v, size_t root)
Broadcast the data to all processors.
size_t getProcessUnitID()
Get the process unit id.
Implementation of VCluster class.
Definition VCluster.hpp:59
Implementation of 1-D std::vector like structure.
size_t size()
Stub size.