Commit cfa6f9ba authored by incardon's avatar incardon

Fixing Metis decomposition

parent 106625f9
......@@ -85,6 +85,8 @@ BOOST_AUTO_TEST_CASE( Metis_distribution_test)
met_dist.createCartGraph(info,box);
met_dist.decompose();
BOOST_REQUIRE_EQUAL(met_dist.get_ndec(),1ul);
//! [Initialize a Metis Cartesian graph and decompose]
BOOST_REQUIRE(met_dist.getUnbalance() < 0.03);
......@@ -122,6 +124,8 @@ BOOST_AUTO_TEST_CASE( Metis_distribution_test)
met_dist.decompose();
BOOST_REQUIRE_EQUAL(met_dist.get_ndec(),2ul);
//! [Decomposition Metis with weights]
BOOST_REQUIRE(met_dist.getUnbalance() < 0.06);
......@@ -164,7 +168,7 @@ BOOST_AUTO_TEST_CASE( Metis_distribution_test)
// operator= functions
// operator== functions
BOOST_REQUIRE_EQUAL(sizeof(MetisDistribution<3,float>),712ul);
BOOST_REQUIRE_EQUAL(sizeof(MetisDistribution<3,float>),720ul);
}
BOOST_AUTO_TEST_CASE( Parmetis_distribution_test)
......@@ -197,6 +201,8 @@ BOOST_AUTO_TEST_CASE( Parmetis_distribution_test)
// first decomposition
pmet_dist.decompose();
BOOST_REQUIRE_EQUAL(pmet_dist.get_ndec(),1ul);
//! [Initialize a ParMetis Cartesian graph and decompose]
if (v_cl.getProcessUnitID() == 0)
......@@ -225,6 +231,7 @@ BOOST_AUTO_TEST_CASE( Parmetis_distribution_test)
Point<3, float> shift( { tstep, tstep, tstep });
size_t iter = 1;
size_t n_dec = 1;
for(float t = stime; t < etime; t = t + tstep, iter++)
{
......@@ -239,6 +246,8 @@ BOOST_AUTO_TEST_CASE( Parmetis_distribution_test)
if ((size_t)iter % 10 == 0)
{
pmet_dist.refine();
n_dec++;
BOOST_REQUIRE_EQUAL(pmet_dist.get_ndec(),n_dec);
if (v_cl.getProcessUnitID() == 0)
{
......
......@@ -259,6 +259,10 @@ public:
}
}
}
else
{
metis_graph.inc_dec();
}
recv_ass.resize(gp.getNVertex());
......@@ -652,6 +656,16 @@ public:
size_t ids = fnd->second;
return owner_cost_sub.get(ids).w;
}
/*! \brief Get the decomposition counter
*
* \return the decomposition counter
*
*/
size_t get_ndec()
{
return metis_graph.get_ndec();
}
};
#endif /* SRC_DECOMPOSITION_METISDISTRIBUTION_HPP_ */
......@@ -78,8 +78,8 @@ class Metis
//! Original graph
Graph & g;
//Check if weights are available
// bool useWeights = false;
//! indicate how many time decompose/refine/re-decompose has been called
size_t n_dec;
//! Distribution tolerance
real_t dist_tol = 1.05;
......@@ -189,7 +189,7 @@ public:
*
*/
Metis(Graph & g, size_t nc, bool useWeights)
:g(g)
:g(g),n_dec(0)
{
initMetisGraph(nc,useWeights);
}
......@@ -202,8 +202,8 @@ public:
* \param nc number of partitions
*
*/
Metis(Graph & g, size_t nc) :
g(g)
Metis(Graph & g, size_t nc)
:g(g),n_dec(0)
{
initMetisGraph(nc,false);
}
......@@ -217,7 +217,7 @@ public:
*
*/
Metis(Graph & g)
:g(g)
:g(g),n_dec(0)
{
Mg.nvtxs = NULL;
Mg.ncon = NULL;
......@@ -402,6 +402,8 @@ public:
++it;
}
}
n_dec++;
}
/*! \brief Decompose the graph
......@@ -431,6 +433,8 @@ public:
++id;
++it;
}
n_dec++;
}
/*! \brief It set Metis on test
......@@ -467,6 +471,25 @@ public:
{
dist_tol = tol;
}
/*! \brief Get the decomposition counter
*
* \return the decomposition counter
*
*/
size_t get_ndec()
{
return n_dec;
}
/*! \brief Increment the decomposition counter
*
*
*/
void inc_dec()
{
n_dec++;
}
};
#endif
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