We'll be taking GitLab down for maintenance around 22 in the evening on the 15th of September, so this Sunday. Let us know (tt.mpi-cbg.de) if you experience any issues with it after the maintenance period.

Commit f2d7c8d3 authored by incardon's avatar incardon

Fixing DLB for multiphase

parent cfbe9fff
......@@ -58,7 +58,7 @@ int main(int argc, char* argv[])
size_t bc[2]={PERIODIC,PERIODIC};
Ghost<2,float> g(0.01);
vector_dist<2,float, Particle<float>, CartDecomposition<2,float> > vd(4096,domain,bc,g);
vector_dist<2,float, Particle<float> > vd(4096,domain,bc,g);
auto it = vd.getIterator();
......
......@@ -798,6 +798,9 @@ public:
cart.box_nn_processor = box_nn_processor;
cart.fine_s = fine_s;
cart.gr = gr;
cart.gr_dist = gr_dist;
cart.dist = dist;
cart.commCostSet = commCostSet;
cart.cd = cd;
cart.domain = domain;
for (size_t i = 0 ; i < dim ; i++)
......@@ -830,11 +833,17 @@ public:
box_nn_processor = cart.box_nn_processor;
fine_s = cart.fine_s;
gr = cart.gr;
gr_dist = cart.gr_dist;
dist = cart.dist;
commCostSet = cart.commCostSet;
cd = cart.cd;
domain = cart.domain;
for (size_t i = 0 ; i < dim ; i++)
{spacing[i] = cart.spacing[i];};
{
spacing[i] = cart.spacing[i];
magn[i] = cart.magn[i];
};
ghost = cart.ghost;
......@@ -863,10 +872,16 @@ public:
box_nn_processor.swap(cart.box_nn_processor);
fine_s.swap(cart.fine_s);
gr = cart.gr;
gr_dist = cart.gr_dist;
dist = cart.dist;
commCostSet = cart.commCostSet;
cd = cart.cd;
domain = cart.domain;
for (size_t i = 0 ; i < dim ; i++)
{spacing[i] = cart.spacing[i];};
{
spacing[i] = cart.spacing[i];
magn[i] = cart.magn[i];
};
ghost = cart.ghost;
......@@ -1096,7 +1111,7 @@ public:
reset();
if (commCostSet == false)
computeCommunicationAndMigrationCosts(1);
{computeCommunicationAndMigrationCosts(1);}
dist.decompose();
......@@ -1118,7 +1133,7 @@ public:
reset();
if (commCostSet == false)
computeCommunicationAndMigrationCosts(ts);
{computeCommunicationAndMigrationCosts(ts);}
dist.refine();
......@@ -1140,7 +1155,7 @@ public:
reset();
if (commCostSet == false)
computeCommunicationAndMigrationCosts(ts);
{computeCommunicationAndMigrationCosts(ts);}
dist.redecompose();
......
......@@ -638,6 +638,7 @@ public:
verticesGotWeights = dist.verticesGotWeights;
sub_sub_owner = dist.sub_sub_owner;
m2g = dist.m2g;
parmetis_graph = dist.parmetis_graph;
return *this;
}
......@@ -655,6 +656,7 @@ public:
verticesGotWeights = dist.verticesGotWeights;
sub_sub_owner.swap(dist.sub_sub_owner);
m2g.swap(dist.m2g);
parmetis_graph = dist.parmetis_graph;
return *this;
}
......
......@@ -526,10 +526,11 @@ public:
*/
const Parmetis<Graph> & operator=(const Parmetis<Graph> & pm)
{
comm = pm.comm;
v_cl = pm.v_cl;
MPI_Comm_dup(pm.comm, &comm);
p_id = pm.p_id;
nc = pm.nc;
n_dec = pm.n_dec;
dist_tol = pm.dist_tol;
setDefaultParameters(pm.Mg.wgtflag[0] == 3);
......@@ -545,10 +546,12 @@ public:
*/
const Parmetis<Graph> & operator=(Parmetis<Graph> && pm)
{
comm = pm.comm;
v_cl = pm.v_cl;
// TODO Move into VCluster
MPI_Comm_dup(pm.comm, &comm);
p_id = pm.p_id;
nc = pm.nc;
n_dec = pm.n_dec;
dist_tol = pm.dist_tol;
setDefaultParameters(pm.Mg.wgtflag[0] == 3);
......
......@@ -140,7 +140,7 @@ template<unsigned int dim,
template <typename> class layout_base = memory_traits_lin,
typename Decomposition = CartDecomposition<dim,St>,
typename Memory = HeapMemory>
class vector_dist : public vector_dist_comm<dim,St,prop,Decomposition,Memory>
class vector_dist : public vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory>
{
public:
......@@ -161,7 +161,7 @@ private:
//! Particle properties vector, (It has 2 elements) the first has real particles assigned to a processor
//! the second element contain unassigned particles
openfpm::vector<prop,Memory> v_prp;
openfpm::vector<prop,Memory,layout,layout_base> v_prp;
//! Virtual cluster
Vcluster & v_cl;
......@@ -255,7 +255,7 @@ public:
*/
vector_dist<dim,St,prop,layout,layout_base,Decomposition,Memory> & operator=(const vector_dist<dim,St,prop,layout,layout_base,Decomposition,Memory> & v)
{
static_cast<vector_dist_comm<dim,St,prop,Decomposition,Memory> *>(this)->operator=(static_cast<vector_dist_comm<dim,St,prop,Decomposition,Memory>>(v));
static_cast<vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory> *>(this)->operator=(static_cast<vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory>>(v));
g_m = v.g_m;
v_pos = v.v_pos;
......@@ -279,7 +279,7 @@ public:
*/
vector_dist<dim,St,prop,layout,layout_base,Decomposition,Memory> & operator=(vector_dist<dim,St,prop,layout,layout_base,Decomposition,Memory> && v)
{
static_cast<vector_dist_comm<dim,St,prop,Decomposition,Memory> *>(this)->operator=(static_cast<vector_dist_comm<dim,St,prop,Decomposition,Memory> >(v));
static_cast<vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory> *>(this)->operator=(static_cast<vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory> >(v));
g_m = v.g_m;
v_pos.swap(v.v_pos);
......@@ -301,7 +301,7 @@ public:
*
*/
vector_dist(const vector_dist<dim,St,prop,layout,layout_base,Decomposition,Memory> & v)
:vector_dist_comm<dim,St,prop,Decomposition,Memory>(v.getDecomposition()),v_cl(v.v_cl) SE_CLASS3_VDIST_CONSTRUCTOR
:vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory>(v.getDecomposition()),v_cl(v.v_cl) SE_CLASS3_VDIST_CONSTRUCTOR
{
#ifdef SE_CLASS2
check_new(this,8,VECTOR_DIST_EVENT,4);
......@@ -336,7 +336,7 @@ public:
*
*/
vector_dist(const Decomposition & dec, size_t np) :
vector_dist_comm<dim,St,prop,Decomposition,Memory>(dec), v_cl(create_vcluster()) SE_CLASS3_VDIST_CONSTRUCTOR
vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory>(dec), v_cl(create_vcluster()) SE_CLASS3_VDIST_CONSTRUCTOR
{
#ifdef SE_CLASS2
check_new(this,8,VECTOR_DIST_EVENT,4);
......@@ -1620,7 +1620,7 @@ public:
*/
inline Decomposition & getDecomposition()
{
return vector_dist_comm<dim,St,prop,Decomposition,Memory>::getDecomposition();
return vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory>::getDecomposition();
}
/*! \brief Get the decomposition
......@@ -1630,7 +1630,7 @@ public:
*/
inline const Decomposition & getDecomposition() const
{
return vector_dist_comm<dim,St,prop,Decomposition,Memory>::getDecomposition();
return vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory>::getDecomposition();
}
/*! \brief It move all the particles that does not belong to the local processor to the respective processor
......
......@@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_hdf5_save_test )
// ghost
Ghost<dim,float> ghost(1.0/(Ng-2));
vector_dist<dim,float, aggregate<float[dim]>, CartDecomposition<dim,float> > vd(0,box,bc,ghost);
vector_dist<dim,float, aggregate<float[dim]> > vd(0,box,bc,ghost);
// Put particles
......@@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_hdf5_save_test )
// Save the vector
vd.save("vector_dist.h5");
vector_dist<dim,float, aggregate<float[dim]>, CartDecomposition<dim,float> > vd2(0,box,bc,ghost);
vector_dist<dim,float, aggregate<float[dim]> > vd2(0,box,bc,ghost);
vd2.load("vector_dist.h5");
......@@ -143,7 +143,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_hdf5_load_test )
// ghost
Ghost<dim,float> ghost(1.0/(Ng-2));
vector_dist<dim,float, aggregate<float[dim]>, CartDecomposition<dim,float> > vd(0,box,bc,ghost);
vector_dist<dim,float, aggregate<float[dim]> > vd(0,box,bc,ghost);
// Load the vector
vd.load("test_data/vector_dist_24.h5");
......
......@@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_reorder_2d_test )
// Boundary conditions
size_t bc[2]={NON_PERIODIC,NON_PERIODIC};
vector_dist<2,float, Point_test<float>, CartDecomposition<2,float> > vd(k,box,bc,Ghost<2,float>(0.01));
vector_dist<2,float, Point_test<float> > vd(k,box,bc,Ghost<2,float>(0.01));
auto it = vd.getIterator();
......@@ -143,9 +143,9 @@ BOOST_AUTO_TEST_CASE( vector_dist_cl_random_vs_hilb_forces_test )
for (size_t i = 0; i < dim; i++)
bc[i] = PERIODIC;
vector_dist<dim,float, aggregate<float[dim]>, CartDecomposition<dim,float> > vd(k_int,box,bc,Ghost<dim,float>(ghost_part));
vector_dist<dim,float, aggregate<float[dim]> > vd(k_int,box,bc,Ghost<dim,float>(ghost_part));
vector_dist<dim,float, aggregate<float[dim]>, CartDecomposition<dim,float> > vd2(k_int,box,bc,Ghost<dim,float>(ghost_part));
vector_dist<dim,float, aggregate<float[dim]> > vd2(k_int,box,bc,Ghost<dim,float>(ghost_part));
// Initialize dist vectors
vd_initialize_double<dim>(vd, vd2, v_cl, k_int);
......@@ -180,7 +180,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_cl_random_vs_hilb_forces_test )
vect_dist_key_dx key = it_v2.get();
for (size_t i = 0; i < dim; i++)
avg.get(i) += fabs(vd.getProp<0>(key)[i]);
{avg.get(i) += fabs(vd.getProp<0>(key)[i]);}
++count;
++it_v2;
......@@ -267,7 +267,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_cl_random_vs_reorder_forces_test )
for (size_t i = 0; i < dim; i++)
bc[i] = PERIODIC;
vector_dist<dim,float, aggregate<float[dim], float[dim]>, CartDecomposition<dim,float> > vd(k_int,box,bc,Ghost<dim,float>(ghost_part));
vector_dist<dim,float, aggregate<float[dim], float[dim]> > vd(k_int,box,bc,Ghost<dim,float>(ghost_part));
// Initialize vd
vd_initialize<dim,decltype(vd)>(vd, v_cl, k_int);
......
......@@ -42,7 +42,13 @@ inline static size_t compute_options(size_t opt)
*
*/
template<unsigned int dim, typename St, typename prop, typename Decomposition = CartDecomposition<dim,St>, typename Memory = HeapMemory>
template<unsigned int dim,
typename St,
typename prop,
typename layout,
template <typename> class layout_base,
typename Decomposition = CartDecomposition<dim,St>,
typename Memory = HeapMemory>
class vector_dist_comm
{
//! Number of units for each sub-domain
......@@ -784,7 +790,7 @@ class vector_dist_comm
static void * message_alloc_map(size_t msg_i, size_t total_msg, size_t total_p, size_t i, size_t ri, void * ptr)
{
// cast the pointer
vector_dist_comm<dim, St, prop, Decomposition, Memory> * vd = static_cast<vector_dist_comm<dim, St, prop, Decomposition, Memory> *>(ptr);
vector_dist_comm<dim, St, prop,layout,layout_base, Decomposition, Memory> * vd = static_cast<vector_dist_comm<dim, St, prop, layout, layout_base, Decomposition, Memory> *>(ptr);
vd->recv_mem_gm.resize(vd->v_cl.getProcessingUnits());
vd->recv_mem_gm.get(i).resize(msg_i);
......@@ -799,7 +805,7 @@ public:
* \param v vector to copy
*
*/
vector_dist_comm(const vector_dist_comm<dim,St,prop,Decomposition,Memory> & v)
vector_dist_comm(const vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory> & v)
:v_cl(create_vcluster()),dec(create_vcluster()),lg_m(0)
{
this->operator=(v);
......@@ -1166,7 +1172,7 @@ public:
* \return iteself
*
*/
vector_dist_comm<dim,St,prop,Decomposition,Memory> & operator=(const vector_dist_comm<dim,St,prop,Decomposition,Memory> & vc)
vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory> & operator=(const vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory> & vc)
{
dec = vc.dec;
......@@ -1180,7 +1186,7 @@ public:
* \return itself
*
*/
vector_dist_comm<dim,St,prop,Decomposition,Memory> & operator=(vector_dist_comm<dim,St,prop,Decomposition,Memory> && vc)
vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory> & operator=(vector_dist_comm<dim,St,prop,layout,layout_base,Decomposition,Memory> && vc)
{
dec = vc.dec;
......
......@@ -332,7 +332,12 @@ BOOST_AUTO_TEST_CASE( vector_dist_dlb_multi_phase_test_part )
BOOST_AUTO_TEST_CASE( vector_dist_dlb_metis_test_part )
{
test_dlb_vector<vector_dist<3,float,aggregate<float>,CartDecomposition<3,float,HeapMemory,MetisDistribution<3,float>>>>();
test_dlb_vector<vector_dist<3,
float,
aggregate<float>,
memory_traits_lin<aggregate<float>>::type,
memory_traits_lin,
CartDecomposition<3,float,HeapMemory,MetisDistribution<3,float>>>>();
}
BOOST_AUTO_TEST_SUITE_END()
......
......@@ -21,7 +21,7 @@
* \param bc boundary conditions
*
*/
template<unsigned int dim> size_t total_n_part_lc(vector_dist<dim,float, Point_test<float>, CartDecomposition<dim,float> > & vd, size_t (& bc)[dim])
template<unsigned int dim, template <typename> class layout> size_t total_n_part_lc(vector_dist<dim,float, Point_test<float>,typename layout<Point_test<float>>::type, layout, CartDecomposition<dim,float> > & vd, size_t (& bc)[dim])
{
Vcluster & v_cl = vd.getVC();
auto it2 = vd.getDomainIterator();
......@@ -775,7 +775,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_periodic_test_random_walk )
Ghost<3,float> ghost(0.01 / factor);
// Distributed vector
vector_dist<3,float, Point_test<float>, CartDecomposition<3,float> > vd(k,box,bc,ghost);
vector_dist<3,float, Point_test<float> > vd(k,box,bc,ghost);
auto it = vd.getIterator();
......@@ -835,7 +835,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_periodic_map )
Ghost<3,float> ghost(0.05 / factor);
// Distributed vector
vector_dist<3,float, Point_test<float>, CartDecomposition<3,float> > vd(1,box,bc,ghost);
vector_dist<3,float, Point_test<float> > vd(1,box,bc,ghost);
// put particles al 1.0, check that they go to 0.0
......@@ -886,7 +886,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_not_periodic_map )
Ghost<3,float> ghost(0.05 / factor);
// Distributed vector
vector_dist<3,float, Point_test<float>, CartDecomposition<3,float> > vd(1,box,bc,ghost);
vector_dist<3,float, Point_test<float> > vd(1,box,bc,ghost);
// put particles al 1.0, check that they go to 0.0
......@@ -941,7 +941,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_out_of_bound_policy )
Ghost<3,float> ghost(0.05 / factor);
// Distributed vector
vector_dist<3,float, Point_test<float>, CartDecomposition<3,float> > vd(100,box,bc,ghost);
vector_dist<3,float, Point_test<float> > vd(100,box,bc,ghost);
// put particles at out of the boundary, they must be detected and and killed
......@@ -1025,7 +1025,7 @@ void Test_interacting(Box<3,float> & box)
Ghost<3,float> ghost(r_cut);
// Distributed vector
vector_dist<3,float, Point_test<float>, CartDecomposition<3,float> > vd(k,box,bc,ghost);
vector_dist<3,float, Point_test<float> > vd(k,box,bc,ghost);
auto it = vd.getIterator();
......@@ -1165,7 +1165,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_grid_iterator )
Ghost<3,float> ghost(1.0/(Ng-2));
// Distributed vector
vector_dist<3,float, Point_test<float>, CartDecomposition<3,float> > vd(0,box,bc,ghost);
vector_dist<3,float, Point_test<float> > vd(0,box,bc,ghost);
// Put particles on a grid creating a Grid iterator
auto it = vd.getGridIterator(sz);
......@@ -1239,7 +1239,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_cell_verlet_test )
Ghost<3,float> ghost(third_dist*1.1);
// Distributed vector
vector_dist<3,float, Point_test<float>, CartDecomposition<3,float> > vd(0,box,bc,ghost);
vector_dist<3,float, Point_test<float> > vd(0,box,bc,ghost);
// Put particles on a grid creating a Grid iterator
auto it = vd.getGridIterator(sz);
......
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