Commit 2f937ae8 authored by incardon's avatar incardon

Fixing bug with unloaded processors

parent 23737454
......@@ -280,10 +280,10 @@ public:
for (size_t i = 0 ; i < dim ; i++)
{
proc_box.setLow(i,0.0);
proc_box.setHigh(i,(size_t)-1);
proc_box.setHigh(i,0);
bbox.setLow(i,0.0);
bbox.setHigh(i,(size_t)-1);
bbox.setHigh(i,0);
}
}
......@@ -340,7 +340,8 @@ public:
// Get the processor bounding Box
::Box<dim,T> bound = getProcessorBounds();
if (bound.isValid() == true)
// Check if the box is valid
if (bound.isValidN() == true)
{
// Not necessary, but I prefer
bound.enlarge(ghost);
......
......@@ -1489,9 +1489,9 @@ public:
template<int ... prp> inline void ghost_get(size_t opt = WITH_POSITION)
{
#ifdef SE_CLASS1
if (getDecomposition().getProcessorBounds().isValid() == false && vd.size_local() != 0)
if (getDecomposition().getProcessorBounds().isValid() == false && size_local() != 0)
{
std::cerr << __FILE__ << ":" << __LINE__ << " Error the processor " << v_cl.getProcessorUnitID() << " has particles, but is supposed to be unloaded" << std::endl;
std::cerr << __FILE__ << ":" << __LINE__ << " Error the processor " << v_cl.getProcessUnitID() << " has particles, but is supposed to be unloaded" << std::endl;
ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
}
#endif
......
......@@ -1602,5 +1602,95 @@ BOOST_AUTO_TEST_CASE( vector_dist_symmetric_crs_verlet_list_partit )
BOOST_REQUIRE_EQUAL(ret,true);
}
BOOST_AUTO_TEST_CASE( vector_dist_checking_unloaded_processors )
{
Vcluster & v_cl = create_vcluster();
if (v_cl.getProcessingUnits() > 24)
return;
float L = 200.0;
bool ret = true;
// set the seed
// create the random generator engine
std::srand(0);
std::default_random_engine eg;
std::uniform_real_distribution<float> ud(0,L);
long int k = 4096 * v_cl.getProcessingUnits();
long int big_step = k / 4;
big_step = (big_step == 0)?1:big_step;
print_test("Testing 3D periodic vector symmetric cell-list (unload processors) k=",k);
BOOST_TEST_CHECKPOINT( "Testing 3D periodic vector symmetric cell-list (unload processors) k=" << k );
Box<3,float> box({0,0,0},{L,L,L});
// Boundary conditions
size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
float r_cut = 100.0;
// ghost
Ghost<3,float> ghost(r_cut);
Ghost<3,float> ghost2(r_cut);
ghost2.setLow(0,0.0);
ghost2.setLow(1,0.0);
ghost2.setLow(2,0.0);
typedef aggregate<size_t> part_prop;
// Distributed vector
vector_dist<3,float, part_prop > vd(k,box,bc,ghost,BIND_DEC_TO_GHOST);
auto it = vd.getIterator();
while (it.isNext())
{
auto key = it.get();
vd.getPos(key)[0] = ud(eg);
vd.getPos(key)[1] = ud(eg);
vd.getPos(key)[2] = ud(eg);
// Fill some properties randomly
vd.getProp<0>(key) = 0;
++it;
}
vd.map();
//
if (v_cl.getProcessingUnits() >= 9)
{
size_t min = vd.size_local();
v_cl.min(min);
v_cl.execute();
BOOST_REQUIRE_EQUAL(min,0);
}
// sync the ghost
vd.ghost_get<0>();
//
if (v_cl.getProcessingUnits() >= 9)
{
size_t min = vd.size_local_with_ghost() - vd.size_local();
v_cl.min(min);
v_cl.execute();
BOOST_REQUIRE_EQUAL(min,0);
}
}
#endif /* SRC_VECTOR_VECTOR_DIST_CELL_LIST_TESTS_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