10 #include <boost/mpl/list.hpp>
11 #define BOOST_TEST_MODULE PaddingCheck
12 #include <boost/test/included/unit_test.hpp>
17 template <
class T,
int n = 1>
25 typedef boost::mpl::list<data<double, 2>,
39 int pad = coreneuron::soa_padded_size<1>(11, 1);
40 BOOST_CHECK_EQUAL(pad, 11);
43 pad = coreneuron::soa_padded_size<1>(11, 0);
44 BOOST_CHECK_EQUAL(pad, 11);
46 pad = coreneuron::soa_padded_size<2>(11, 0);
47 BOOST_CHECK_EQUAL(pad, 12);
49 pad = coreneuron::soa_padded_size<4>(11, 0);
50 BOOST_CHECK_EQUAL(pad, 12);
52 pad = coreneuron::soa_padded_size<8>(11, 0);
53 BOOST_CHECK_EQUAL(pad, 16);
55 pad = coreneuron::soa_padded_size<16>(11, 0);
56 BOOST_CHECK_EQUAL(pad, 16);
58 pad = coreneuron::soa_padded_size<32>(11, 0);
59 BOOST_CHECK_EQUAL(pad, 32);
62 pad = coreneuron::soa_padded_size<1>(32, 0);
63 BOOST_CHECK_EQUAL(pad, 32);
65 pad = coreneuron::soa_padded_size<2>(32, 0);
66 BOOST_CHECK_EQUAL(pad, 32);
68 pad = coreneuron::soa_padded_size<4>(32, 0);
69 BOOST_CHECK_EQUAL(pad, 32);
71 pad = coreneuron::soa_padded_size<8>(32, 0);
72 BOOST_CHECK_EQUAL(pad, 32);
74 pad = coreneuron::soa_padded_size<16>(32, 0);
75 BOOST_CHECK_EQUAL(pad, 32);
77 pad = coreneuron::soa_padded_size<32>(32, 0);
78 BOOST_CHECK_EQUAL(pad, 32);
81 pad = coreneuron::soa_padded_size<1>(33, 0);
82 BOOST_CHECK_EQUAL(pad, 33);
84 pad = coreneuron::soa_padded_size<2>(33, 0);
85 BOOST_CHECK_EQUAL(pad, 34);
87 pad = coreneuron::soa_padded_size<4>(33, 0);
88 BOOST_CHECK_EQUAL(pad, 36);
90 pad = coreneuron::soa_padded_size<8>(33, 0);
91 BOOST_CHECK_EQUAL(pad, 40);
93 pad = coreneuron::soa_padded_size<16>(33, 0);
94 BOOST_CHECK_EQUAL(pad, 48);
96 pad = coreneuron::soa_padded_size<32>(33, 0);
97 BOOST_CHECK_EQUAL(pad, 64);
103 const int c = T::chunk;
104 int total_size_chunk = coreneuron::soa_padded_size<c>(247, 0);
105 int ne = 6 * total_size_chunk;
107 typename T::value_type*
data =
110 for (
int i = 1;
i < 6;
i += 2) {
111 bool b = coreneuron::is_aligned((
data +
i * total_size_chunk), 16);
112 BOOST_CHECK_EQUAL(b, 0);
115 for (
int i = 0;
i < 6;
i += 2) {
116 bool b = coreneuron::is_aligned((
data +
i * total_size_chunk), 16);
117 BOOST_CHECK_EQUAL(b, 1);
124 const int c = T::chunk;
125 int total_size_chunk = coreneuron::soa_padded_size<c>(247, 0);
126 int ne = 6 * total_size_chunk;
128 typename T::value_type*
data =
131 for (
int i = 0;
i < 6; ++
i) {
132 bool b = coreneuron::is_aligned((
data +
i * total_size_chunk), 16);
133 BOOST_CHECK_EQUAL(b, 1);