8 #ifndef OPENFPM_DATA_SRC_PERFORMANCE_HPP_
9 #define OPENFPM_DATA_SRC_PERFORMANCE_HPP_
11 #include "Plot/GoogleChart.hpp"
19 #define N_STAT_SMALL 1
22 #ifdef PERFORMANCE_TEST
25 const char * test_dir;
33 BOOST_AUTO_TEST_SUITE( performance )
37 #include "Grid/grid_performance_tests.hpp"
38 #include "Vector/vector_performance_test.hpp"
40 BOOST_AUTO_TEST_SUITE_END()
52 std::string exec(
const char* cmd)
54 std::shared_ptr<FILE> pipe(popen(cmd,
"r"), pclose);
59 std::string result =
"";
60 while (!feof(pipe.get()))
62 if (fgets(buffer, 128, pipe.get()) != NULL)
75 char pdata_commit[41];
76 char devices_commit[41];
78 char vcluster_commit[41];
79 char numeric_commit[41];
86 std::string toHTML(
size_t i)
88 std::stringstream html;
90 html <<
"<div style=\" border-radius: 25px; padding: 20px 20px 20px 20px ;\" >\n\
91 <div style=\"background-color:white; border-radius: 25px;border: 2px solid #000000; padding: 20px;\" >\n\
92 <h4>config " << i <<
"</h4>\n";
93 html <<
"<strong>OpenFPM numeric:</strong> " << numeric_commit <<
"<br>\n";
94 html <<
"<strong>OpenFPM pdata:</strong> " << pdata_commit <<
"<br>\n";
95 html <<
"<strong>OpenFPM vcluster:</strong> " << vcluster_commit <<
"<br>\n";
96 html <<
"<strong>OpenFPM io:</strong> " << io_commit <<
"<br>\n";
97 html <<
"<strong>OpenFPM pdata:</strong> " << pdata_commit <<
"<br>\n";
98 html <<
"<strong>OpenFPM data:</strong> " << data_commit <<
"<br>\n";
99 html <<
"<strong>OpenFPM devices:</strong> " << devices_commit <<
"<br>\n";
112 void getConfig(configuration & conf)
115 std::string out = exec(
"git rev-parse HEAD");
118 for (
size_t i = 0 ; i < 40 ; i++)
119 conf.data_commit[i] = out[i];
123 std::string out2 = exec(
"cd ../../openfpm_devices ; git rev-parse HEAD");
126 for (
size_t i = 0 ; i < 40 ; i++)
127 conf.devices_commit[i] = out2[i];
131 std::string out3 = exec(
"cd ../../openfpm_io ; git rev-parse HEAD");
134 for (
size_t i = 0 ; i < 40 ; i++)
135 conf.io_commit[i] = out3[i];
139 std::string out4 = exec(
"cd ../../openfpm_vcluster ; git rev-parse HEAD");
142 for (
size_t i = 0 ; i < 40 ; i++)
143 conf.vcluster_commit[i] = out4[i];
147 std::string out5 = exec(
"cd ../../ ; git rev-parse HEAD");
150 for (
size_t i = 0 ; i < 40 ; i++)
151 conf.pdata_commit[i] = out5[i];
155 std::string out6 = exec(
"cd ../../openfpm_numerics ; git rev-parse HEAD");
158 for (
size_t i = 0 ; i < 40 ; i++)
159 conf.numeric_commit[i] = out6[i];
176 if (commits.size() >= MEASURE_SET)
181 getConfig(commits.last());
183 bool saved = commits.save(file);
185 std::cerr << __FILE__ <<
":" << __LINE__ <<
" error saving previous commit \n";
210 for(
size_t i = 0 ; i < y.size() ; i++)
212 if (y.get(i).size() >= MEASURE_SET)
214 y.get(i).add(per_times.get(i));
235 for (
size_t i = 0 ; i < y_ref.size() ; i++)
242 for (
size_t j = 0 ; j < y_ref.get(i).size() ; j++)
244 if (y_ref.get(i).get(j) < min)
245 min = y_ref.get(i).get(j);
247 if (y_ref.get(i).get(j) > max)
248 max = y_ref.get(i).get(j);
250 average += y_ref.get(i).get(j);
252 average /= y_ref.get(i).size();
258 for (
size_t j = 0 ; j < y.get(i).size() ; j++)
260 y_ref_sup.last().add((average/y.get(i).get(j) - 1.0) * 100.0);
261 yn.add(
"config " + std::to_string(j));
264 y_ref_sup.last().add((average/min - 1.0) * 100.0);
266 y_ref_sup.last().add((average/max - 1.0) * 100.0);
271 void write_performance_report()
277 std::string per_dir(test_dir);
280 load_and_combine_commit(per_dir + std::string(
"/prev_commit"),pcommit);
282 std::string config_list;
284 config_list += std::string(
"<h3>Highest configuration number is the latest version</h3>\n");
286 for (
size_t i = 0 ; i < pcommit.size() ; i++)
287 config_list += pcommit.get(i).toHTML(i);
289 cg.addHTML(config_list);
290 cg.write(test_dir + std::string(
"/gc_out.html"));
Implementation of 1-D std::vector like structure.