Commit 51508d1d authored by incardon's avatar incardon

Added faster CRS

parent 230d9e36
......@@ -4,7 +4,7 @@
## Take all the options with the exception of --enable-install-req
AC_PREREQ(2.59)
AC_INIT(OpenFPM_pdata, 0.8.0, BUG-REPORT-ADDRESS)
AC_INIT(OpenFPM_pdata, 0.9.0, BUG-REPORT-ADDRESS)
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_SUBDIRS([openfpm_data openfpm_devices openfpm_vcluster openfpm_io openfpm_numerics])
......
......@@ -10,7 +10,7 @@ fi
## Remove old download
rm -rf parmetis-4.0.3
wget http://ppmcore.mpi-cbg.de/upload/parmetis-4.0.3.tar.gz
wget http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-4.0.3.tar.gz
tar -xf parmetis-4.0.3.tar.gz
cd parmetis-4.0.3
make config prefix=$1/PARMETIS
......
......@@ -31,6 +31,7 @@
#include "NN/VerletList/VerletList.hpp"
#include "vector_dist_comm.hpp"
#include "DLB/LB_Model.hpp"
#include "Vector/vector_map_iterator.hpp"
#define VECTOR_DIST_ERROR_OBJECT std::runtime_error("Runtime vector distributed error");
......@@ -1800,7 +1801,7 @@ public:
* \return Particle iterator
*
*/
template<typename cli> ParticleItCRS_Cells<dim,cli> getParticleIteratorCRS(cli & NN)
template<typename cli> ParticleItCRS_Cells<dim,cli> getParticleIteratorCRS_Cell(cli & NN)
{
// Shift
grid_key_dx<dim> shift;
......@@ -1819,6 +1820,20 @@ public:
NN.getNNc_sym());
}
/*! \brief Get a special particle iterator able to iterate across particles using
* symmetric crossing scheme
*
* \param NN Verlet list neighborhood
*
* \return Particle iterator
*
*/
template<typename vrl> openfpm::vector_key_iterator_seq<typename vrl::local_index_t> getParticleIteratorCRS(vrl & NN)
{
// First we check that
return openfpm::vector_key_iterator_seq<typename vrl::local_index_t>(NN.getParticleSeq());
}
/*! \brief Return from which cell we have to start in case of CRS interation
* scheme
*
......
......@@ -684,7 +684,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_symmetric_crs_cell_list )
// In case of CRS we have to iterate particles within some cells
// here we define whichone
auto p_it2 = vd2.getParticleIteratorCRS(NN2);
auto p_it2 = vd2.getParticleIteratorCRS_Cell(NN2);
// For each particle
while (p_it2.isNext())
......@@ -1326,7 +1326,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_symmetric_crs_verlet_list )
auto NN2 = vd2.getVerletCrs(r_cut);
// Because iterating across particles in the CSR scheme require a Cell-list
auto p_it2 = vd2.getParticleIteratorCRS(NN2.getInternalCellList());
auto p_it2 = vd2.getParticleIteratorCRS_Cell(NN2.getInternalCellList());
while (p_it2.isNext())
{
......@@ -1402,5 +1402,97 @@ BOOST_AUTO_TEST_CASE( vector_dist_symmetric_crs_verlet_list )
BOOST_REQUIRE_EQUAL(ret,true);
}
BOOST_AUTO_TEST_CASE( vector_dist_symmetric_crs_verlet_list_partit )
{
Vcluster & v_cl = create_vcluster();
if (v_cl.getProcessingUnits() > 24)
return;
float L = 1000.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(-L,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 k=",k);
BOOST_TEST_CHECKPOINT( "Testing 3D periodic vector symmetric cell-list k=" << k );
Box<3,float> box({-L,-L,-L},{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();
// sync the ghost
vd.ghost_get<0>();
// We now try symmetric Verlet-list Crs scheme
auto NN2 = vd.getVerletCrs(r_cut);
// Because iterating across particles in the CSR scheme require a Cell-list
auto p_it2 = vd.getParticleIteratorCRS_Cell(NN2.getInternalCellList());
auto p_it3 = vd.getParticleIteratorCRS(NN2);
while (p_it2.isNext())
{
auto p = p_it2.get();
auto p2 = p_it3.get();
ret &= (p == p2);
if (ret == false)
break;
++p_it2;
++p_it3;
}
BOOST_REQUIRE_EQUAL(ret,true);
}
#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