Commit 7b73d120 authored by incardon's avatar incardon

Fixing dynamic load balancing for the CUDA version

parent e418158e
Pipeline #944 failed with stages
in 3 minutes and 56 seconds
openfpm_vcluster @ 9ca08e7b
Subproject commit 6ae300fdcd4ffae4e1039c0661901657bdfdcfa1
Subproject commit 9ca08e7be54a0f1edd230c73b1a4296a38baca69
......@@ -1213,6 +1213,7 @@ public:
proc_int_box.clear();
vb_ext.clear();
vb_int.clear();
vb_int_box.clear();
geo_cell.clear();
shifts.clear();
ids_p.clear();
......
......@@ -9,7 +9,7 @@
#define SRC_VECTOR_VECTOR_DIST_DLB_TEST_HPP_
#include "DLB/LB_Model.hpp"
#include "vector_dist.hpp"
#include "Vector/vector_dist.hpp"
BOOST_AUTO_TEST_SUITE( vector_dist_dlb_test )
......@@ -218,8 +218,8 @@ template<typename vector_type> void test_dlb_vector()
if (v_cl.getProcessingUnits() > 8)
return;
Box<3,float> domain({0.0,0.0,0.0},{1.0,1.0,1.0});
Ghost<3,float> g(0.1);
Box<3,double> domain({0.0,0.0,0.0},{1.0,1.0,1.0});
Ghost<3,double> g(0.1);
size_t bc[3] = {PERIODIC,PERIODIC,PERIODIC};
vector_type vd(0,domain,bc,g,DEC_GRAN(2048));
......@@ -232,22 +232,38 @@ template<typename vector_type> void test_dlb_vector()
{
vd.add();
vd.getLastPos()[0] = ((float)rand())/RAND_MAX * 0.3;
vd.getLastPos()[1] = ((float)rand())/RAND_MAX * 0.3;
vd.getLastPos()[2] = ((float)rand())/RAND_MAX * 0.3;
vd.getLastPos()[0] = ((double)rand())/RAND_MAX * 0.3;
vd.getLastPos()[1] = ((double)rand())/RAND_MAX * 0.3;
vd.getLastPos()[2] = ((double)rand())/RAND_MAX * 0.3;
}
}
vd.map();
vd.template ghost_get<>();
// Get the neighborhood of each particles
auto VV = vd.getVerlet(0.01);
// store the number of neighborhood for each particles
auto it = vd.getDomainIterator();
while (it.isNext())
{
auto p = it.get();
vd.template getProp<0>(p) = VV.getNNPart(p.getKey());
++it;
}
ModelSquare md;
md.factor = 10;
vd.addComputationCosts(md);
vd.getDecomposition().decompose();
vd.map();
vd.addComputationCosts(md);
openfpm::vector<size_t> loads;
......@@ -257,15 +273,15 @@ template<typename vector_type> void test_dlb_vector()
for (size_t i = 0 ; i < loads.size() ; i++)
{
float load_f = load;
float load_fc = loads.get(i);
double load_f = load;
double load_fc = loads.get(i);
BOOST_REQUIRE_CLOSE(load_f,load_fc,7.0);
}
BOOST_REQUIRE(vd.size_local() != 0);
Point<3,float> v({1.0,1.0,1.0});
Point<3,double> v({1.0,1.0,1.0});
for (size_t i = 0 ; i < 25 ; i++)
{
......@@ -284,6 +300,23 @@ template<typename vector_type> void test_dlb_vector()
++it;
}
vd.map();
vd.template ghost_get<>();
auto VV2 = vd.getVerlet(0.01);
auto it2 = vd.getDomainIterator();
bool match = true;
while (it2.isNext())
{
auto p = it2.get();
match &= vd.template getProp<0>(p) == VV2.getNNPart(p.getKey());
++it2;
}
BOOST_REQUIRE_EQUAL(match,true);
ModelSquare md;
vd.addComputationCosts(md);
......@@ -303,8 +336,8 @@ template<typename vector_type> void test_dlb_vector()
for (size_t i = 0 ; i < loads.size() ; i++)
{
float load_f = load;
float load_fc = loads.get(i);
double load_f = load;
double load_fc = loads.get(i);
BOOST_REQUIRE_CLOSE(load_f,load_fc,10.0);
}
......@@ -363,7 +396,7 @@ template<typename vector_type> void test_dlb_multi_phase_v_vector()
BOOST_AUTO_TEST_CASE( vector_dist_dlb_test_part )
{
test_dlb_vector<vector_dist<3,float,aggregate<float>>>();
test_dlb_vector<vector_dist<3,double,aggregate<double>>>();
}
BOOST_AUTO_TEST_CASE( vector_dist_dlb_multi_phase_test_part )
......@@ -379,9 +412,9 @@ BOOST_AUTO_TEST_CASE( vector_dist_dlb_multi_phase_v_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,memory_traits_lin,MetisDistribution<3,float>>>>();
double,
aggregate<double>,
CartDecomposition<3,double,HeapMemory,memory_traits_lin,MetisDistribution<3,double>>>>();
}
BOOST_AUTO_TEST_SUITE_END()
......
......@@ -283,7 +283,7 @@ class vector_dist_comm
void createShiftBox()
{
if (shift_box_ndec == (long int)dec.get_ndec())
return;
{return;}
struct sh_box
{
......
......@@ -52,6 +52,6 @@ int main(int argc, char* argv[])
#include "Graph/DistGraphFactory.hpp"
#include "Decomposition/nn_processor_unit_test.hpp"
#include "Vector/se_class3_vector_unit_tests.hpp"
#include "Vector/vector_dist_dlb_test.hpp"
#include "Vector/tests/vector_dist_dlb_test.hpp"
#include "Decomposition/Domain_NN_calculator_cart_unit_test.hpp"
//#include "antoniol_test_isolation.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