8#define BOOST_TEST_DYN_LINK
9#include <boost/test/unit_test.hpp>
11#include "Grid/grid_dist_id.hpp"
13BOOST_AUTO_TEST_SUITE( gd_hdf5_chckpnt_rstrt_test )
15BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_save_test )
21 float ghost_part = 0.0;
29 if (v_cl.getProcessingUnits() >= 32)
44 auto & dec = g_dist.getDecomposition();
47 bool val = dec.check_consistency();
48 BOOST_REQUIRE_EQUAL(val,
true);
52 auto it = g_dist.getDomainIterator();
59 auto keyg = g_dist.getGKey(key);
61 g_dist.template get<0>(key) = keyg.get(0);
68 v_cl.allGather(count,count_total);
73 for (
size_t i = 0; i < count_total.
size(); i++)
74 {
sum += count_total.get(i);}
79 g_dist.save(
"grid_dist_id.h5" + std::to_string(v_cl.getProcessingUnits()));
83BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_load_test )
89 float ghost_part = 0.0;
97 if (v_cl.getProcessingUnits() >= 32)
111 g_dist.load(
"grid_dist_id.h5" + std::to_string(v_cl.getProcessingUnits()));
113 auto it = g_dist.getDomainIterator();
126 auto keyg = g_dist.getGKey(key);
128 match &= g_dist.template get<0>(key) == keyg.get(0);
135 v_cl.allGather(count,count_total);
140 for (
size_t i = 0; i < count_total.
size(); i++)
141 sum += count_total.get(i);
143 BOOST_REQUIRE_EQUAL(
sum, (
size_t)k*k);
144 BOOST_REQUIRE_EQUAL(match,
true);
148BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_copy_test )
154 float ghost_part = 0.01;
162 if (v_cl.getProcessingUnits() >= 32)
177 g_dist.load(
"test_data/test_data_three.h5");
181 auto dom_sc = g_dist.getDomainIterator();
182 auto dom_ds = g_dist_copy.getDomainIterator();
183 while (dom_sc.isNext())
185 auto key_sc = dom_sc.get();
186 auto key_ds = dom_ds.get();
187 g_dist_copy.template get<0>(key_ds) = g_dist.template get<0>(key_sc);
193 auto it = g_dist_copy.getDomainIterator();
206 auto keyg = g_dist_copy.getGKey(key);
208 match &= g_dist_copy.template get<0>(key) == keyg.get(0);
215 v_cl.allGather(count,count_total);
220 for (
size_t i = 0; i < count_total.
size(); i++)
221 sum += count_total.get(i);
223 BOOST_REQUIRE_EQUAL(
sum, (
size_t)k*k);
224 BOOST_REQUIRE_EQUAL(match,
true);
227BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_load_test_diff_proc )
233 float ghost_part = 0.0;
241 if (v_cl.getProcessingUnits() >= 32)
255 g_dist.load(
"test_data/test_data_single.h5");
257 auto it = g_dist.getDomainIterator();
270 auto keyg = g_dist.getGKey(key);
272 match &= g_dist.template get<0>(key) == keyg.get(0);
281 BOOST_REQUIRE_EQUAL(count, (
size_t)k*k);
282 BOOST_REQUIRE_EQUAL(match,
true);
285BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_2GB_save_test )
287 float ghost_part = 0.0;
295 if (v_cl.getProcessingUnits() != 1)
311 auto & dec = g_dist.getDecomposition();
314 bool val = dec.check_consistency();
315 BOOST_REQUIRE_EQUAL(val,
true);
319 auto it = g_dist.getDomainIterator();
326 auto keyg = g_dist.getGKey(key);
328 g_dist.template get<0>(key) = keyg.get(0);
335 v_cl.allGather(count,count_total);
340 for (
size_t i = 0; i < count_total.
size(); i++)
341 {
sum += count_total.get(i);}
346 g_dist.save(
"grid_dist_2GB_id.h5" + std::to_string(v_cl.getProcessingUnits()));
350BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_2GB_load_test )
352 float ghost_part = 0.0;
360 if (v_cl.getProcessingUnits() != 1)
375 g_dist.load(
"grid_dist_2GB_id.h5" + std::to_string(v_cl.getProcessingUnits()));
377 auto it = g_dist.getDomainIterator();
387 auto keyg = g_dist.getGKey(key);
389 match &= g_dist.template get<0>(key) == keyg.get(0);
396 v_cl.allGather(count,count_total);
401 for (
size_t i = 0; i < count_total.
size(); i++)
402 sum += count_total.get(i);
404 BOOST_REQUIRE_EQUAL(
sum, (
size_t)970*650*512);
405 BOOST_REQUIRE_EQUAL(match,
true);
408BOOST_AUTO_TEST_SUITE_END()
This class represent an N-dimensional box.
This class decompose a space into sub-sub-domains and distribute them across processors.
Implementation of VCluster class.
This is a distributed grid.
Implementation of 1-D std::vector like structure.
Class for cpu time benchmarking.
void stop()
Stop the timer.
void start()
Start the timer.
It model an expression expr1 + ... exprn.