8 #ifndef OPENFPM_DATA_SRC_GRID_GRID_PERFORMANCE_TESTS_HPP_
9 #define OPENFPM_DATA_SRC_GRID_GRID_PERFORMANCE_TESTS_HPP_
11 #include "grid_util_test.hpp"
16 BOOST_AUTO_TEST_CASE(grid_performance_set_obj)
18 size_t sz[] = {128,128,128};
28 std::vector<double> times(N_STAT + 1);
31 for (
size_t j = 0 ; j < 8 ; j++)
33 for (
size_t i = 1 ; i < N_STAT+1 ; i++)
38 auto it = c3.getIterator();
51 std::sort(times.begin(),times.end());
55 testsg.add(
"Grid so");
56 per_timesg.add(times[0]);
60 BOOST_AUTO_TEST_CASE(grid_performance_set_other_grid)
62 size_t sz[] = {128,128,128};
70 std::vector<double> times(N_STAT + 1);
73 for (
size_t j = 0 ; j < 8 ; j++)
75 for (
size_t i = 1 ; i < N_STAT+1 ; i++)
80 auto it = c3.getIterator();
84 c3.set(it.get(),c1,it.get());
93 std::sort(times.begin(),times.end());
97 testsg.add(
"Grid sog");
98 per_timesg.add(times[0]);
102 BOOST_AUTO_TEST_CASE(grid_performance_set_other_grid_encap)
104 size_t sz[] = {128,128,128};
112 std::vector<double> times(N_STAT + 1);
115 for (
size_t j = 0 ; j < 8 ; j++)
117 for (
size_t i = 1 ; i < N_STAT+1 ; i++)
122 auto it = c3.getIterator();
126 c3.set(it.get(),c1.get_o(it.get()));
135 std::sort(times.begin(),times.end());
139 testsg.add(
"Grid soge");
140 per_timesg.add(times[0]);
143 BOOST_AUTO_TEST_CASE(grid_performance_duplicate)
145 size_t sz[] = {128,128,128};
153 std::vector<double> times(N_STAT_SMALL + 1);
156 for (
size_t j = 0 ; j < 8 ; j++)
158 for (
size_t i = 1 ; i < N_STAT_SMALL+1 ; i++)
169 std::sort(times.begin(),times.end());
173 testsg.add(
"Grid dup");
174 per_timesg.add(times[0]);
179 BOOST_AUTO_TEST_CASE(grid_performance_write_report)
185 std::string per_dir(test_dir);
189 y_ref.load(per_dir + std::string(
"/ref_timesg"));
191 load_and_combine(per_dir + std::string(
"/previous_measureg"),y,per_timesg,testsg.size());
196 for (
size_t j = 0; j < y.get(0).size(); j++)
197 yn.add(
"config " + std::to_string(j));
203 options.title = std::string(
"Grid Performances");
204 options.yAxis = std::string(
"Time (seconds)");
205 options.xAxis = std::string(
"Benchmark");
206 options.stype = std::string(
"bars");
208 std::stringstream g_test_desc;
209 g_test_desc <<
"<h2>Grid performance test</h2>\n";
210 g_test_desc <<
"<strong>128x128x128 Grid containing a Point_test<float></strong><br>";
211 g_test_desc <<
"<strong>Grid so:</strong> Initialize each element of the grid<br>";
212 g_test_desc <<
"<strong>Grid sog:</strong> Manual copy of two grids<br>";
213 g_test_desc <<
"<strong>Grid soge:</strong> Manual copy of two grids in a different way<br>";
214 g_test_desc <<
"<strong>Grid dup:</strong> Duplication of the grid<br>";
217 cg.addHTML(g_test_desc.str());
218 cg.AddColumsGraph(testsg,y,yn,options);
225 speedup_calculate(y_ref_sup,y,y_ref,yn);
227 std::stringstream g_test_spdesc;
228 g_test_spdesc <<
"<h2>Grid speedup</h2>\n";
229 g_test_spdesc <<
"The previous tests are compared with the best performances ever registered, ";
230 g_test_spdesc <<
"the banded area indicate the upper and lower bounds of the best registrered performances.<br>";
231 g_test_spdesc <<
"The lines are the latest 5 test<br>";
232 g_test_spdesc <<
"<strong>Line inside the area</strong>: The tested configuration has improvement or degradation in performance<br>";
233 g_test_spdesc <<
"<strong>Line break the upper bound</strong>: The tested configuration has improvement in performance<br>";
234 g_test_spdesc <<
"<strong>Line break the lower bound</strong>: The tested configuration has degradation in performance<br>";
236 cg.addHTML(g_test_spdesc.str());
237 cg.AddPointsGraph(testsg,y_ref_sup,yn,options);
double getcputime()
Return the cpu time.
void start()
Start the timer.
grid_cpu< dim, T, S, Mem > duplicate() const THROW
create a duplicated version of the grid
Test structure used for several test.
Implementation of 1-D std::vector like structure.
Class for cpu time benchmarking.
void stop()
Stop the timer.