8#ifndef OPENFPM_DATA_SRC_GRID_GRID_PERFORMANCE_TESTS_HPP_
9#define OPENFPM_DATA_SRC_GRID_GRID_PERFORMANCE_TESTS_HPP_
11#include "Grid/grid_util_test.hpp"
12#include "util/stat/common_statistics.hpp"
17 boost::property_tree::ptree graphs;
22BOOST_AUTO_TEST_SUITE( grid_performance )
24BOOST_AUTO_TEST_CASE(grid_performance_set_obj)
26 size_t sz[] = {128,128,128};
28 report_grid_funcs.graphs.put(
"performance.grid.set(0).grid.x",sz[0]);
29 report_grid_funcs.graphs.put(
"performance.grid.set(0).grid.y",sz[1]);
30 report_grid_funcs.graphs.put(
"performance.grid.set(0).grid.z",sz[2]);
40 std::vector<double> times(N_STAT + 1);
42 for (
size_t i = 0 ; i < N_STAT+1 ; i++)
47 auto it = c3.getIterator();
63 standard_deviation(times,mean,dev);
65 report_grid_funcs.graphs.put(
"performance.grid.set(0).x.data.name",
"Grid_so");
66 report_grid_funcs.graphs.put(
"performance.grid.set(0).y.data.mean",mean);
67 report_grid_funcs.graphs.put(
"performance.grid.set(0).y.data.dev",dev);
70BOOST_AUTO_TEST_CASE(grid_performance_set_other_grid)
72 size_t sz[] = {128,128,128};
74 report_grid_funcs.graphs.put(
"performance.grid.set(1).grid.x",sz[0]);
75 report_grid_funcs.graphs.put(
"performance.grid.set(1).grid.y",sz[1]);
76 report_grid_funcs.graphs.put(
"performance.grid.set(1).grid.z",sz[2]);
85 std::vector<double> times(N_STAT + 1);
87 for (
size_t i = 0 ; i < N_STAT+1 ; i++)
92 auto it = c3.getIterator();
96 c3.set(it.get(),c1,it.get());
105 std::sort(times.begin(),times.end());
109 standard_deviation(times,mean,dev);
111 report_grid_funcs.graphs.put(
"performance.grid.set(1).x.data.name",
"Grid_sog");
112 report_grid_funcs.graphs.put(
"performance.grid.set(1).y.data.mean",mean);
113 report_grid_funcs.graphs.put(
"performance.grid.set(1).y.data.dev",dev);
116BOOST_AUTO_TEST_CASE(grid_performance_set_other_grid_encap)
118 size_t sz[] = {128,128,128};
120 report_grid_funcs.graphs.put(
"performance.grid.set(2).grid.x",sz[0]);
121 report_grid_funcs.graphs.put(
"performance.grid.set(2).grid.y",sz[1]);
122 report_grid_funcs.graphs.put(
"performance.grid.set(2).grid.z",sz[2]);
131 std::vector<double> times(N_STAT + 1);
133 for (
size_t i = 0 ; i < N_STAT+1 ; i++)
138 auto it = c3.getIterator();
142 c3.set(it.get(),c1.get_o(it.get()));
154 standard_deviation(times,mean,dev);
156 report_grid_funcs.graphs.put(
"performance.grid.set(2).x.data.name",
"Grid_soge");
157 report_grid_funcs.graphs.put(
"performance.grid.set(2).y.data.mean",mean);
158 report_grid_funcs.graphs.put(
"performance.grid.set(2).y.data.dev",dev);
161BOOST_AUTO_TEST_CASE(grid_performance_duplicate)
163 size_t sz[] = {128,128,128};
165 report_grid_funcs.graphs.put(
"performance.grid.set(3).grid.x",sz[0]);
166 report_grid_funcs.graphs.put(
"performance.grid.set(3).grid.y",sz[1]);
167 report_grid_funcs.graphs.put(
"performance.grid.set(3).grid.z",sz[2]);
175 std::vector<double> times(N_STAT_SMALL + 1);
177 for (
size_t i = 0 ; i < N_STAT_SMALL+1 ; i++)
191 standard_deviation(times,mean,dev);
193 report_grid_funcs.graphs.put(
"performance.grid.set(3).x.data.name",
"Grid_dup");
194 report_grid_funcs.graphs.put(
"performance.grid.set(3).y.data.mean",mean);
195 report_grid_funcs.graphs.put(
"performance.grid.set(3).y.data.dev",dev);
200BOOST_AUTO_TEST_CASE(grid_performance_write_report)
204 report_grid_funcs.graphs.put(
"graphs.graph(0).type",
"line");
205 report_grid_funcs.graphs.add(
"graphs.graph(0).title",
"Grid set functions (so/sog/soge) and duplicate (dup) performance");
206 report_grid_funcs.graphs.add(
"graphs.graph(0).x.title",
"Tests");
207 report_grid_funcs.graphs.add(
"graphs.graph(0).y.title",
"Time seconds");
208 report_grid_funcs.graphs.add(
"graphs.graph(0).y.data(0).source",
"performance.grid.set(#).y.data.mean");
209 report_grid_funcs.graphs.add(
"graphs.graph(0).x.data(0).source",
"performance.grid.set(#).x.data.name");
210 report_grid_funcs.graphs.add(
"graphs.graph(0).y.data(0).title",
"Actual");
211 report_grid_funcs.graphs.add(
"graphs.graph(0).interpolation",
"lines");
213 boost::property_tree::xml_writer_settings<std::string> settings(
' ', 4);
214 boost::property_tree::write_xml(
"grid_performance_funcs.xml", report_grid_funcs.graphs,std::locale(),settings);
218 std::string file_xml_ref(test_dir);
219 file_xml_ref += std::string(
"/openfpm_data/grid_performance_funcs_ref.xml");
221 StandardXMLPerformanceGraph(
"grid_performance_funcs.xml",file_xml_ref,cg);
223 addUpdateTime(cg,1,
"data",
"grid_performance_funcs");
224 createCommitFile(
"data");
226 cg.
write(
"grid_performance_funcs.html");
229BOOST_AUTO_TEST_SUITE_END()
Small class to produce graph with Google chart in HTML.
void write(std::string file)
It write the graphs on file in html format using Google charts.
Test structure used for several test.
Class for cpu time benchmarking.
void stop()
Stop the timer.
void start()
Start the timer.
double getwct()
Return the elapsed real time.