Commit 30140d91 authored by Pietro Incardona's avatar Pietro Incardona

Test Suite working with Parmetis

parent 5e916b35
This diff is collapsed.
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
//! Create sub graph //! Create sub graph
DistGraphFactory<dim, DistGraph_CSR<nm_v, nm_e>> dist_g_factory; DistGraphFactory<dim, DistGraph_CSR<nm_v, nm_e>> dist_g_factory;
g = dist_g_factory.template construct<NO_EDGE, T, dim - 1, 0, 1, 2>(gr.getSize(), domain); g = dist_g_factory.template construct<NO_EDGE, T, dim - 1, 0>(gr.getSize(), domain);
g.getDecompositionVector(vtxdist); g.getDecompositionVector(vtxdist);
if (dim == 2) if (dim == 2)
...@@ -125,7 +125,7 @@ public: ...@@ -125,7 +125,7 @@ public:
for (size_t i = 0, j = g.firstId(); i < g.getNVertex() && j <= g.lastId(); i++, j++) for (size_t i = 0, j = g.firstId(); i < g.getNVertex() && j <= g.lastId(); i++, j++)
{ {
if (partition[i] != v_cl.getProcessUnitID()) if ((size_t)partition[i] != v_cl.getProcessUnitID())
g.q_move(g.nodeById(j), partition[i]); g.q_move(g.nodeById(j), partition[i]);
} }
g.redistribute(); g.redistribute();
...@@ -150,7 +150,7 @@ public: ...@@ -150,7 +150,7 @@ public:
for (size_t i = 0, j = g.firstId(); i < g.getNVertex() && j <= g.lastId(); i++, j++) for (size_t i = 0, j = g.firstId(); i < g.getNVertex() && j <= g.lastId(); i++, j++)
{ {
if (partition[i] != v_cl.getProcessUnitID()) if ((size_t)partition[i] != v_cl.getProcessUnitID())
g.q_move(g.nodeById(j), partition[i]); g.q_move(g.nodeById(j), partition[i]);
} }
g.redistribute(); g.redistribute();
......
...@@ -154,7 +154,7 @@ public: ...@@ -154,7 +154,7 @@ public:
// Create a cartesian grid graph // Create a cartesian grid graph
CartesianGraphFactory<dim, Graph_CSR<nm_v, nm_e>> g_factory_part; CartesianGraphFactory<dim, Graph_CSR<nm_v, nm_e>> g_factory_part;
gp = g_factory_part.template construct<NO_EDGE, nm_v::id, T, dim - 1, 0, 1, 2>(gr.getSize(), domain, bc); gp = g_factory_part.template construct<NO_EDGE, nm_v::id, T, dim - 1, 0>(gr.getSize(), domain, bc);
// Init to 0.0 axis z (to fix in graphFactory) // Init to 0.0 axis z (to fix in graphFactory)
if (dim < 3) if (dim < 3)
......
...@@ -264,7 +264,7 @@ public: ...@@ -264,7 +264,7 @@ public:
// Create a cartesian grid graph // Create a cartesian grid graph
CartesianGraphFactory<dim, Graph_CSR<nm_v, nm_e>> g_factory_part; CartesianGraphFactory<dim, Graph_CSR<nm_v, nm_e>> g_factory_part;
gp = g_factory_part.template construct<NO_EDGE, nm_v::id, T, dim - 1, 0, 1, 2>(gr.getSize(), domain, bc); gp = g_factory_part.template construct<NO_EDGE, nm_v::id, T, dim - 1, 0>(gr.getSize(), domain, bc);
initLocalToGlobalMap(); initLocalToGlobalMap();
//! Get the number of processing units //! Get the number of processing units
......
...@@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE( Metis_test_use) ...@@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE( Metis_test_use)
size_t bc[] = {NON_PERIODIC,NON_PERIODIC,NON_PERIODIC}; size_t bc[] = {NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
// Graph to decompose // Graph to decompose
Graph_CSR<nm_v,nm_e> g = g_factory.construct<nm_e::communication,NO_VERTEX_ID,float,2,0,1,2>(sz,box,bc); Graph_CSR<nm_v,nm_e> g = g_factory.construct<nm_e::communication,NO_VERTEX_ID,float,2,0>(sz,box,bc);
// Processor graph // Processor graph
Graph_CSR<nm_part_v,nm_part_e> gp = g_factory_part.construct<NO_EDGE,NO_VERTEX_ID,float,2>(sz,box,bc); Graph_CSR<nm_part_v,nm_part_e> gp = g_factory_part.construct<NO_EDGE,NO_VERTEX_ID,float,2>(sz,box,bc);
......
...@@ -125,7 +125,7 @@ class DistParmetis ...@@ -125,7 +125,7 @@ class DistParmetis
// init basic graph informations and part vector // init basic graph informations and part vector
Mg.nvtxs[0] = sub_g.getNVertex(); Mg.nvtxs[0] = sub_g.getNVertex();
Mg.part = new idx_t[sub_g.getNVertex()]; Mg.part = new idx_t[sub_g.getNVertex()];
for (int i = 0; i < sub_g.getNVertex(); i++) for (size_t i = 0; i < sub_g.getNVertex(); i++)
Mg.part[i] = p_id; Mg.part[i] = p_id;
// create xadj, adjlist, vwgt, adjwgt and vsize // create xadj, adjlist, vwgt, adjwgt and vsize
......
...@@ -6287,7 +6287,7 @@ LOOKUP_TABLE default ...@@ -6287,7 +6287,7 @@ LOOKUP_TABLE default
509 509
510 510
511 511
SCALARS sub_id unsigned_long SCALARS sub_id long
LOOKUP_TABLE default LOOKUP_TABLE default
0 0
0 0
......
...@@ -6287,7 +6287,7 @@ LOOKUP_TABLE default ...@@ -6287,7 +6287,7 @@ LOOKUP_TABLE default
509 509
510 510
511 511
SCALARS sub_id unsigned_long SCALARS sub_id long
LOOKUP_TABLE default LOOKUP_TABLE default
0 0
0 0
......
...@@ -6287,7 +6287,7 @@ LOOKUP_TABLE default ...@@ -6287,7 +6287,7 @@ LOOKUP_TABLE default
0 0
0 0
0 0
SCALARS sub_id unsigned_long SCALARS sub_id long
LOOKUP_TABLE default LOOKUP_TABLE default
0 0
0 0
......
...@@ -204,8 +204,14 @@ public: ...@@ -204,8 +204,14 @@ public:
void operator()(T& t) const void operator()(T& t) const
{ {
typedef typename boost::fusion::result_of::at<v, boost::mpl::int_<0>>::type t_val; typedef typename boost::fusion::result_of::at<v, boost::mpl::int_<0>>::type t_val;
typedef typename boost::mpl::at<typename G_v::T_type::type,t_val>::type s_type;
for (size_t i = 0 ; i < std::extent<s_type>::value ; i++)
g_v.template get<t_val::value>()[i] = 0.0;
for (size_t i = 0 ; i < dim ; i++)
g_v.template get<t_val::value>()[i] = gk.get(i) * static_cast<float>(szd[i]);
g_v.template get<t_val::value>()[T::value] = gk.get(T::value) * static_cast<float>(szd[T::value]);
fill_id<dim, G_v, lin_id>::fill(g_v, gk, gs); fill_id<dim, G_v, lin_id>::fill(g_v, gk, gs);
} }
}; };
......
This diff is collapsed.
This diff is collapsed.
...@@ -167,8 +167,8 @@ class fill_prop_v<dim, dT, G_v, v, 2> ...@@ -167,8 +167,8 @@ class fill_prop_v<dim, dT, G_v, v, 2>
public: public:
//! Fill the object from where to take the properties //! Fill the object from where to take the properties
fill_prop_v(G_v & g_v, const dT (&szd)[dim], grid_key_dx<dim> & gk, const grid_sm<dim, void> & gs) : fill_prop_v(G_v & g_v, const dT (&szd)[dim], grid_key_dx<dim> & gk, const grid_sm<dim, void> & gs)
szd(szd), gk(gk), g_v(g_v), gs(gs) :szd(szd), gk(gk), g_v(g_v), gs(gs)
{ {
} }
...@@ -177,8 +177,13 @@ public: ...@@ -177,8 +177,13 @@ public:
void operator()(T& t) const void operator()(T& t) const
{ {
typedef typename boost::fusion::result_of::at<v, boost::mpl::int_<0>>::type t_val; typedef typename boost::fusion::result_of::at<v, boost::mpl::int_<0>>::type t_val;
typedef typename boost::mpl::at<typename G_v::T_type::type,t_val>::type s_type;
g_v.template get<t_val::value>()[T::value] = gk.get(T::value) * szd[T::value]; for (size_t i = 0 ; i < std::extent<s_type>::value ; i++)
g_v.template get<t_val::value>()[i] = 0.0;
for (size_t i = 0 ; i < dim ; i++)
g_v.template get<t_val::value>()[i] = gk.get(i) * static_cast<float>(szd[i]);
} }
}; };
...@@ -423,7 +428,7 @@ public: ...@@ -423,7 +428,7 @@ public:
//! Distribution vector //! Distribution vector
openfpm::vector<idx_t> vtxdist(v_cl.getProcessingUnits() + 1); openfpm::vector<idx_t> vtxdist(v_cl.getProcessingUnits() + 1);
for (int i = 0; i <= Np; i++) for (size_t i = 0; i <= Np; i++)
{ {
if (i < mod_v) if (i < mod_v)
vtxdist.get(i) = (div_v + 1) * (i); vtxdist.get(i) = (div_v + 1) * (i);
...@@ -458,7 +463,7 @@ public: ...@@ -458,7 +463,7 @@ public:
{ {
size_t v_id = g.LinId(k_it.get()); size_t v_id = g.LinId(k_it.get());
if (v_id < vtxdist.get(p_id + 1) && v_id >= vtxdist.get(p_id)) if (v_id < (size_t)vtxdist.get(p_id + 1) && v_id >= (size_t)vtxdist.get(p_id))
{ {
grid_key_dx<dim> key = k_it.get(); grid_key_dx<dim> key = k_it.get();
......
...@@ -593,11 +593,11 @@ class DistGraph_CSR ...@@ -593,11 +593,11 @@ class DistGraph_CSR
} }
// Calculate how much preallocated memory we need to pack all the objects for each vector // Calculate how much preallocated memory we need to pack all the objects for each vector
size_t req = ExtPreAlloc<HeapMemory>::calculateMem(pap_prp); ExtPreAlloc<HeapMemory>::calculateMem(pap_prp);
// allocate the memory // allocate the memory
HeapMemory & pmem = *(new HeapMemory()); HeapMemory & pmem = *(new HeapMemory());
pmem.allocate(req); // pmem.allocate(req);
ExtPreAlloc<HeapMemory> & mem = *(new ExtPreAlloc<HeapMemory>(pap_prp, pmem)); ExtPreAlloc<HeapMemory> & mem = *(new ExtPreAlloc<HeapMemory>(pap_prp, pmem));
mem.incRef(); mem.incRef();
...@@ -929,7 +929,7 @@ class DistGraph_CSR ...@@ -929,7 +929,7 @@ class DistGraph_CSR
{ {
for (size_t i = 0; i < fvtxdist.size() - 1; ++i) for (size_t i = 0; i < fvtxdist.size() - 1; ++i)
{ {
if (vid >= fvtxdist.get(i) && vid < fvtxdist.get(i + 1)) if (vid >= (size_t)fvtxdist.get(i) && vid < (size_t)fvtxdist.get(i + 1))
{ {
return i; return i;
} }
...@@ -1270,13 +1270,18 @@ public: ...@@ -1270,13 +1270,18 @@ public:
*/ */
auto getVertex(size_t id) -> decltype( v.get(id) ) auto getVertex(size_t id) -> decltype( v.get(id) )
{ {
try
{ #ifdef SE_CLASS1
return v.get(glb2loc.at(id));
} catch (const std::out_of_range& oor) if (glb2loc.find(id) == glb2loc.end())
{ {
std::cerr << "The vertex with global id " << id << " is not in this sub-graph. Try to call reqVertex(" << id << ") and sync() first.\n"; std::cerr << __FILE__ << ":" << __LINE__ << " The vertex with global id " << id << " is not in this sub-graph. Try to call reqVertex(" << id << ") and sync() first.\n";
ACTION_ON_ERROR(DIST_GRAPH_ERROR);
} }
#endif
return v.get(glb2loc.find(id)->second);
} }
/*! \brief Function to access the vertexes /*! \brief Function to access the vertexes
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "Packer_Unpacker/Packer.hpp" #include "Packer_Unpacker/Packer.hpp"
#include "Packer_Unpacker/Unpacker.hpp" #include "Packer_Unpacker/Unpacker.hpp"
#define GS_SIZE 4 #define DGRAPH_GS_SIZE 4
struct vx struct vx
{ {
...@@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE( dist_map_graph_use) ...@@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE( dist_map_graph_use)
return; return;
//! Cartesian grid //! Cartesian grid
size_t sz[2] = { GS_SIZE, GS_SIZE }; size_t sz[2] = { DGRAPH_GS_SIZE, DGRAPH_GS_SIZE };
//! Box //! Box
Box<2, float> box( { 0.0, 0.0 }, { 1.0, 1.0 }); Box<2, float> box( { 0.0, 0.0 }, { 1.0, 1.0 });
...@@ -192,52 +192,52 @@ BOOST_AUTO_TEST_CASE( dist_map_graph_use) ...@@ -192,52 +192,52 @@ BOOST_AUTO_TEST_CASE( dist_map_graph_use)
if(vcl.getProcessUnitID() == 0) if(vcl.getProcessUnitID() == 0)
{ {
BOOST_REQUIRE_EQUAL(gd.getVertexId(0), 0); BOOST_REQUIRE_EQUAL(gd.getVertexId(0), 0ul);
BOOST_REQUIRE_EQUAL(gd.getVertexId(1), 1); BOOST_REQUIRE_EQUAL(gd.getVertexId(1), 1ul);
BOOST_REQUIRE_EQUAL(gd.getVertexId(2), 2); BOOST_REQUIRE_EQUAL(gd.getVertexId(2), 2ul);
BOOST_REQUIRE_EQUAL(gd.getVertexId(3), 3); BOOST_REQUIRE_EQUAL(gd.getVertexId(3), 3ul);
BOOST_REQUIRE_EQUAL(gd.getNChilds(0), 3); BOOST_REQUIRE_EQUAL(gd.getNChilds(0), 3ul);
BOOST_REQUIRE_EQUAL(gd.getChild(0,0), 1); BOOST_REQUIRE_EQUAL(gd.getChild(0,0), 1ul);
BOOST_REQUIRE_EQUAL(gd.getChild(0,1), 14); BOOST_REQUIRE_EQUAL(gd.getChild(0,1), 14ul);
BOOST_REQUIRE_EQUAL(gd.getChild(0,2), 4); BOOST_REQUIRE_EQUAL(gd.getChild(0,2), 4ul);
BOOST_REQUIRE_EQUAL(gd.getNChilds(1), 4); BOOST_REQUIRE_EQUAL(gd.getNChilds(1), 4ul);
BOOST_REQUIRE_EQUAL(gd.getChild(1,0), 2); BOOST_REQUIRE_EQUAL(gd.getChild(1,0), 2ul);
BOOST_REQUIRE_EQUAL(gd.getChild(1,1), 0); BOOST_REQUIRE_EQUAL(gd.getChild(1,1), 0ul);
BOOST_REQUIRE_EQUAL(gd.getChild(1,2), 15); BOOST_REQUIRE_EQUAL(gd.getChild(1,2), 15ul);
BOOST_REQUIRE_EQUAL(gd.getChild(1,3), 5); BOOST_REQUIRE_EQUAL(gd.getChild(1,3), 5ul);
BOOST_REQUIRE_EQUAL(gd.getNChilds(2), 4); BOOST_REQUIRE_EQUAL(gd.getNChilds(2), 4ul);
BOOST_REQUIRE_EQUAL(gd.getChild(2,0), 3); BOOST_REQUIRE_EQUAL(gd.getChild(2,0), 3ul);
BOOST_REQUIRE_EQUAL(gd.getChild(2,1), 1); BOOST_REQUIRE_EQUAL(gd.getChild(2,1), 1ul);
BOOST_REQUIRE_EQUAL(gd.getChild(2,2), 8); BOOST_REQUIRE_EQUAL(gd.getChild(2,2), 8ul);
BOOST_REQUIRE_EQUAL(gd.getChild(2,3), 6); BOOST_REQUIRE_EQUAL(gd.getChild(2,3), 6ul);
BOOST_REQUIRE_EQUAL(gd.getNChilds(3), 3); BOOST_REQUIRE_EQUAL(gd.getNChilds(3), 3ul);
BOOST_REQUIRE_EQUAL(gd.getChild(3,0), 2); BOOST_REQUIRE_EQUAL(gd.getChild(3,0), 2ul);
BOOST_REQUIRE_EQUAL(gd.getChild(3,1), 9); BOOST_REQUIRE_EQUAL(gd.getChild(3,1), 9ul);
BOOST_REQUIRE_EQUAL(gd.getChild(3,2), 7); BOOST_REQUIRE_EQUAL(gd.getChild(3,2), 7ul);
} }
if(vcl.getProcessUnitID() == 1) if(vcl.getProcessUnitID() == 1)
{ {
BOOST_REQUIRE_EQUAL(gd.getVertexId(0), 4); BOOST_REQUIRE_EQUAL(gd.getVertexId(0), 4ul);
BOOST_REQUIRE_EQUAL(gd.getVertexId(1), 5); BOOST_REQUIRE_EQUAL(gd.getVertexId(1), 5ul);
BOOST_REQUIRE_EQUAL(gd.getVertexId(2), 6); BOOST_REQUIRE_EQUAL(gd.getVertexId(2), 6ul);
BOOST_REQUIRE_EQUAL(gd.getVertexId(3), 7); BOOST_REQUIRE_EQUAL(gd.getVertexId(3), 7ul);
} }
if(vcl.getProcessUnitID() == 2) if(vcl.getProcessUnitID() == 2)
{ {
BOOST_REQUIRE_EQUAL(gd.getVertexId(0), 8); BOOST_REQUIRE_EQUAL(gd.getVertexId(0), 8ul);
BOOST_REQUIRE_EQUAL(gd.getVertexId(1), 9); BOOST_REQUIRE_EQUAL(gd.getVertexId(1), 9ul);
BOOST_REQUIRE_EQUAL(gd.getVertexId(2), 10); BOOST_REQUIRE_EQUAL(gd.getVertexId(2), 10ul);
BOOST_REQUIRE_EQUAL(gd.getVertexId(3), 11); BOOST_REQUIRE_EQUAL(gd.getVertexId(3), 11ul);
BOOST_REQUIRE_EQUAL(gd.getVertexId(4), 12); BOOST_REQUIRE_EQUAL(gd.getVertexId(4), 12ul);
BOOST_REQUIRE_EQUAL(gd.getVertexId(5), 13); BOOST_REQUIRE_EQUAL(gd.getVertexId(5), 13ul);
} }
if(vcl.getProcessUnitID() == 3) if(vcl.getProcessUnitID() == 3)
{ {
BOOST_REQUIRE_EQUAL(gd.getVertexId(0), 14); BOOST_REQUIRE_EQUAL(gd.getVertexId(0), 14ul);
BOOST_REQUIRE_EQUAL(gd.getVertexId(1), 15); BOOST_REQUIRE_EQUAL(gd.getVertexId(1), 15ul);
} }
} }
...@@ -326,131 +326,6 @@ BOOST_AUTO_TEST_CASE( dist_map_graph_use_redistribution) ...@@ -326,131 +326,6 @@ BOOST_AUTO_TEST_CASE( dist_map_graph_use_redistribution)
} }
BOOST_AUTO_TEST_CASE( dist_map_graph_use_cartesian)
{
//! Vcluster
Vcluster & vcl = *global_v_cluster;
// if(vcl.getProcessingUnits() != 3)
// return;
// non-periodic boundary condition
size_t bc[3] = {NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
//! [Create CartDecomposition]
CartDecomposition<3, float> dec(vcl);
// Physical domain
Box<3, float> box( { 0.0, 0.0, 0.0 }, { 1.0, 1.0, 1.0 });
size_t div[3] = {8,8,8};
// Grid size and info
size_t gsz[3] = {8,8,8};
grid_sm<3,void> g_sm(gsz);
// Define ghost
Ghost<3, float> g(0.01);
// Decompose
dec.setParameters(div, box, bc, g);
dec.decompose();
grid_dist_id_iterator_dec<CartDecomposition<3,float>> it_dec(dec,gsz);
size_t cnt = 0;
while (it_dec.isNext())
{
cnt++;
++it_dec;
}
openfpm::vector<size_t> v_cnt(vcl.getProcessingUnits());
// Sent and receive the size of each subgraph
vcl.allGather(cnt, v_cnt);
vcl.execute();
cnt = 0;
for (long int i = 0; i <= ((long int)vcl.getProcessUnitID()) - 1 ; ++i)
cnt += v_cnt.get(i);
// count the points
//! Distributed graph
DistGraph_CSR<aggregate<size_t[3]>, aggregate<size_t>> dg;
grid_dist_id_iterator_dec<CartDecomposition<3,float>> it_dec2(dec,gsz);
while (it_dec2.isNext())
{
auto key = it_dec2.get();
aggregate<size_t[3]> v;
v.template get<0>()[0] = key.get(0);
v.template get<0>()[1] = key.get(1);
v.template get<0>()[2] = key.get(2);
size_t gid = g_sm.LinId(key);
dg.add_vertex(v, gid, cnt);
cnt++;
++it_dec2;
}
dg.init();
// we ask for some random vertex
std::default_random_engine rg;
std::uniform_int_distribution<size_t> d(0,g_sm.size()-1);
openfpm::vector<size_t> v_req;
/* for (size_t i = 0 ; i < 16 ; i++)
{
size_t v = d(rg);*/
if (vcl.getProcessUnitID() == 0)
dg.reqVertex(450);
/* dg.reqVertex(v);
}*/
dg.sync();
if (vcl.getProcessUnitID() == 0)
{
grid_key_dx<3> key;
// get the position information
key.set_d(0,dg.getVertex(450).template get<0>()[0]);
key.set_d(1,dg.getVertex(450).template get<0>()[1]);
key.set_d(2,dg.getVertex(450).template get<0>()[2]);
size_t lin_id = g_sm.LinId(key);
// BOOST_REQUIRE_EQUAL(lin_id,v_req.get(i));
std::cout << "Error: " << " " << lin_id << " " << key.to_string() << "\n";
}
/* for (size_t i = 0 ; i < 16 ; i++)
{
grid_key_dx<3> key;
// get the position information
key.set_d(0,dg.getVertex(v_req.get(i)).template get<0>()[0]);
key.set_d(1,dg.getVertex(v_req.get(i)).template get<0>()[1]);
key.set_d(2,dg.getVertex(v_req.get(i)).template get<0>()[2]);
size_t lin_id = g_sm.LinId(key);
// BOOST_REQUIRE_EQUAL(lin_id,v_req.get(i));
std::cout << "Error: " << i << " " << lin_id << " " << v_req.get(i) << "\n";
}*/
/* if (vcl.getProcessUnitID() == 0)
std::cout << "Error: " << i << " " << lin_id << " " << v_req.get(i) << "\n";*/
}
BOOST_AUTO_TEST_CASE( dist_map_graph_use_free_add) BOOST_AUTO_TEST_CASE( dist_map_graph_use_free_add)
{ {
...@@ -549,7 +424,7 @@ BOOST_AUTO_TEST_CASE( dist_map_graph_use_free_add) ...@@ -549,7 +424,7 @@ BOOST_AUTO_TEST_CASE( dist_map_graph_use_free_add)
gd.sync(); gd.sync();
if(vcl.getProcessUnitID() == 0) if(vcl.getProcessUnitID() == 0)
BOOST_REQUIRE_EQUAL(gd.getVertexId(5), 5); BOOST_REQUIRE_EQUAL(gd.getVertexId(5), 5ul);
gd.deleteGhosts(); gd.deleteGhosts();
...@@ -672,7 +547,7 @@ BOOST_AUTO_TEST_CASE( dist_map_graph_use_multi_free_add) ...@@ -672,7 +547,7 @@ BOOST_AUTO_TEST_CASE( dist_map_graph_use_multi_free_add)
gd.sync(); gd.sync();
BOOST_REQUIRE_EQUAL(gd.getVertexId(gd.getNVertex()-1), 15); BOOST_REQUIRE_EQUAL(gd.getVertexId(gd.getNVertex()-1), 15ul);
} }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "Packer_Unpacker/Packer.hpp" #include "Packer_Unpacker/Packer.hpp"
#include "Packer_Unpacker/Unpacker.hpp" #include "Packer_Unpacker/Unpacker.hpp"
#define SUB_UNIT_FACTOR 64 #define GRID_SUB_UNIT_FACTOR 64
/*! \brief This is a distributed grid /*! \brief This is a distributed grid
...@@ -480,7 +480,7 @@ class grid_dist_id ...@@ -480,7 +480,7 @@ class grid_dist_id
// Get the number of processor and calculate the number of sub-domain // Get the number of processor and calculate the number of sub-domain
// for decomposition // for decomposition
size_t n_proc = v_cl.getProcessingUnits(); size_t n_proc = v_cl.getProcessingUnits();
size_t n_sub = n_proc * SUB_UNIT_FACTOR; size_t n_sub = n_proc * GRID_SUB_UNIT_FACTOR;
// Calculate the maximum number (before merging) of sub-domain on // Calculate the maximum number (before merging) of sub-domain on
// each dimension // each dimension
......
...@@ -25,8 +25,11 @@ void Test3D_extended_grid(const Box<3,float> & domain, long int k) ...@@ -25,8 +25,11 @@ void Test3D_extended_grid(const Box<3,float> & domain, long int k)
print_test( "Testing 3D extended grid k<=",k); print_test( "Testing 3D extended grid k<=",k);
// 3D test // factor
for ( ; k >= 2 ; k-= (k > 2*big_step)?big_step:small_step ) float factor = pow(global_v_cluster->getProcessingUnits()/2.0f,1.0f/3.0f);
// This test in order to work must have at least one ghost
for ( ; (0.01 / factor) > (domain.getHigh(0) - domain.getLow(0) / k) ; k-= (k > 2*big_step)?big_step:small_step )
{ {
BOOST_TEST_CHECKPOINT( "Testing 3D extended grid k=" << k ); BOOST_TEST_CHECKPOINT( "Testing 3D extended grid k=" << k );
...@@ -36,9 +39,6 @@ void Test3D_extended_grid(const Box<3,float> & domain, long int k) ...@@ -36,9 +39,6 @@ void Test3D_extended_grid(const Box<3,float> & domain, long int k)
sz[1] = k; sz[1] = k;
sz[2] = k; sz[2] = k;
// factor
float factor = pow(global_v_cluster->getProcessingUnits()/2.0f,1.0f/3.0f);
// Ghost // Ghost
Ghost<3,float> g(0.01 / factor); Ghost<3,float> g(0.01 / factor);
...@@ -86,8 +86,6 @@ void Test3D_extended_grid(const Box<3,float> & domain, long int k) ...@@ -86,8 +86,6 @@ void Test3D_extended_grid(const Box<3,float> & domain, long int k)
// Get domain iterator // Get domain iterator
grid_sm<3,void> info = g_dist2.getGridInfo(); grid_sm<3,void> info = g_dist2.getGridInfo();
size_t cnt = 0;
auto dom_g3 = g_dist2.getDomainIterator(); auto dom_g3 = g_dist2.getDomainIterator();
check = false; check = false;
...@@ -123,15 +121,9 @@ void Test3D_extended_grid(const Box<3,float> & domain, long int k) ...@@ -123,15 +121,9 @@ void Test3D_extended_grid(const Box<3,float> & domain, long int k)
auto key2 = g_dist2.getGKey(key1); auto key2 = g_dist2.getGKey(key1);
check &= g_dist2.template get<0>(key1)[0] == key2.get(0); check &= g_dist2.template get<0>(key1)[0] == (size_t)key2.get(0);
check &= g_dist2.template get<0>(key1)[1] == key2.get(1); check &= g_dist2.template get<0>(key1)[1] == (size_t)key2.get(1);
check &= g_dist2.template get<0>(key1)[2] == key2.get(2); check &= g_dist2.template get<0>(key1)[2] == (size_t)key2