Commit 29267be2 authored by incardon's avatar incardon

Performance test

parent 5ba70ba8
......@@ -51,21 +51,55 @@ openfpm::vector<openfpm::vector<double>> time_create_hilb_2_dev;
BOOST_AUTO_TEST_CASE( vector_dist_celllist_random_test )
{
//Benchmark test for 2D and 3D
cell_list_comp_reorder_random_benchmark<3>(k_start,k_min,r_cutoff,n_particles,time_rand_mean,time_create_rand_mean,time_rand_dev,time_create_rand_dev);
cell_list_comp_reorder_random_benchmark<2>(k_start,k_min,r_cutoff,n_particles,time_rand_2_mean,time_create_rand_2_mean,time_rand_2_dev,time_create_rand_2_dev);
cell_list_comp_reorder_random_benchmark<3>(k_start,
k_min,
r_cutoff,
n_particles,
time_rand_mean,
time_rand_dev,
time_create_rand_mean,
time_create_rand_dev);
cell_list_comp_reorder_random_benchmark<2>(k_start,
k_min,
r_cutoff,
n_particles,
time_rand_2_mean,
time_rand_2_dev,
time_create_rand_2_mean,
time_create_rand_2_dev);
}
BOOST_AUTO_TEST_CASE( vector_dist_celllist_hilbert_test )
{
//Benchmark test for 2D and 3D
cell_list_comp_reorder_hilbert_benchmark<3>(k_start,k_min,r_cutoff,n_particles,time_hilb_mean,time_hilb_dev,time_create_hilb_mean,time_create_hilb_dev);
cell_list_comp_reorder_hilbert_benchmark<2>(k_start,k_min,r_cutoff,n_particles,time_hilb_2_mean,time_hilb_2_dev,time_create_hilb_2_mean,time_create_hilb_2_dev);
cell_list_comp_reorder_hilbert_benchmark<3>(k_start,
k_min,
r_cutoff,
n_particles,
time_hilb_mean,
time_hilb_dev,
time_create_hilb_mean,
time_create_hilb_dev);
cell_list_comp_reorder_hilbert_benchmark<2>(k_start,
k_min,
r_cutoff,
n_particles,
time_hilb_2_mean,
time_hilb_2_dev,
time_create_hilb_2_mean,
time_create_hilb_2_dev);
}
BOOST_AUTO_TEST_CASE(vector_dist_cl_performance_write_report)
{
GoogleChart cg;
double warning_level = 0;
double norm = 0;
//Write report for 2D and 3D
cell_list_comp_reorder_report<3>(cg,
r_cutoff,
......@@ -77,22 +111,33 @@ BOOST_AUTO_TEST_CASE(vector_dist_cl_performance_write_report)
time_create_hilb_mean,
time_create_rand_mean,
time_create_hilb_dev,
time_create_rand_dev);
time_create_rand_dev,
warning_level,
norm);
cell_list_comp_reorder_report<2>(cg,
r_cutoff,
n_particles,
time_hilb_2_mean,
time_rand_2_mean,
time_create_hilb_2_mean,
time_create_rand_2_mean,
time_rand_2_dev,
time_hilb_2_dev,
time_create_hilb_2_mean,
time_create_rand_2_mean,
time_create_hilb_2_dev,
time_create_rand_2_dev);
time_create_rand_2_dev,
warning_level,
norm);
addUpdtateTime(cg);
if (create_vcluster().getProcessUnitID() == 0)
{
// write the xml report
pt.put("celllist.comp.warning",warning_level);
cg.write(std::string(test_dir) + "/openfpm_pdata/Celllist_comp_ord.html");
}
}
BOOST_AUTO_TEST_SUITE_END()
......
......@@ -90,40 +90,6 @@ BOOST_AUTO_TEST_CASE(vector_dist_cl_performance_write_report)
{
GoogleChart cg;
/* n_particles.save("debug1");
time_rand_mean.save("debug2");
time_hilb_mean.save("debug3");
time_rand_dev.save("debug4");
time_hilb_dev.save("debug5");
time_reorder_mean.save("debug6");
time_reorder_dev.save("debug7");
time_hilb_moved.save("debug8");
time_rand_2_mean.save("debug9");
time_hilb_2_mean.save("debug10");
time_rand_2_dev.save("debug11");
time_hilb_2_dev.save("debug12");
time_reorder_2_mean.save("debug13");
time_reorder_2_dev.save("debug14");
time_hilb_moved_2.save("debug15");*/
/* n_particles.load("debug1");
time_rand_mean.load("debug2");
time_hilb_mean.load("debug3");
time_rand_dev.load("debug4");
time_hilb_dev.load("debug5");
time_reorder_mean.load("debug6");
time_reorder_dev.load("debug7");
time_hilb_moved.load("debug8");
time_rand_2_mean.load("debug9");
time_hilb_2_mean.load("debug10");
time_rand_2_dev.load("debug11");
time_hilb_2_dev.load("debug12");
time_reorder_2_mean.load("debug13");
time_reorder_2_dev.load("debug14");
time_hilb_moved_2.load("debug15");*/
//Write report for 2D and 3D
cell_list_part_reorder_report<3>(cg,
n_moving,
......@@ -149,6 +115,8 @@ BOOST_AUTO_TEST_CASE(vector_dist_cl_performance_write_report)
time_rand_2_dev,
time_reorder_2_dev);
addUpdtateTime(cg);
if (create_vcluster().getProcessUnitID() == 0)
cg.write(std::string(test_dir) + "/openfpm_pdata/Celllist_part_ord.html");
}
......
......@@ -861,6 +861,9 @@ template<unsigned int dim> void vd_verlet_performance_write_report(GoogleChart &
y_ref_create_mean.load(file_mean);
y_ref_create_dev.load(file_var);
// warning level
openfpm::vector<int> warning_vlevel;
// Get the test dir
std::string file_mean2(test_dir);
std::string file_var2(test_dir);
......@@ -872,6 +875,9 @@ template<unsigned int dim> void vd_verlet_performance_write_report(GoogleChart &
y_ref_force_mean.load(file_mean2);
y_ref_force_dev.load(file_var2);
// warning level
openfpm::vector<int> warning_vlevel2;
// Speedup graphs data
openfpm::vector<size_t> x;
openfpm::vector<openfpm::vector<openfpm::vector<double>>> y;
......@@ -912,6 +918,8 @@ template<unsigned int dim> void vd_verlet_performance_write_report(GoogleChart &
y.resize(time_force_mean.size());
for (size_t r = 0; r < time_force_mean.size(); r++)
{
int warning_level = -1;
y.get(r).resize(time_force_mean.get(r).size());
y_dev.get(r).resize(time_force_mean.get(r).size());
for (size_t k = 0; k < time_force_mean.get(r).size(); k++)
......@@ -920,7 +928,11 @@ template<unsigned int dim> void vd_verlet_performance_write_report(GoogleChart &
y.get(r).get(k).add(time_force_mean.get(r).get(k));
y.get(r).get(k).add(y_ref_force_mean.get(r).get(k).get(0) - 3.0*y_ref_force_dev.get(r).get(k).get(0) );
y.get(r).get(k).add(y_ref_force_mean.get(r).get(k).get(0) + 3.0*y_ref_force_dev.get(r).get(k).get(0) );
warning_set(warning_level,time_force_mean.get(r).get(k),y_ref_force_mean.get(r).get(k).get(0),y_ref_force_dev.get(r).get(k).get(0));
}
warning_vlevel.add(warning_level);
}
}
......@@ -962,6 +974,8 @@ template<unsigned int dim> void vd_verlet_performance_write_report(GoogleChart &
y2.resize(time_create_mean.size());
for (size_t r = 0; r < time_create_mean.size(); r++)
{
int warning_level = -1;
y2.get(r).resize(time_create_mean.get(r).size());
for (size_t k = 0; k < time_create_mean.get(r).size(); k++)
{
......@@ -970,7 +984,11 @@ template<unsigned int dim> void vd_verlet_performance_write_report(GoogleChart &
y2.get(r).get(k).add(y_ref_create_mean.get(r).get(k).get(0) - 3.0*y_ref_create_dev.get(r).get(k).get(0) );
y2.get(r).get(k).add(y_ref_create_mean.get(r).get(k).get(0) + 3.0*y_ref_create_dev.get(r).get(k).get(0) );
warning_set(warning_level,time_create_mean.get(r).get(k),y_ref_create_mean.get(r).get(k).get(0),y_ref_create_dev.get(r).get(k).get(0));
}
warning_vlevel2.add(warning_level);
}
}
......@@ -982,13 +1000,17 @@ template<unsigned int dim> void vd_verlet_performance_write_report(GoogleChart &
options.yAxis = std::string("Time (s)");
options.xAxis = std::string("Number of particles");
options.lineWidth = 2;
options.more = GC_Y_LOG + "," + GC_ZOOM;
std::string str("<h1>Verlet-list " + std::to_string(dim) + "-D performance test force calculation: </h1>");
cg.addHTML(str);
for (size_t i = 0; i < r_cutoff.size(); i++)
{
std::string chart_area;
if (warning_vlevel.size() != 0)
addchartarea(chart_area,warning_vlevel.get(i));
options.more = GC_Y_LOG + "," + GC_ZOOM + chart_area;
options.title = std::string("Verlet-list cut-off radius: " + std::to_string(r_cutoff.get(i)));
cg.AddLinesGraph(x,y.get(i),yn,options);
}
......@@ -1001,13 +1023,17 @@ template<unsigned int dim> void vd_verlet_performance_write_report(GoogleChart &
options2.yAxis = std::string("Time to construct a verlet-list (s)");
options2.xAxis = std::string("Number of particles");
options2.lineWidth = 2;
options2.more = GC_ZOOM;
std::string str2("<h2>2) Total calculation time</h2>");
std::string str2("<h2>2) Time to construct a Verlet-list time</h2>");
cg.addHTML(str2);
for (size_t i = 0; i < r_cutoff.size(); i++)
{
std::string chart_area;
if (warning_vlevel.size() != 0)
addchartarea(chart_area,warning_vlevel2.get(i));
options2.more = GC_ZOOM + chart_area;
options2.title = std::string("Cell-list performance, cut-off radius: " + std::to_string(r_cutoff.get(i)));
cg.AddLinesGraph(x,y2.get(i),yn2,options2);
}
......@@ -1036,8 +1062,21 @@ template<unsigned int dim> void cell_list_part_reorder_report(GoogleChart & cg,
// Speedup graphs data
cl_part_time<dim>(cg,cl_n_particles,cl_r_cutoff,cl_orders,cl_time_hilb_mean,cl_time_rand_mean,cl_time_hilb_dev,cl_time_rand_dev);
cl_part_reorder_time<dim>(cg,cl_n_particles,cl_r_cutoff,cl_orders,cl_time_reorder_mean,cl_time_reorder_dev);
cl_part_time<dim>(cg,
cl_n_particles,
cl_r_cutoff,
cl_orders,
cl_time_hilb_mean,
cl_time_rand_mean,
cl_time_hilb_dev,
cl_time_rand_dev);
cl_part_reorder_time<dim>(cg,
cl_n_particles,
cl_r_cutoff,
cl_orders,
cl_time_reorder_mean,
cl_time_reorder_dev);
}
/*! \brief Function for cell list hilb performance report
......@@ -1053,10 +1092,29 @@ template<unsigned int dim> void cell_list_comp_reorder_report(GoogleChart & cg,
openfpm::vector<openfpm::vector<double>> & cl_time_create_hilb_mean,
openfpm::vector<openfpm::vector<double>> & cl_time_create_rand_mean,
openfpm::vector<openfpm::vector<double>> & cl_time_create_hilb_dev,
openfpm::vector<openfpm::vector<double>> & cl_time_create_rand_dev)
openfpm::vector<openfpm::vector<double>> & cl_time_create_rand_dev,
double & warning_level,
double & norm)
{
cl_comp_normal_vs_hilbert_force_time<dim>(cg,cl_n_particles,cl_r_cutoff,cl_time_hilb_mean,cl_time_rand_mean,cl_time_hilb_dev,cl_time_rand_dev);
cl_comp_normal_vs_hilbert_create_time<dim>(cg,cl_n_particles,cl_r_cutoff,cl_time_create_hilb_mean,cl_time_create_rand_mean,cl_time_create_hilb_dev,cl_time_create_rand_dev);
cl_comp_normal_vs_hilbert_force_time<dim>(cg,
cl_n_particles,
cl_r_cutoff,
cl_time_hilb_mean,
cl_time_rand_mean,
cl_time_hilb_dev,
cl_time_rand_dev,
warning_level,
norm);
cl_comp_normal_vs_hilbert_create_time<dim>(cg,
cl_n_particles,
cl_r_cutoff,
cl_time_create_hilb_mean,
cl_time_create_rand_mean,
cl_time_create_hilb_dev,
cl_time_create_rand_dev,
warning_level,
norm);
}
#endif /* SRC_VECTOR_VECTOR_DIST_PERFORMANCE_UTIL_HPP_ */
......@@ -54,7 +54,11 @@ BOOST_AUTO_TEST_CASE(vector_dist_verlet_performance_write_report)
vd_verlet_performance_write_report<2>(cg,r_cutoff,n_particles,time_force_mean_2,time_force_dev_2,time_create_mean_2,time_create_dev_2);
if (create_vcluster().getProcessUnitID() == 0)
{
addUpdtateTime(cg);
cg.write(std::string(test_dir) + "/openfpm_pdata/Verletlist_comp.html");
}
}
BOOST_AUTO_TEST_SUITE_END()
......
......@@ -12,20 +12,93 @@
#include <mpi.h>
#include "config.h"
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include "Vector/vector_dist.hpp"
#include "data_type/aggregate.hpp"
#include "Plot/GoogleChart.hpp"
#include "Point_test.hpp"
#include <sstream>
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
extern const char * test_dir;
// XML report
boost::property_tree::ptree pt;
#ifdef PERFORMANCE_TEST
BOOST_AUTO_TEST_SUITE( performance )
static inline void warning_set(int & warning_level, double mean, double mean_ref, double sigma)
{
int warning_level_candidate;
if (mean - mean_ref < -2.0*sigma )
warning_level_candidate = -1;
else if (mean - mean_ref < 2.0*sigma)
warning_level_candidate = 0;
else if (mean - mean_ref < 3.0*sigma)
warning_level_candidate = 1;
else
warning_level_candidate = 2;
if (warning_level_candidate > warning_level)
warning_level = warning_level_candidate;
}
static inline void addchartarea(std::string & chart_area, int lvl)
{
std::string color;
if (lvl == -1)
{
chart_area = std::string(",chartArea: {\
backgroundColor: {\
stroke: '#00FF00',\
strokeWidth: 6\
}\
}");
}
else if (lvl == 0)
{
// NOTHING TO DO
}
else if (lvl == 1)
{
chart_area = std::string(",chartArea: {\
backgroundColor: {\
stroke: '#FFFF00',\
strokeWidth: 6\
}\
}");
}
else if (lvl == 2)
{
chart_area = std::string(",chartArea: {\
backgroundColor: {\
stroke: '#FF0000',\
strokeWidth: 6\
}\
}");
}
}
void addUpdtateTime(GoogleChart & cg)
{
time_t t = time(0); // get time now
struct tm * now = localtime( & t );
std::stringstream str;
str << "<h3>Updated: " << now->tm_mday << "/" << now->tm_mon + 1 << "/" << now->tm_year+1900 << " " << now->tm_hour << ":" << now->tm_min << ":" << now->tm_sec << std::endl;
cg.addHTML(str.str());
}
#include "Vector/performance/vector_dist_performance_util.hpp"
#include "Vector/performance/verlet_performance_tests.hpp"
#include "Vector/performance/cell_list_part_reorder.hpp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment