Commit e8b6da31 authored by incardon's avatar incardon

Fixing test

parent 6c3c41c0
......@@ -1924,13 +1924,17 @@ public:
e.swap(g.e);
e_m.swap(g.e_m);
v_l.swap(g.v_l);
glb2id = g.glb2id;
id2glb = g.id2glb;
glb2loc = g.glb2loc;
glb2id.swap(g.glb2id);
id2glb.swap(g.id2glb);
glb2loc.swap(g.glb2loc);
e_l.swap(g.e_l);
e_invalid.swap(g.e_invalid);
vtxdist = g.vtxdist;
fvtxdist = g.fvtxdist;
vtxdist.swap(g.vtxdist);
fvtxdist.swap(g.fvtxdist);
size_t v_slot_tmp = v_slot;
v_slot = g.v_slot;
g.v_slot = v_slot_tmp;
}
/*! \brief Swap the memory of g with this graph
......@@ -1948,13 +1952,17 @@ public:
e.swap(g.e);
e_m.swap(g.e_m);
v_l.swap(g.v_l);
glb2id = g.glb2id;
id2glb = g.id2glb;
glb2loc = g.glb2loc;
glb2id.swap(g.glb2id);
id2glb.swap(g.id2glb);
glb2loc.swap(g.glb2loc);
e_l.swap(g.e_l);
e_invalid.swap(g.e_invalid);
vtxdist = g.vtxdist;
fvtxdist = g.fvtxdist;
vtxdist.swap(g.vtxdist);
fvtxdist.swap(g.fvtxdist);
size_t v_slot_tmp = v_slot;
v_slot = g.v_slot;
g.v_slot = v_slot_tmp;
}
/*! \brief Get the vertex iterator
......
......@@ -248,194 +248,6 @@ template<unsigned int dim> void vd_verlet_performance_write_report(GoogleChart &
openfpm::vector<openfpm::vector<double>> time_create_mean,
openfpm::vector<openfpm::vector<double>> time_create_dev)
{
/* // Get the test dir
std::string file_mean(test_dir);
std::string file_var(test_dir);
file_mean += std::string("/openfpm_pdata/verlet_comp_create_mean_" + std::to_string(dim) + std::string("_ref"));
file_var += std::string();
openfpm::vector<openfpm::vector<openfpm::vector<double>>> y_ref_create_mean;
openfpm::vector<openfpm::vector<openfpm::vector<double>>> y_ref_create_dev;
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);
file_mean2 += std::string("/openfpm_pdata/verlet_comp_force_mean_" + std::to_string(dim) + std::string("_ref"));
file_var2 += std::string("/openfpm_pdata/verlet_comp_force_dev_" + std::to_string(dim) + std::string("_ref"));
openfpm::vector<openfpm::vector<openfpm::vector<double>>> y_ref_force_mean;
openfpm::vector<openfpm::vector<openfpm::vector<double>>> y_ref_force_dev;
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;
openfpm::vector<openfpm::vector<openfpm::vector<double>>> y_dev;
openfpm::vector<std::string> yn;
yn.add("Force verlet");
for (size_t i = 0; i < n_particles.size() ; i++)
x.add(n_particles.get(i));
y.resize(time_force_mean.size());
y_dev.resize(time_force_mean.size());
for (size_t r = 0; r < time_force_mean.size(); r++)
{
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++)
{
// Put the speedup
y.get(r).get(k).add(time_force_mean.get(r).get(k));
y_dev.get(r).get(k).add(time_force_dev.get(r).get(k));
}
}
y.save("verlet_comp_force_mean_" + std::to_string(dim) + std::to_string("_ref"));
y_dev.save("verlet_comp_force_dev_" + std::to_string(dim) + std::to_string("_ref"));
if (y_ref_force_mean.size() != 0)
{
yn.clear();
yn.add("Force verlet");
yn.add("interval");
yn.add("interval");
y.clear();
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++)
{
// Put the speedup
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);
}
}
// Calculation time graphs data
openfpm::vector<openfpm::vector<openfpm::vector<double>>> y2;
openfpm::vector<openfpm::vector<openfpm::vector<double>>> y2_dev;
openfpm::vector<std::string> yn2;
yn2.add("Create a Verlet");
y2.resize(time_create_mean.size());
y2_dev.resize(time_create_mean.size());
for (size_t r = 0; r < time_create_mean.size(); r++)
{
y2.get(r).resize(time_create_mean.get(r).size());
y2_dev.get(r).resize(time_create_mean.get(r).size());
for (size_t k = 0; k < time_create_mean.get(r).size(); k++)
{
// Put a random case total time
y2.get(r).get(k).add(time_create_mean.get(r).get(k));
y2_dev.get(r).get(k).add(time_create_dev.get(r).get(k));
}
}
y2.save("verlet_comp_create_mean_" + std::to_string(dim) + std::to_string("_ref"));
y2_dev.save("verlet_comp_create_dev_" + std::to_string(dim) + std::to_string("_ref"));
if (y_ref_create_mean.size() != 0)
{
yn2.clear();
yn2.add("Create a Verlet");
yn2.add("interval");
yn2.add("interval");
y2.clear();
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++)
{
// Put a random case total time
y2.get(r).get(k).add(time_create_mean.get(r).get(k));
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);
}
}
// Speedup graphs report
// Google charts options
GCoptions options;
options.yAxis = std::string("Time (s)");
options.xAxis = std::string("Number of particles");
options.lineWidth = 2;
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);
}
// Calculation time graphs report
// Google charts options
GCoptions options2;
options2.yAxis = std::string("Time to construct a verlet-list (s)");
options2.xAxis = std::string("Number of particles");
options2.lineWidth = 2;
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("Verlet-list performance, cut-off radius: " + std::to_string(r_cutoff.get(i)));
cg.AddLinesGraph(x,y2.get(i),yn2,options2);
}*/
{
std::string file_mean(test_dir);
std::string file_var(test_dir);
......
......@@ -982,7 +982,9 @@ public:
* \tparam op which kind of operation to apply
* \tparam prp list of properties to get synchronize
*
* \param opt options NO_CHANGE_ELEMENTS
* \param opt_ options. It is an optional parameter.
* If set to NO_CHANGE_ELEMENTS the communication has lower latencies. This option has some usage limitations, so please refere to the examples
* for further explanations
*
*
*/
......@@ -1237,6 +1239,8 @@ public:
*
* \param NN Cell-List neighborhood
*
* \return Particle iterator
*
*/
template<typename cli> ParticleItCRS_Cells<dim,cli> getParticleIteratorCRS(cli & NN)
{
......
......@@ -558,10 +558,13 @@ class vector_dist_comm
/*! \brief allocate and fill the send buffer for the map function
*
* \tparam prp_object object type to send
* \tparam prp properties to send
*
* \param v_pos vector of particle positions
* \param v_prp vector of particle properties
* \param prc_r List of processor rank involved in the send
* \param prc_sz_r number of particles to send for each processor
* \param m_pos sending buffer for position
* \param m_prp sending buffer for properties
*
......@@ -601,7 +604,6 @@ class vector_dist_comm
* \param v_pos vector of particle positions
* \param lbl_p Particle labeled
* \param prc_sz For each processor the number of particles to send
* \param opart id of the particles to send
*
*/
template<typename obp> void labelParticleProcessor(openfpm::vector<Point<dim, St>> & v_pos, openfpm::vector<aggregate<size_t,size_t,size_t>> & lbl_p, openfpm::vector<size_t> & prc_sz)
......@@ -662,6 +664,7 @@ class vector_dist_comm
*
* \param v_pos vector of particle positions
* \param v_prp vector of particle properties
* \param prc for each particle it label the processor id (the owner of the particle, or where it should go the particle)
* \param g_m ghost marker
*
*/
......@@ -768,7 +771,7 @@ public:
*
*/
vector_dist_comm(Decomposition && dec)
:v_cl(create_vcluster()),dec(dec)
:v_cl(create_vcluster()),dec(dec),lg_m(0)
{
}
......
......@@ -11,19 +11,21 @@
#include "vector_dist_key.hpp"
#include "VCluster/VCluster.hpp"
//! Iterator that Iterate across particle indexes
class vector_dist_iterator
{
//! Actual iterator
size_t v_it;
//! end point
size_t stop;
public:
/*! \brief Constructor of the distributed grid
*
* \param gk the set of local vectors
* \param offset iterator starting point
* \param start start point
* \param stop end point
*
*/
vector_dist_iterator(size_t start, size_t stop)
......
......@@ -26,7 +26,7 @@ public:
/*! \brief set the key
*
* \return the local key
* \param key the local key
*
*/
inline void setKey(size_t key)
......@@ -44,7 +44,9 @@ public:
return key;
}
/*! \brief Convert the key into a message
/*! \brief Convert the key into a string message
*
* \return a string message
*
*/
std::string to_string()
......@@ -56,11 +58,13 @@ public:
return ts.str();
}
//! constructor from a key
inline vect_dist_key_dx(size_t key)
:key(key)
{
}
//! Default constructor
inline vect_dist_key_dx()
{
}
......
......@@ -20,6 +20,8 @@ struct KillParticle
* \param pp_id particle id
* \param p_id processor id
*
* \return -1
*
*/
static size_t out(size_t pp_id, size_t p_id)
{
......@@ -27,6 +29,7 @@ struct KillParticle
}
};
//! Out-of-bound policy kill the particle but print a warning
struct KillParticleWithWarning
{
/*! \brief It decide what to do when the particle is out
......@@ -34,8 +37,10 @@ struct KillParticleWithWarning
* \param pp_id particle id
* \param p_id processor id
*
* \return -1
*
*/
static size_t out(size_t p_id)
static size_t out(size_t pp_id, size_t p_id)
{
std::cerr << "Warning: " << __FILE__ << ":" << __LINE__ << " out of bound particle detected ";
......@@ -43,6 +48,7 @@ struct KillParticleWithWarning
}
};
//! Out-of-bound policy do nothing
struct Nothing
{
/*! \brief It decide what to do when the particle is out
......@@ -50,13 +56,16 @@ struct Nothing
* \param pp_id particle id
* \param p_id processor id
*
* \return -1
*
*/
static size_t out(size_t p_id)
static size_t out(size_t pp_id, size_t p_id)
{
return p_id;
return -1;
}
};
//! Out-of-bound policy kill the program
struct Error
{
/*! \brief It decide what to do when the particle is out
......@@ -64,8 +73,10 @@ struct Error
* \param pp_id particle id
* \param p_id processor id
*
* \return -1
*
*/
static size_t out(size_t p_id)
static size_t out(size_t pp_id, size_t p_id)
{
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " out of bound particle detected ";
......
......@@ -138,7 +138,7 @@ BOOST_AUTO_TEST_CASE( dec_optimizer_disconnected_subdomains_np)
Vcluster & vcl = create_vcluster();
// Test for only 3 processors
if (vcl.getProcessingUnits() > 3)
if (vcl.getProcessingUnits() != 3)
return;
CartesianGraphFactory<2,Graph_CSR<nm_v,nm_e>> g_factory;
......
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