OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
HDF5_writer_cuda.cu
1#include "config.h"
2#define BOOST_TEST_DYN_LINK
3#include <boost/test/unit_test.hpp>
4
5#include "HDF5_wr.hpp"
6
7#include "hdf5.h"
8
9BOOST_AUTO_TEST_SUITE( vd_hdf5_chckpnt_rstrt_test_gpu )
10
11// Dimensionality
12const size_t dim = 3;
13
14BOOST_AUTO_TEST_CASE( vector_dist_hdf5_save_test_gpu )
15{
18
19 // Put forces
20
21 for (size_t i = 0 ; i < 1024 ; i++)
22 {
24
25 p.get(0) = i;
26 p.get(1) = i+13;
27 p.get(2) = i+17;
28
29 vpos.add(p);
30
31 vprp.add();
32
33 vprp.template get<0>(vprp.size()-1) = p.get(0) + 113.0;
34
35 vprp.template get<1>(vprp.size()-1)[0] = p.get(0) + 100.0;
36 vprp.template get<1>(vprp.size()-1)[1] = p.get(1) + 200.0;
37 vprp.template get<1>(vprp.size()-1)[2] = p.get(2) + 300.0;
38
39 vprp.template get<2>(vprp.size()-1) = p.get(0) + 10013.0;
40
41 vprp.template get<3>(vprp.size()-1)[0][0] = p.get(0) + 600.0;
42 vprp.template get<3>(vprp.size()-1)[0][1] = p.get(0) + 900.0;
43 vprp.template get<3>(vprp.size()-1)[0][2] = p.get(0) + 1600.0;
44 vprp.template get<3>(vprp.size()-1)[1][0] = p.get(0) + 5600.0;
45 vprp.template get<3>(vprp.size()-1)[1][1] = p.get(0) + 6900.0;
46 vprp.template get<3>(vprp.size()-1)[1][2] = p.get(0) + 7600.0;
47 vprp.template get<3>(vprp.size()-1)[2][0] = p.get(0) + 9600.0;
48 vprp.template get<3>(vprp.size()-1)[2][1] = p.get(0) + 1900.0;
49 vprp.template get<3>(vprp.size()-1)[2][2] = p.get(0) + 101600.0;
50 }
51
53
54 // Save the vector
55 h5.save("vector_dist.h5",vpos,vprp);
56
58
61
62 size_t g_m = 0;
63 h5r.load("vector_dist.h5",vpos2,vprp2,g_m);
64
65 BOOST_REQUIRE_EQUAL(1024ul,vpos2.size());
66 BOOST_REQUIRE_EQUAL(1024ul,vprp2.size());
67
68 BOOST_REQUIRE_EQUAL(1024ul,g_m);
69
70 // Check that vpos == vpos2 and vprp2 == vprp2
71
72 bool check = true;
73 for (size_t i = 0 ; i < vpos.size() ; i++)
74 {
75 Point<3,float> p1 = vpos.get(i);
76 Point<3,float> p2 = vpos2.get(i);
77
78 check &= (p1 == p2);
79
80 check &= (vprp.template get<1>(i)[0] == vprp2.template get<1>(i)[0]);
81 check &= (vprp.template get<1>(i)[1] == vprp2.template get<1>(i)[1]);
82 check &= (vprp.template get<1>(i)[2] == vprp2.template get<1>(i)[2]);
83
84 check &= (vprp.template get<0>(i) == vprp2.template get<0>(i));
85 check &= (vprp.template get<2>(i) == vprp2.template get<2>(i));
86
87 check &= (vprp.template get<3>(i)[0][0] == vprp2.template get<3>(i)[0][0]);
88 check &= (vprp.template get<3>(i)[0][1] == vprp2.template get<3>(i)[0][1]);
89 check &= (vprp.template get<3>(i)[0][2] == vprp2.template get<3>(i)[0][2]);
90 check &= (vprp.template get<3>(i)[1][0] == vprp2.template get<3>(i)[1][0]);
91 check &= (vprp.template get<3>(i)[1][1] == vprp2.template get<3>(i)[1][1]);
92 check &= (vprp.template get<3>(i)[1][2] == vprp2.template get<3>(i)[1][2]);
93 check &= (vprp.template get<3>(i)[2][0] == vprp2.template get<3>(i)[2][0]);
94 check &= (vprp.template get<3>(i)[2][1] == vprp2.template get<3>(i)[2][1]);
95 check &= (vprp.template get<3>(i)[2][2] == vprp2.template get<3>(i)[2][2]);
96 }
97
98 BOOST_REQUIRE_EQUAL(check,true);
99}
100
101BOOST_AUTO_TEST_SUITE_END()
This class implement the point shape in an N-dimensional space.
Definition Point.hpp:28
__device__ __host__ const T & get(unsigned int i) const
Get coordinate.
Definition Point.hpp:172
Implementation of 1-D std::vector like structure.
size_t size()
Stub size.