Commit 1a1686d9 authored by incardon's avatar incardon
Browse files

New MPI + MAP on device finally working

parent 50c8a15d
......@@ -412,6 +412,7 @@ if test x"$NVCC_EXIST" = x"yes"; then
fi
else
gpu_support=no
INITIALIZATION_SOURCE="initialize_openfpm.cpp"
fi
if test x$gpu_support = x"no"; then
......
......@@ -13,7 +13,7 @@ int main(int argc, char ** argv)
openfpm_init(&argc,&argv);
// Vcluster
Vcluster & vcl = create_vcluster();
Vcluster<> & vcl = create_vcluster();
//! [Create CartDecomposition vtk gen]
CartDecomposition<2,float> dec(vcl);
......
LINKLIBS = $(HDF5_LDFLAGS) $(HDF5_LIBS) $(OPENMP_LDFLAGS) $(LIBHILBERT_LIB) $(PETSC_LIB) $(SUITESPARSE_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(METIS_LIB) $(PARMETIS_LIB) $(PTHREAD_LIBS) $(OPT_LIBS) $(BOOST_LDFLAGS) $(BOOST_IOSTREAMS_LIB) $(CUDA_LIBS)
noinst_PROGRAMS = cart_dec metis_dec dom_box vector_dist
cart_dec_SOURCES = CartDecomposition_gen_vtk.cpp ../src/lib/pdata.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
cart_dec_SOURCES = CartDecomposition_gen_vtk.cpp ../src/lib/pdata.cpp ../openfpm_devices/src/memory/CudaMemory.cu ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
cart_dec_CXXFLAGS = -Wno-unknown-pragmas $(OPENMP_CFLAGS) $(AM_CXXFLAGS) $(PETSC_INCLUDE) $(METIS_INCLUDE) $(PARMETIS_INCLUDE) $(CUDA_CFLAGS) $(INCLUDES_PATH) $(BOOST_CPPFLAGS) -I../src -Wno-unused-function -Wno-unused-local-typedefs
cart_dec_CFLAGS = $(OPENMP_CFLAGS) $(CUDA_CFLAGS)
cart_dec_LDADD = $(LINKLIBS) -lparmetis -lmetis
metis_dec_SOURCES = Metis_gen_vtk.cpp ../src/lib/pdata.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
metis_dec_SOURCES = Metis_gen_vtk.cpp ../src/lib/pdata.cpp ../openfpm_devices/src/memory/CudaMemory.cu ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
metis_dec_CXXFLAGS = -Wno-unknown-pragmas $(OPENMP_CFLAGS) $(AM_CXXFLAGS) $(PETSC_INCLUDE) $(METIS_INCLUDE) $(CUDA_CFLAGS) $(INCLUDES_PATH) $(BOOST_CPPFLAGS) -I../src -Wno-unused-function -Wno-unused-local-typedefs
metis_dec_CFLAGS = $(OPENMP_CFLAGS) $(CUDA_CFLAGS)
metis_dec_LDADD = $(LINKLIBS) -lmetis
dom_box_SOURCES = domain_gen_vtk.cpp ../src/lib/pdata.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
dom_box_SOURCES = domain_gen_vtk.cpp ../src/lib/pdata.cpp ../openfpm_devices/src/memory/CudaMemory.cu ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
dom_box_CXXFLAGS = -Wno-unknown-pragmas $(OPENMP_CFLAGS) $(AM_CXXFLAGS) $(PETSC_INCLUDE) $(METIS_INCLUDE) $(CUDA_CFLAGS) $(INCLUDES_PATH) $(BOOST_CPPFLAGS) -I../src -Wno-unused-function -Wno-unused-local-typedefs
dom_box_CFLAGS = $(OPENMP_CFLAGS) $(CUDA_CFLAGS)
dom_box_LDADD = $(LINKLIBS)
vector_dist_SOURCES = vector.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_devices/src/Memleak_check.cpp
vector_dist_SOURCES = vector.cpp ../openfpm_devices/src/memory/CudaMemory.cu ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_devices/src/Memleak_check.cpp
vector_dist_CXXFLAGS = -Wno-unknown-pragmas $(OPENMP_CFLAGS) $(AM_CXXFLAGS) $(LIBHILBERT_INCLUDE) $(PETSC_INCLUDE) $(PARMETIS_INCLUDE) $(METIS_INCLUDE) $(CUDA_CFLAGS) $(INCLUDES_PATH) $(HDF5_CPPFLAGS) $(BOOST_CPPFLAGS) -I../src -Wno-unused-function -Wno-unused-local-typedefs
vector_dist_CFLAGS = $(OPENMP_CFLAGS) $(CUDA_CFLAGS)
vector_dist_LDADD = $(LINKLIBS) -lparmetis -lmetis
......
......@@ -50,9 +50,7 @@ int main(int argc, char* argv[])
// randomly in the domain, we create a Box that define our domain, boundary conditions, and ghost
//
openfpm_init(&argc,&argv);
Vcluster & v_cl = create_vcluster();
typedef Point<2,float> s;
Vcluster<> & v_cl = create_vcluster();
// set the seed
// create the random generator engine
......
......@@ -176,7 +176,6 @@ if [ $? -ne 0 ]; then
exit 1
fi
## check for options
echo -e "\033[1;34;5mDEPENCENCIES INSTALLATION DIR \033[0m"
......@@ -317,6 +316,7 @@ HDF5_System_prv=1
LIBHILBERT_installed=0
conf_err=1
if [ $install_req -eq 0 ]; then
./configure $options $configure_options "$configure_blas_option"
else
......
openfpm_data @ 0261ed4b
Subproject commit 66fdd0bdd308bd78efe3c14a7d2bf9290e35f550
Subproject commit 0261ed4b804309864d899bedec46a67e5e6cfe95
openfpm_devices @ e5d5d31a
Subproject commit c751d466195fd0271acf1933a6b0e9d2233d3529
Subproject commit e5d5d31a0af09312118f72c0818a824443ba80fb
openfpm_vcluster @ 11a0f824
Subproject commit ec95a342bc6fc783099f3cb044ff4524348bfedf
Subproject commit 11a0f824c111e686ad2388cec485ffcaafab5560
......@@ -4,20 +4,6 @@ function haveProg() {
[ -x "$(command -v $1)" ]
}
function gpp_clang()
{
if [ x"$possible_solutions_command" == x"g++" ]; then
CXX=g++
CC=gcc
F77=gfortran
FC=gfortran
else
CXX=clang++
CC=clang
F77=gfortran
FC=gfortran
fi
}
function detect_compiler()
{
......@@ -25,6 +11,7 @@ function detect_compiler()
icpc_found=0
dgc_ret=0
if [ x"$CXX" != x"" -o x"$CC" != x"" -o x"$F77" != x"" -o x"$FC" != x"" ]; then
if [ x"$CXX" == x"" ]; then
......@@ -65,6 +52,7 @@ function detect_compiler()
return
fi
# First we try to understand if g++ command line is linked to clang
if haveProg g++; then
......@@ -111,6 +99,7 @@ function detect_compiler()
fi
fi
g++ --version | grep "g++" > /dev/null 2>&1
if [ $? == 0 -a $gpp_found -ne 1 ]; then
dgc_major=$(g++ --version | grep g++ | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
......@@ -147,6 +136,7 @@ function detect_compiler()
fi
fi
g++ --version | grep "clang" > /dev/null 2>&1
if [ $? == 0 -a $gpp_found -ne 1 ]; then
dgc_major=$(g++ --version | grep g++ | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
......@@ -224,11 +214,17 @@ function detect_compiler()
FC=ifort
dgc_compiler=icpc
else
gpp_clang
CXX=g++
CC=gcc
F77=gfortran
FC=gfortran
fi
dgc_ret=1
elif [ $gpp_found -eq 1 ]; then
gpp_clang
CXX=g++
CC=gcc
F77=gfortran
FC=gfortran
elif [ $icpc_found -eq 1 ]; then
CXX=icpc
CC=icc
......
......@@ -25,7 +25,8 @@ cd openmpi-3.1.1
#
#
./configure --with-cuda --prefix=$1/MPI --enable-mpi-fortran=yes CC=$3 CXX=$4 F77=$4 FC=$5
./configure --with-cuda --prefix=$1/MPI --enable-mpi-fortran=yes CC=$3 CXX=$4 F77=$5 FC=$5
make -j $2
make install
......
......@@ -191,7 +191,7 @@ function remove_old()
version=$(cat $1/MPI/version)
if [ x"$version" != x"3" ]; then
echo -e "\033[1;34;5m -------------------------------------------------------------------------------------- \033[0m"
echo -e "\033[1;34;5m MPI has been updated to version 2.1.1, the component will be updated automatically \033[0m"
echo -e "\033[1;34;5m MPI has been updated to version 3.1.1, the component will be updated automatically \033[0m"
echo -e "\033[1;34;5m -------------------------------------------------------------------------------------- \033[0m"
sleep 5
rm -rf $1/MPI/include
......
......@@ -69,7 +69,7 @@ public:
private:
//! Runtime virtual cluster machine
Vcluster & v_cl;
Vcluster<> & v_cl;
//! Structure that will contain all the timings
Times timeInfo;
......@@ -165,7 +165,7 @@ public:
*
* \param v_cl virtual cluster object
*/
DLB(Vcluster & v_cl) :
DLB(Vcluster<> & v_cl) :
v_cl(v_cl)
{
}
......
......@@ -197,7 +197,7 @@ protected:
size_t magn[dim];
//! Runtime virtual cluster machine
Vcluster & v_cl;
Vcluster<> & v_cl;
//! Create distribution
Distribution dist;
......@@ -353,7 +353,7 @@ public:
* \param opt option (one option is to construct)
*
*/
void createSubdomains(Vcluster & v_cl, const size_t (& bc)[dim], size_t opt = 0)
void createSubdomains(Vcluster<> & v_cl, const size_t (& bc)[dim], size_t opt = 0)
{
int p_id = v_cl.getProcessUnitID();
......@@ -708,7 +708,7 @@ public:
* \param v_cl Virtual cluster, used internally to handle or pipeline communication
*
*/
CartDecomposition(Vcluster & v_cl)
CartDecomposition(Vcluster<> & v_cl)
:nn_prcs<dim, T>(v_cl), v_cl(v_cl), dist(v_cl),ref_cnt(0)
{
// Reset the box to zero
......@@ -1622,6 +1622,31 @@ public:
return processorID<Mem>(pt) == v_cl.getProcessUnitID();
}
/*! \brief Check if the particle is local considering boundary conditions
*
* \warning if the particle id outside the domain and non periodic boundary the result
* is unreliable
*
*
* \param p object position
* \param bc boundary conditions
*
* \return true if it is local
*
*/
bool isLocalBC(const Point<dim,T> & p, const size_t (& bc)[dim]) const
{
Point<dim,T> pt = p;
for (size_t i = 0 ; i < dim ; i++)
{
if (bc[i] == PERIODIC)
pt.get(i) = openfpm::math::periodic_l(p[i],domain.getHigh(i),domain.getLow(i));
}
return processorID(pt) == v_cl.getProcessUnitID();
}
/*! \brief Get the domain Cells
*
* It return all the cells-id that are inside the processor-domain
......@@ -1789,7 +1814,7 @@ public:
* \return the Virtual cluster machine
*
*/
Vcluster & getVC() const
Vcluster<> & getVC() const
{
#ifdef SE_CLASS2
check_valid(this,8);
......
......@@ -167,7 +167,7 @@ public:
* \param v_cl VCluster
*
*/
CartDecomposition_ext(Vcluster & v_cl)
CartDecomposition_ext(Vcluster<> & v_cl)
:CartDecomposition<dim,T,Memory,layout_base,Distribution>(v_cl)
{
}
......
......@@ -17,7 +17,7 @@ template<unsigned int dim, typename T>
class DistParMetisDistribution
{
//! Vcluster
Vcluster & v_cl;
Vcluster<> & v_cl;
//! Structure that store the cartesian grid information
grid_sm<dim, void> gr;
......@@ -73,7 +73,7 @@ public:
*
* @param v_cl Vcluster to use as communication object in this class
*/
DistParMetisDistribution(Vcluster & v_cl) :
DistParMetisDistribution(Vcluster<> & v_cl) :
v_cl(v_cl), parmetis_graph(v_cl, v_cl.getProcessingUnits()), vtxdist(v_cl.getProcessingUnits() + 1), partitions(v_cl.getProcessingUnits()), v_per_proc(v_cl.getProcessingUnits())
{
......
......@@ -59,7 +59,7 @@ BOOST_AUTO_TEST_SUITE (Distribution_test)
BOOST_AUTO_TEST_CASE( Metis_distribution_test)
{
Vcluster & v_cl = create_vcluster();
Vcluster<> & v_cl = create_vcluster();
if (v_cl.getProcessingUnits() != 3)
return;
......@@ -180,7 +180,7 @@ BOOST_AUTO_TEST_CASE( Metis_distribution_test)
BOOST_AUTO_TEST_CASE( Parmetis_distribution_test)
{
Vcluster & v_cl = create_vcluster();
Vcluster<> & v_cl = create_vcluster();
if (v_cl.getProcessingUnits() != 3)
return;
......@@ -286,7 +286,7 @@ BOOST_AUTO_TEST_CASE( Parmetis_distribution_test)
BOOST_AUTO_TEST_CASE( DistParmetis_distribution_test)
{
Vcluster & v_cl = create_vcluster();
Vcluster<> & v_cl = create_vcluster();
if (v_cl.getProcessingUnits() != 3)
return;
......@@ -387,7 +387,7 @@ BOOST_AUTO_TEST_CASE( DistParmetis_distribution_test)
BOOST_AUTO_TEST_CASE( Space_distribution_test)
{
Vcluster & v_cl = create_vcluster();
Vcluster<> & v_cl = create_vcluster();
if (v_cl.getProcessingUnits() != 3)
return;
......
......@@ -30,7 +30,7 @@ template<unsigned int dim, typename T>
class MetisDistribution
{
//! Vcluster
Vcluster & v_cl;
Vcluster<> & v_cl;
//! Structure that store the cartesian grid information
grid_sm<dim, void> gr;
......@@ -111,7 +111,7 @@ public:
* \param v_cl vcluster
*
*/
MetisDistribution(Vcluster & v_cl)
MetisDistribution(Vcluster<> & v_cl)
:v_cl(v_cl),metis_graph(gp)
{
#ifdef SE_CLASS2
......
......@@ -39,7 +39,7 @@ class ParMetisDistribution
bool is_distributed = false;
//! Vcluster
Vcluster & v_cl;
Vcluster<> & v_cl;
//! Structure that store the cartesian grid information
grid_sm<dim, void> gr;
......@@ -283,7 +283,7 @@ public:
*
* \param v_cl Vcluster to use as communication object in this class
*/
ParMetisDistribution(Vcluster & v_cl)
ParMetisDistribution(Vcluster<> & v_cl)
:is_distributed(false),v_cl(v_cl), parmetis_graph(v_cl, v_cl.getProcessingUnits()), vtxdist(v_cl.getProcessingUnits() + 1), partitions(v_cl.getProcessingUnits()), v_per_proc(v_cl.getProcessingUnits())
{
}
......
......@@ -24,7 +24,7 @@ template<unsigned int dim, typename T>
class SpaceDistribution
{
//! Vcluster
Vcluster & v_cl;
Vcluster<> & v_cl;
//! Structure that store the cartesian grid information
grid_sm<dim, void> gr;
......@@ -42,7 +42,7 @@ public:
*
* \param v_cl Vcluster to use as communication object in this class
*/
SpaceDistribution(Vcluster & v_cl)
SpaceDistribution(Vcluster<> & v_cl)
:v_cl(v_cl)
{
}
......
......@@ -25,7 +25,7 @@ BOOST_AUTO_TEST_SUITE( Metis_test )
BOOST_AUTO_TEST_CASE( Metis_test_use)
{
Vcluster & v_cl = create_vcluster();
Vcluster<> & v_cl = create_vcluster();
if (v_cl.getProcessingUnits() != 3)
return;
......
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