diff --git a/.gitignore b/.gitignore index 9a81c6da630ebb6f1093d28f325674b0333cf926..66ab1b076f8438d370f47c61a67234071f542e03 100644 --- a/.gitignore +++ b/.gitignore @@ -119,3 +119,11 @@ projectId.sh /cmake-build-debug-gcc/ /cmake-build-falcon/ /cmake-build-release-gcc/ + +*CMake* +*cmake* +**/*cmake* +**/*CMake* + +**/.gitignore +.gitignore diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e3bc64a9708191b1d38fd9c2e563d294a5942c98..4309f6f00ef93503cbc92786b1c59b4d44db95aa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,4 @@ + centos_build: stage: build tags: @@ -29,6 +30,8 @@ centos_run: - ./run.sh $CI_PROJECT_DIR unused 4 0 0 numerics mac_build: + variables: + GIT_STRATEGY: empty stage: build tags: - mac diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ee76a524b1a1826eb1655d02f2df73ceca763e2..6a10042210f70214c504ab5450ef0c14825cd446 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,8 @@ set(TINYOBJLOADER_ROOT CACHE PATH "TinyObjLoader library path") set(SE_CLASS1 CACHE BOOL "Activate compilation with SE_CLASS1") set(SE_CLASS2 CACHE BOOL "Activate compilation with SE_CLASS2") set(SE_CLASS3 CACHE BOOL "Activate compilation with SE_CLASS3") +set(BLITZ_ROOT CACHE PATH "Blitz root directory") +set(ALGOIM_ROOT CACHE PATH "Algoim root directory") set(ACTION_ON_ERROR CACHE STRING "Action to perform in case of error") set(PROFILE_WITH_SCOREP CACHE BOOL "Enable profiling with scorep") set(ENV{PETSC_DIR} ${PETSC_ROOT}) @@ -88,6 +90,7 @@ find_package(SuiteSparse OPTIONAL_COMPONENTS UMFPACK) find_package(Vc) find_package(OpenMP) find_package(HIP) +find_package(Boost REQUIRED COMPONENTS unit_test_framework filesystem system thread) set(CMAKE_SKIP_BUILD_RPATH TRUE) diff --git a/build.sh b/build.sh index f26c0a6d1ccad1aae8b45701d2cdb31d514bbd20..1cc35bf9cc7ac33927265ed16d726a006990e96b 100755 --- a/build.sh +++ b/build.sh @@ -24,6 +24,8 @@ echo "GPU compilation: $with_gpu" if [ x"$hostname" == x"cifarm-centos-node.mpi-cbg.de" ]; then echo "CentOS node" source /opt/rh/devtoolset-8/enable + ./install_CMAKE_on_CI.sh $HOME/openfpm_dependencies/openfpm_pdata/$branch/ + export PATH="$HOME/openfpm_dependencies/openfpm_pdata/$branch/CMAKE/bin:$PATH" fi if [ x"$hostname" == x"cifarm-ubuntu-node" ]; then @@ -31,12 +33,18 @@ if [ x"$hostname" == x"cifarm-ubuntu-node" ]; then echo "Ubuntu node" ./install_MPI_mpich.sh $HOME/openfpm_dependencies/openfpm_pdata/$branch/ 4 export PATH="/opt/bin:$PATH" + foward_options="--enable-cuda-on-cpu" fi if [ x"$hostname" == x"cifarm-mac-node.mpi-cbg.de" ]; then echo "Mac node" export PATH="/usr/local/bin:$PATH" # rm -rf $HOME/openfpm_dependencies/openfpm_pdata/$branch/PETSC + ./install_CMAKE_on_CI.sh $HOME/openfpm_dependencies/openfpm_pdata/$branch/ + export PATH="$HOME/openfpm_dependencies/openfpm_pdata/$branch/CMAKE/bin:$PATH" + cd openfpm_vcluster + git stash + cd .. fi if [ x"$hostname" == x"falcon1" ]; then @@ -87,7 +95,6 @@ fi #echo "StrictHostKeyChecking=no" > $HOME/.ssh/config #chmod 600 $HOME/.ssh/config -foward_options="--enable-cuda-on-cpu" install_options= if [ x"$comp_type" == x"full" ]; then install_options="-s " diff --git a/configure b/configure index 7853c20d07d671ea69ae78490bebac5dea937ed3..9fe5ac8164d0789b63283fe3e942c1626aa6f0fe 100755 --- a/configure +++ b/configure @@ -108,6 +108,8 @@ with_parmetis enable_se_class1 enable_se_class2 enable_se_class3 +with_blitz +with_algoim with_alpaka with_action_on_error with_boost @@ -512,6 +514,12 @@ do vcdevel) conf_options="$conf_options -DVc_ROOT=$ac_optarg" ;; + blitz) + conf_options="$conf_options -DBLITZ_ROOT=$ac_optarg" + ;; + algoim) + conf_options="$conf_options -DALGOIM_ROOT=$ac_optarg" + ;; alpaka) conf_options="$conf_options -DALPAKA_ROOT=$ac_optarg" ;; diff --git a/example/Numerics/Sussman_redistancing/example_sussman_circle/main.cpp b/example/Numerics/Sussman_redistancing/example_sussman_circle/main.cpp index b19546737a5117277bb1417dd2de5128db88093e..f58ef59927e436be039bdf25232ab0cc96773f3c 100644 --- a/example/Numerics/Sussman_redistancing/example_sussman_circle/main.cpp +++ b/example/Numerics/Sussman_redistancing/example_sussman_circle/main.cpp @@ -322,7 +322,7 @@ int main(int argc, char* argv[]) // Minimum is 1 property, to which the Phi_SDF can be written // In this example we chose 3 properties. The 1st for the Phi_SDF, the 2nd for the gradient of phi and the 3rd for // the magnitude of the gradient - typedef aggregate<double, double[grid_dim], double> props_nb; + typedef aggregate<double, Point<grid_dim, double>, double> props_nb; typedef vector_dist<grid_dim, double, props_nb> vd_type; Ghost<grid_dim, double> ghost_vd(0); vd_type vd_narrow_band(0, box, bc, ghost_vd); diff --git a/example/Numerics/Sussman_redistancing/example_sussman_images_2D/main.cpp b/example/Numerics/Sussman_redistancing/example_sussman_images_2D/main.cpp index 70668cee7273fe42abc0272232813a798dd1e025..9a2b1507640e0f9f2e79768122c4673c8c85d46b 100644 --- a/example/Numerics/Sussman_redistancing/example_sussman_images_2D/main.cpp +++ b/example/Numerics/Sussman_redistancing/example_sussman_images_2D/main.cpp @@ -221,12 +221,12 @@ int main(int argc, char* argv[]) /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get narrow band: Place particles on interface (narrow band width e.g. 2 grid points on each side of the interface) - size_t bc[grid_dim] = {PERIODIC, PERIODIC}; + size_t bc[grid_dim] = {NON_PERIODIC, NON_PERIODIC}; // Create an empty vector to which narrow-band particles will be added. You can choose, how many properties you want. // Minimum is 1 property, to which the Phi_SDF can be written // In this example we chose 3 properties. The 1st for the Phi_SDF, the 2nd for the gradient of phi and the 3rd for // the magnitude of the gradient - typedef aggregate<double, double[grid_dim], double> props_nb; + typedef aggregate<double, Point<grid_dim, double>, double> props_nb; typedef vector_dist<grid_dim, double, props_nb> vd_type; Ghost<grid_dim, double> ghost_vd(0); vd_type vd_narrow_band(0, box, bc, ghost_vd); diff --git a/example/Numerics/Sussman_redistancing/example_sussman_images_3D/main.cpp b/example/Numerics/Sussman_redistancing/example_sussman_images_3D/main.cpp index fcd1cbdd1aefa4fab0c24cdcb76b14b382948364..6dcdb680f255474892a31f10a9b9aaa3053a6a7e 100644 --- a/example/Numerics/Sussman_redistancing/example_sussman_images_3D/main.cpp +++ b/example/Numerics/Sussman_redistancing/example_sussman_images_3D/main.cpp @@ -217,12 +217,12 @@ int main(int argc, char* argv[]) /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get narrow band: Place particles on interface (narrow band width e.g. 2 grid points on each side of the interface) - size_t bc[grid_dim] = {PERIODIC, PERIODIC, PERIODIC}; + size_t bc[grid_dim] = {NON_PERIODIC, NON_PERIODIC, NON_PERIODIC}; // Create an empty vector to which narrow-band particles will be added. You can choose, how many properties you want. // Minimum is 1 property, to which the Phi_SDF can be written // In this example we chose 3 properties. The 1st for the Phi_SDF, the 2nd for the gradient of phi and the 3rd for // the magnitude of the gradient - typedef aggregate<double, double[grid_dim], double> props_nb; + typedef aggregate<double, Point<grid_dim, double>, double> props_nb; typedef vector_dist<grid_dim, double, props_nb> vd_type; Ghost<grid_dim, double> ghost_vd(0); vd_type vd_narrow_band(0, box, bc, ghost_vd); diff --git a/example/Numerics/Sussman_redistancing/example_sussman_sphere/main.cpp b/example/Numerics/Sussman_redistancing/example_sussman_sphere/main.cpp index 392f9dc36abd5b3e5d690bd90ff40186d7381c61..9be98523cddb14230ec731c5ee6817b043e30810 100644 --- a/example/Numerics/Sussman_redistancing/example_sussman_sphere/main.cpp +++ b/example/Numerics/Sussman_redistancing/example_sussman_sphere/main.cpp @@ -277,12 +277,12 @@ int main(int argc, char* argv[]) */ //! @cond [Initialize narrow band] @endcond // Get narrow band: Place particles on interface (narrow band width e.g. 2 grid points on each side of the interface) - size_t bc[grid_dim] = {PERIODIC, PERIODIC, PERIODIC}; + size_t bc[grid_dim] = {NON_PERIODIC, NON_PERIODIC, NON_PERIODIC}; // Create an empty vector to which narrow-band particles will be added. You can choose, how many properties you want. // Minimum is 1 property, to which the Phi_SDF can be written // In this example we chose 3 properties. The 1st for the Phi_SDF, the 2nd for the gradient of phi and the 3rd for // the magnitude of the gradient - typedef aggregate<double, double[grid_dim], double> props_nb; + typedef aggregate<double, Point<grid_dim, double>, double> props_nb; typedef vector_dist<grid_dim, double, props_nb> vd_type; Ghost<grid_dim, double> ghost_vd(0); vd_type vd_narrow_band(0, box, bc, ghost_vd); diff --git a/gdbgui b/gdbgui index d39f0e88c48e33fc3fc5aa9f98171d4eae4914cb..c8048e7898e3a20d1ad1749d82d750e743247d8a 160000 --- a/gdbgui +++ b/gdbgui @@ -1 +1 @@ -Subproject commit d39f0e88c48e33fc3fc5aa9f98171d4eae4914cb +Subproject commit c8048e7898e3a20d1ad1749d82d750e743247d8a diff --git a/install b/install index fff9a319fedad10cbe57393abada4183b8ca4b91..8906ba02502ecdfa7347c03bada6d4a301f1abba 100755 --- a/install +++ b/install @@ -296,6 +296,9 @@ configure_options=" $configure_options --with-parmetis=$i_dir/PARMETIS " ./script/install_Metis.sh $i_dir $CC $CXX $ncore configure_options=" $configure_options --with-metis=$i_dir/METIS " +./script/install_blitz_algoim.sh $i_dir $ncore +configure_options=" $configure_options --with-blitz=$i_dir/BLITZ --with-algoim=$i_dir/ALGOIM " + if [ x"$gpu_support" == x"1" ]; then configure_options=" $configure_options --enable-gpu " fi @@ -432,7 +435,7 @@ elif [ -d "$i_dir/HDF5/lib64" ]; then hdf5_lib_dir=-L$i_dir/HDF5/lib64 fi -echo "INCLUDE_PATH=$mpi_include_dirs $cuda_include_dirs -Wno-deprecated-declarations $openmp_flags -I. -I$install_base/openfpm_numerics/include -I$install_base/openfpm_pdata/include/config -I$install_base/openfpm_pdata/include -I$install_base/openfpm_data/include -I$install_base/openfpm_vcluster/include -I$install_base/openfpm_io/include -I$install_base/openfpm_devices/include -I$i_dir/VCDEVEL/include -I$i_dir/METIS/include -I$i_dir/PARMETIS/include -I$i_dir/BOOST/include -I$i_dir/HDF5/include -I$i_dir/LIBHILBERT/include $lin_alg_inc" > example.mk +echo "INCLUDE_PATH=$mpi_include_dirs $cuda_include_dirs -Wno-deprecated-declarations $openmp_flags -I. -I$install_base/openfpm_numerics/include -I$install_base/openfpm_pdata/include/config -I$install_base/openfpm_pdata/include -I$install_base/openfpm_data/include -I$install_base/openfpm_vcluster/include -I$install_base/openfpm_io/include -I$install_base/openfpm_devices/include -I$i_dir/VCDEVEL/include -I$i_dir/METIS/include -I$i_dir/PARMETIS/include -I$i_dir/BOOST/include -I$i_dir/HDF5/include -I$i_dir/LIBHILBERT/include $lin_alg_inc -I$i_dir/BLITZ/include -I$i_dir/ALGOIM/include" > example.mk echo "LIBS_PATH=$mpi_libs $openmp_flags -L$install_base/openfpm_devices/lib -L$install_base/openfpm_pdata/lib -L$install_base/openfpm_vcluster/lib -L$i_dir/VCDEVEL/lib -L$i_dir/METIS/lib -L$i_dir/PARMETIS/lib -L$i_dir/BOOST/lib $hdf5_lib_dir -L$i_dir/LIBHILBERT/lib $lin_alg_dir " >> example.mk if [ x"$cuda_on_cpu" == x"YES" ]; then echo "CUDA_ON_CPU=YES" >> example.mk @@ -444,7 +447,7 @@ else echo "LIBS=-lvcluster -lofpm_pdata -lofpmmemory -lparmetis -lmetis -lboost_iostreams -lboost_program_options -lhdf5 -llibhilbert -lVc $lin_alg_lib -ldl -lboost_filesystem -lboost_system $optional_boost" >> example.mk echo "LIBS_CUDA_ON_CPU=\$(LIBS)" >> example.mk fi -echo "INCLUDE_PATH_NVCC=-Xcompiler="-Wno-deprecated-declarations" $(cat openmp_flags) "$(cat cuda_options)" $mpi_include_dirs -I. -I$install_base/openfpm_numerics/include -I$install_base/openfpm_pdata/include/config -I$install_base/openfpm_pdata/include -I$install_base/openfpm_data/include -I$install_base/openfpm_vcluster/include -I$install_base/openfpm_io/include -I$install_base/openfpm_devices/include -I$i_dir/METIS/include -I$i_dir/PARMETIS/include -I$i_dir/BOOST/include -I$i_dir/HDF5/include -I$i_dir/LIBHILBERT/include $lin_alg_inc" >> example.mk +echo "INCLUDE_PATH_NVCC=-Xcompiler="-Wno-deprecated-declarations" $(cat openmp_flags) "$(cat cuda_options)" $mpi_include_dirs -I. -I$install_base/openfpm_numerics/include -I$install_base/openfpm_pdata/include/config -I$install_base/openfpm_pdata/include -I$install_base/openfpm_data/include -I$install_base/openfpm_vcluster/include -I$install_base/openfpm_io/include -I$install_base/openfpm_devices/include -I$i_dir/METIS/include -I$i_dir/PARMETIS/include -I$i_dir/BOOST/include -I$i_dir/HDF5/include -I$i_dir/LIBHILBERT/include $lin_alg_inc -I$i_dir/BLITZ/include -I$i_dir/ALGOIM/include" >> example.mk cp example.mk src/example.mk cp example.mk example/example.mk diff --git a/install_CMAKE_on_CI.sh b/install_CMAKE_on_CI.sh new file mode 100755 index 0000000000000000000000000000000000000000..d7492ad4088d8737727f255b2b042c06f6edd4a1 --- /dev/null +++ b/install_CMAKE_on_CI.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -d "$1/CMAKE" ]; then + exit 0 +fi + +wget https://github.com/Kitware/CMake/releases/download/v3.20.3/cmake-3.20.3.tar.gz +tar -xvf cmake-3.20.3.tar.gz +cd cmake-3.20.3 + +./bootstrap --prefix=$1/CMAKE +make +make install + + diff --git a/openfpm_devices b/openfpm_devices index a7c955b6720dd482b2d2258b27dd4e6148230792..6a738ece9395c7dafbbf6ac244ac4ac99bf3ed64 160000 --- a/openfpm_devices +++ b/openfpm_devices @@ -1 +1 @@ -Subproject commit a7c955b6720dd482b2d2258b27dd4e6148230792 +Subproject commit 6a738ece9395c7dafbbf6ac244ac4ac99bf3ed64 diff --git a/openfpm_numerics b/openfpm_numerics index 37eb4384468136835a32494cadd400c11d107da3..06df0da8d4d75b95d253eba94d9ad3f205de92de 160000 --- a/openfpm_numerics +++ b/openfpm_numerics @@ -1 +1 @@ -Subproject commit 37eb4384468136835a32494cadd400c11d107da3 +Subproject commit 06df0da8d4d75b95d253eba94d9ad3f205de92de diff --git a/openfpm_vcluster b/openfpm_vcluster index ef0c9e82108bea9aae0e95741c66ec8e12fec119..0f8c74a1964e42e9092ee084e79051288d313469 160000 --- a/openfpm_vcluster +++ b/openfpm_vcluster @@ -1 +1 @@ -Subproject commit ef0c9e82108bea9aae0e95741c66ec8e12fec119 +Subproject commit 0f8c74a1964e42e9092ee084e79051288d313469 diff --git a/script/install_blitz_algoim.sh b/script/install_blitz_algoim.sh new file mode 100755 index 0000000000000000000000000000000000000000..9d98002e9addf2c50dfcb3eb80625e12c57bc6a7 --- /dev/null +++ b/script/install_blitz_algoim.sh @@ -0,0 +1,48 @@ +#! /bin/bash + +source script/discover_os +discover_os + +# check if the directory $1/BLITZ exist + +if [ -d "$1/BLITZ" ]; then + echo "BLITZ is already installed" +else + ## Remove old download + rm blitz-1.0.2.tar.gz + rm -rf blitz-1.0.2.tar.gz + wget https://github.com/blitzpp/blitz/archive/refs/tags/1.0.2.tar.gz -O blitz-1.0.2.tar.gz + tar -xf blitz-1.0.2.tar.gz + cd blitz-1.0.2 + + BUILDDIR=build + mkdir -p $BUILDDIR + cd $BUILDDIR + echo "cmake ../. -DCMAKE_INSTALL_PREFIX=$1/BLITZ" + cmake ../. -DCMAKE_INSTALL_PREFIX=$1/BLITZ + make -j $2 + make install + + # Mark the installation + echo 1 > $1/BLITZ/version +fi + +## Algoim installation + + + + +if [ -d "$1/ALGOIM" ]; then + echo "ALGOIM is already installed" +else + + ## Remove old download + rm algoim.tar.gz + rm -rf algoim.tar.gz + wget http://ppmcore.mpi-cbg.de/upload/algoim.tar.gz + tar -xf algoim.tar.gz + mv algoim $1/ALGOIM + mv $1/ALGOIM/src $1/ALGOIM/include + # Mark the installation + echo 1 > $1/ALGOIM/version +fi diff --git a/src/Grid/grid_dist_id.hpp b/src/Grid/grid_dist_id.hpp index efa4a81557ff2396372fef3fbe514c949c01610d..8d4965bd29b1626140afd1cae55cedc4bce99f64 100644 --- a/src/Grid/grid_dist_id.hpp +++ b/src/Grid/grid_dist_id.hpp @@ -2283,7 +2283,7 @@ public: for (int i = 0 ; i < dim ; i++) { - p.get(i) = (gdb_ext.get(v1.getSub()).origin.get(i) + v1.getKeyRef().get(i)) * this->spacing(i); + p.get(i) = (gdb_ext.get(v1.getSub()).origin.get(i) + v1.getKeyRef().get(i)) * this->spacing(i) + domain.getLow(i); } return p; diff --git a/src/Grid/tests/grid_dist_id_unit_test.cpp b/src/Grid/tests/grid_dist_id_unit_test.cpp index a6d4061e0c2be72e30cb247cf2c761c23f508915..a13d79a3494da2fc565349fc14c921441bbbf807 100644 --- a/src/Grid/tests/grid_dist_id_unit_test.cpp +++ b/src/Grid/tests/grid_dist_id_unit_test.cpp @@ -94,6 +94,48 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_domain_grid_unit_converter3D_test) v_cl.execute(); BOOST_REQUIRE_EQUAL(vol,sz[0]*sz[1]*sz[2]); + + // Check getPos + + auto it = g_dist.getDomainIterator(); + + if (it.isNext()) + { + auto key = it.get(); + auto gkey = it.getGKey(key); + + auto pos = g_dist.getPos(key); + + if (gkey.get(0) == 0 && gkey.get(1) == 0 && gkey.get(2) == 0) + { + BOOST_REQUIRE_CLOSE(pos.get(0),-0.3f,0.0001); + BOOST_REQUIRE_CLOSE(pos.get(1),-0.3f,0.0001); + BOOST_REQUIRE_CLOSE(pos.get(2),-0.3f,0.0001); + } + } + + int check = 0; + + while (it.isNext()) + { + auto key2 = it.get(); + + auto pos = g_dist.getPos(key2); + + if (pos[0] >= 0.99999 && pos[0] <= 1.00001 && + pos[1] >= 0.99999 && pos[1] <= 1.00001 && + pos[2] >= 0.99999 && pos[2] <= 1.00001) + { + check = 1; + } + + ++it; + } + + v_cl.max(check); + v_cl.execute(); + + BOOST_REQUIRE_EQUAL(check,1); } } diff --git a/src/Vector/vector_dist_subset.hpp b/src/Vector/vector_dist_subset.hpp index f1cfc2094b16c7211de252a7f84008ebf0792c87..0dd514717ba6664291c4785a51e0f517ffbf9cfa 100644 --- a/src/Vector/vector_dist_subset.hpp +++ b/src/Vector/vector_dist_subset.hpp @@ -17,6 +17,8 @@ class vector_dist_ws : public vector_dist<dim,St,typename AggregateAppend<int,pr { public: + typedef prop value_type; + using vector_dist<dim,St,typename AggregateAppend<int,prop>::type,Decomposition,Memory,layout_base>::vector_dist; typedef boost::mpl::int_<AggregateAppend<int,prop>::type::max_prop-1> flag_prop; @@ -116,7 +118,7 @@ public: vector_dist_subset(vector_dist_ws<dim,St,prop,Decomposition,Memory,layout_base> & vd, int sub_id) - :vd(vd),pid(pid),sub_id(sub_id) + :vd(vd),sub_id(sub_id) { #ifdef SE_CLASS1 subsetUpdate_ctr=vd.getMapCtr();