8#ifndef SRC_VECTOR_VECTOR_DIST_VERLET_PERFORMANCE_TESTS_HPP_
9#define SRC_VECTOR_VECTOR_DIST_VERLET_PERFORMANCE_TESTS_HPP_
11#include "util/stat/common_statistics.hpp"
16 boost::property_tree::ptree graphs;
27void print_test_v(std::string test,
size_t sz)
29 if (create_vcluster().getProcessUnitID() == 0)
30 std::cout << test <<
" " << sz <<
"\n";
33BOOST_AUTO_TEST_SUITE( verletlist_performance_test )
41size_t k_start = 100000;
54template<
unsigned int dim>
void vd_verlet_random_benchmark(
size_t k_start,
59 std::string str(
"Testing " + std::to_string(dim) +
"D vector no-order, Verlet-list");
64 for (
size_t r = 0; r < r_cutoff.size(); r++ )
69 float r_cut = r_cutoff.get(r);
71 report_vl.graphs.put(
"performance.verletlist.getVerletList" + std::to_string(dim) +
"D(" + std::to_string(r) +
").rcut",r_cut);
77 size_t k_count = 1 + log2(k/k_min);
81 for (
size_t k_int = k ; k_int >= k_min ; k_int/=2 )
83 BOOST_TEST_CHECKPOINT(
"Testing " << dim <<
"D vector without an Hilbert curve reordering k=" << k_int );
85 report_vl.graphs.put(
"performance.verletlist.getVerletList" + std::to_string(dim) +
"D(" + std::to_string(r) +
").npart(" + std::to_string(c) +
").n",k_int);
86 report_vl.graphs.put(
"performance.verletlist.calc_forces" + std::to_string(dim) +
"D(" + std::to_string(r) +
").npart(" + std::to_string(c) +
").n",k_int);
88 if (n_particles.
size() < k_count)
89 n_particles.add(k_int);
93 for (
size_t i = 0; i < dim; i++)
101 for (
size_t i = 0; i < dim; i++)
107 vd_initialize<dim>(vd, v_cl);
109 vd.template ghost_get<0>();
114 double sum_verlet_mean = 0;
115 double sum_verlet_dev = 0;
116 for (
size_t n = 0 ; n < N_STAT_TEST; n++)
117 {measures.add(benchmark_get_verlet(vd,r_cut));}
118 standard_deviation(measures,sum_verlet_mean,sum_verlet_dev);
120 report_vl.graphs.put(
"performance.verletlist.getVerletList" + std::to_string(dim) +
"D(" + std::to_string(r) +
").npart(" + std::to_string(c) +
").mean",sum_verlet_mean);
121 report_vl.graphs.put(
"performance.verletlist.getVerletList" + std::to_string(dim) +
"D(" + std::to_string(r) +
").npart(" + std::to_string(c) +
").dev",sum_verlet_dev);
125 auto NN = vd.getCellList(r_cut);
126 double sum_fr_mean = 0;
127 double sum_fr_dev = 0;
130 for (
size_t l = 0 ; l < N_STAT_TEST ; l++)
131 {measures.add(benchmark_calc_forces<dim>(NN,vd,r_cut));}
132 standard_deviation(measures,sum_fr_mean,sum_fr_dev);
134 report_vl.graphs.put(
"performance.verletlist.calc_forces" + std::to_string(dim) +
"D(" + std::to_string(r) +
").npart(" + std::to_string(c) +
").mean",sum_fr_mean);
135 report_vl.graphs.put(
"performance.verletlist.calc_forces" + std::to_string(dim) +
"D(" + std::to_string(r) +
").npart(" + std::to_string(c) +
").dev",sum_fr_dev);
138 {std::cout <<
"Particles: " << k_int <<
"," <<
"cut-off: " << r_cut <<
" time to construct a Verlet list = " << sum_verlet_mean <<
" dev: " << sum_verlet_dev <<
" calculate force = " << sum_fr_mean <<
" dev: " << sum_fr_dev << std::endl;}
147BOOST_AUTO_TEST_CASE( vector_dist_verlet_test )
150 vd_verlet_random_benchmark<3>(k_start,k_min,r_cutoff,n_particles);
151 vd_verlet_random_benchmark<2>(k_start,k_min,r_cutoff,n_particles);
154BOOST_AUTO_TEST_CASE(vector_dist_verlet_performance_write_report)
157 for (
size_t r = 0; r < r_cutoff.size(); r++ )
159 report_vl.graphs.put(
"graphs.graph(" + std::to_string(r) +
").type",
"line");
160 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r) +
").title",
"getVerletList 3D performance r_cut=" + std::to_string(r_cutoff.get(r)));
161 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r) +
").x.title",
"number of particles");
162 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r) +
").y.title",
"Time seconds");
163 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r) +
").y.data(0).source",
"performance.verletlist.getVerletList3D(" + std::to_string(r) +
").npart(#).mean");
164 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r) +
").x.data(0).source",
"performance.verletlist.getVerletList3D(" + std::to_string(r) +
").npart(#).n");
165 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r) +
").y.data(0).title",
"Verlet-list");
166 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r) +
").options.log_y",
"true");
170 for (
size_t r = 0; r < r_cutoff.size(); r++ )
172 report_vl.graphs.put(
"graphs.graph(" + std::to_string(r_cutoff.size() + r) +
").type",
"line");
173 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r_cutoff.size() + r) +
").title",
"calc_force 3D performance r_cut=" + std::to_string(r_cutoff.get(r)));
174 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r_cutoff.size() + r) +
").x.title",
"number of particles");
175 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r_cutoff.size() + r) +
").y.title",
"Time seconds");
176 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r_cutoff.size() + r) +
").y.data(0).source",
"performance.verletlist.calc_forces3D(" + std::to_string(r) +
").npart(#).mean");
177 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r_cutoff.size() + r) +
").x.data(0).source",
"performance.verletlist.calc_forces3D(" + std::to_string(r) +
").npart(#).n");
178 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r_cutoff.size() + r) +
").y.data(0).title",
"Verlet-list");
179 report_vl.graphs.add(
"graphs.graph(" + std::to_string(r_cutoff.size() + r) +
").options.log_y",
"true");
183 for (
size_t r = 0; r < r_cutoff.size(); r++ )
185 report_vl.graphs.put(
"graphs.graph(" + std::to_string(2*r_cutoff.size() + r) +
").type",
"line");
186 report_vl.graphs.add(
"graphs.graph(" + std::to_string(2*r_cutoff.size() + r) +
").title",
"getVerletList 2D performance r_cut=" + std::to_string(r_cutoff.get(r)));
187 report_vl.graphs.add(
"graphs.graph(" + std::to_string(2*r_cutoff.size() + r) +
").x.title",
"number of particles");
188 report_vl.graphs.add(
"graphs.graph(" + std::to_string(2*r_cutoff.size() + r) +
").y.title",
"Time seconds");
189 report_vl.graphs.add(
"graphs.graph(" + std::to_string(2*r_cutoff.size() + r) +
").y.data(0).source",
"performance.verletlist.getVerletList2D(" + std::to_string(r) +
").npart(#).mean");
190 report_vl.graphs.add(
"graphs.graph(" + std::to_string(2*r_cutoff.size() + r) +
").x.data(0).source",
"performance.verletlist.getVerletList2D(" + std::to_string(r) +
").npart(#).n");
191 report_vl.graphs.add(
"graphs.graph(" + std::to_string(2*r_cutoff.size() + r) +
").y.data(0).title",
"Verlet-list");
192 report_vl.graphs.add(
"graphs.graph(" + std::to_string(2*r_cutoff.size() + r) +
").options.log_y",
"true");
196 for (
size_t r = 0; r < r_cutoff.size(); r++ )
198 report_vl.graphs.put(
"graphs.graph(" + std::to_string(3*r_cutoff.size() + r) +
").type",
"line");
199 report_vl.graphs.add(
"graphs.graph(" + std::to_string(3*r_cutoff.size() + r) +
").title",
"calc_force 2D performance r_cut=" + std::to_string(r_cutoff.get(r)));
200 report_vl.graphs.add(
"graphs.graph(" + std::to_string(3*r_cutoff.size() + r) +
").x.title",
"number of particles");
201 report_vl.graphs.add(
"graphs.graph(" + std::to_string(3*r_cutoff.size() + r) +
").y.title",
"Time seconds");
202 report_vl.graphs.add(
"graphs.graph(" + std::to_string(3*r_cutoff.size() + r) +
").y.data(0).source",
"performance.verletlist.calc_forces2D(" + std::to_string(r) +
").npart(#).mean");
203 report_vl.graphs.add(
"graphs.graph(" + std::to_string(3*r_cutoff.size() + r) +
").x.data(0).source",
"performance.verletlist.calc_forces2D(" + std::to_string(r) +
").npart(#).n");
204 report_vl.graphs.add(
"graphs.graph(" + std::to_string(3*r_cutoff.size() + r) +
").y.data(0).title",
"Verlet-list");
205 report_vl.graphs.add(
"graphs.graph(" + std::to_string(3*r_cutoff.size() + r) +
").options.log_y",
"true");
208 if (create_vcluster().rank() == 0)
210 boost::property_tree::xml_writer_settings<std::string> settings(
' ', 4);
211 boost::property_tree::write_xml(
"verletlist_performance.xml", report_vl.graphs,std::locale(),settings);
213 std::string file_xml_ref(test_dir);
214 file_xml_ref += std::string(
"/openfpm_pdata/verletlist_performance_ref.xml");
218 StandardXMLPerformanceGraph(
"verletlist_performance.xml",file_xml_ref,cg);
220 addUpdateTime(cg,create_vcluster().size(),
"pdata",
"verletlist_performance");
222 if (create_vcluster().getProcessUnitID() == 0)
223 {cg.
write(
"verletlist_performance.html");}
227BOOST_AUTO_TEST_SUITE_END()
This class represent an N-dimensional box.
__device__ __host__ void setHigh(int i, T val)
set the high interval of the box
__device__ __host__ void setLow(int i, T val)
set the low interval of the box
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.
size_t getProcessUnitID()
Get the process unit id.
size_t getProcessingUnits()
Get the total number of processors.
Implementation of VCluster class.
Implementation of 1-D std::vector like structure.