diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c17bcb16955bef021402290af06bd44677e9799..dc9e3d003f016c03694a83f0766517a18708aaa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to this project will be documented in this file. +## [4.1.0] (Codename Thesis) +- On a general base the code should not use CUDA_ON_CPU but if it does CUDA_ON_CPU macro now cover both SEQUENTIAL and OpenMP backend. The macros CUDIFY_USE_CUDA,CUDIFY_USE_HIP,CUDIFY_USE_OPENMP,CUDIFY_USE_SEQUENTIAL,CUDIFY_USE_NONE can be checked to control which CUDA backend is used + +### Fixed +- Minors bug + ## [4.0.0] September 2021 (Codename Heisenberg) - Adding DCPSE, Level-set based numerics (Closest-point) diff --git a/CMakeLists.txt b/CMakeLists.txt index e24e7b719f27c4421ab4ab179aa074cca6227ea2..b84176689a16400607dab98cace5868d796a854a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,22 +39,17 @@ set(METIS_DIR ${METIS_ROOT}) set(PARMETIS_DIR ${PARMETIS_ROOT}) set(OPENBLAS_ROOT CACHE PATH "Root path for blas library") set(SuiteSparse_ROOT ${SUITESPARSE_ROOT}) -set(CUDA_ON_CPU CACHE BOOL "Make Cuda work on heap") set(CPACK_RUN_INSTALL_DEPENDENCIES CACHE BOOL "Set to true if we are creating deb or RPM packages") set(ENABLE_GARBAGE_INJECTOR CACHE BOOL "Enable the injector of garbage in the memory allocator") set(ENABLE_VCLUSTER_GARBAGE_INJECTOR CACHE BOOL "Enable the injector of garbage in the vcluster memory buffers") set(HIP_ENABLE CACHE BOOL "Enable HIP compiler") set(AMD_ARCH_COMPILE "gfx900" CACHE STRING "AMD gpu architecture used to compile kernels") -# Enabling real GPU is stronger than using CUDA_ON_CPU -if (ENABLE_GPU) - set(CUDA_ON_CPU OFF) - # Test CLang - if (NOT HIP_ENABLE) - find_package(CUDA) - set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT ${CUDA_TOOLKIT_ROOT_DIR}) - enable_language(CUDA) - endif() +add_subdirectory (openfpm_io) + +if (CUDA_ON_BACKEND STREQUAL "CUDA") + enable_language(CUDA) + find_package(CUDA) endif() set (CMAKE_CXX_STANDARD 14) @@ -168,6 +163,10 @@ else() message( FATAL_ERROR "ParMetis is required in order to install OpenFPM") endif() +if (OPENMP_FOUND) + set(DEFINE_HAVE_OPENMP "#define HAVE_OPENMP") +endif() + if(MPI_FOUND) get_filename_component(OPENFPM_MPI_DEP "${MPI_C_INCLUDE_DIRS}" DIRECTORY) @@ -180,32 +179,17 @@ else() endif() if (Boost_FOUND) - set(DEFINE_HAVE_BOOST "#define HAVE_BOOST") - set(DEFINE_HAVE_BOOST_IOSTREAMS "#define HAVE_BOOST_IOSTREAMS") - set(DEFINE_HAVE_BOOST_PROGRAM_OPTIONS "#define HAVE_BOOST_PROGRAM_OPTIONS") - set(DEFINE_HAVE_BOOST_UNIT_TEST_FRAMEWORK "#define HAVE_BOOST_UNIT_TEST_FRAMEWORK") - if (Boost_CONTEXT_FOUND) - set(DEFINE_HAVE_BOOST_CONTEXT "#define HAVE_BOOST_CONTEXT") - set(OPTIONAL_BOOST_LIBS "-lboost_context") - else() - #if context is not there CUDA_ON_CPU cannot be activated - set(CUDA_ON_CPU OFF) - endif() - if (Boost_FIBER_FOUND) - set(DEFINE_HAVE_BOOST_FIBER "#define HAVE_BOOST_FIBER") - string(CONCAT OPTIONAL_BOOST_LIBS ${OPTIONAL_BOOST_LIBS} " -lboost_fiber") - endif() file(WRITE optional_boost_libs "${OPTIONAL_BOOST_LIBS}") else() file(WRITE error_code "202") message( FATAL_ERROR "BOOST is required in order to install OpenFPM" ) endif() -if(ENABLE_GPU AND CUDA_FOUND) - set(DEFINE_CUDA_GPU "#define CUDA_GPU") +if (OPENMP_FOUND) + file(WRITE openmp_flags ${OpenMP_CXX_FLAGS}) endif() -if(CUDA_ON_CPU) +if(ENABLE_GPU AND CUDA_FOUND) set(DEFINE_CUDA_GPU "#define CUDA_GPU") endif() @@ -264,8 +248,8 @@ endif() file(WRITE error_code "0") file(WRITE cuda_lib "${CUDA_cudart_static_LIBRARY} ${CUDA_cudadevrt_LIBRARY}") -if(CUDA_ON_CPU) - file(WRITE cuda_include "-I${CUDA_INCLUDE_DIRS} -D__NVCC__ -DCUDART_VERSION=11000 -DCUDA_ON_CPU") +if(CUDA_ON_BACKEND STREQUAL "SEQUENTIAL" OR CUDA_ON_BACKEND STREQUAL "OpenMP") + file(WRITE cuda_include "-I${CUDA_INCLUDE_DIRS} -D__NVCC__ -DCUDART_VERSION=11000") file(WRITE cuda_on_cpu "YES") else() file(WRITE cuda_include "-I${CUDA_INCLUDE_DIRS}") @@ -276,7 +260,6 @@ file(WRITE mpi_libs "${MPI_C_LINK_FLAGS} ${MPI_C_LIBRARIES}") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config/config_cmake.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config/config.h) -add_subdirectory (openfpm_io) add_subdirectory (openfpm_numerics) file(WRITE cuda_options "${WARNING_SUPPRESSION_AND_OPTION_NVCC_TEXT}") diff --git a/build.sh b/build.sh index 1ded29927353de9bb87bf4073f7c7f5b034782d2..3b7ff26e8b0435a2d68bf31f4dd7876f2456f042 100755 --- a/build.sh +++ b/build.sh @@ -26,6 +26,7 @@ if [ x"$hostname" == x"cifarm-centos-node.mpi-cbg.de" ]; then 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" + foward_options="--with-cuda-on-backend=OpenMP" fi if [ x"$hostname" == x"cifarm-ubuntu-node" ]; then @@ -33,12 +34,13 @@ 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" + foward_options="--with-cuda-on-backend=OpenMP" fi if [ x"$hostname" == x"cifarm-mac-node.mpi-cbg.de" ]; then echo "Mac node" export PATH="/usr/local/bin:$PATH" + foward_options="--with-cuda-on-backend=SEQUENTIAL" # rm -rf /Users/admin/openfpm_dependencies/openfpm_pdata/$branch/ # rm -rf $HOME/openfpm_dependencies/openfpm_pdata/$branch/PETSC #./install_CMAKE_on_CI.sh $HOME/openfpm_dependencies/openfpm_pdata/$branch/ diff --git a/configure b/configure index 9fe5ac8164d0789b63283fe3e942c1626aa6f0fe..29474677fd8291e1521bd90ee5887a112929ccfe 100755 --- a/configure +++ b/configure @@ -100,6 +100,7 @@ enable_debug with_metis with_hdf5 with_libhilbert +with_cuda_on_backend enable_cuda_on_cpu enable_scan_coverty enable_test_performance @@ -108,8 +109,6 @@ with_parmetis enable_se_class1 enable_se_class2 enable_se_class3 -with_blitz -with_algoim with_alpaka with_action_on_error with_boost @@ -124,7 +123,6 @@ with_petsc with_eigen with_vcdevel enable_gpu -enable_hip enable_asan enable_garbageinj enable_garbageinjv @@ -245,13 +243,17 @@ do conf_options="$conf_options -DSCAN_COVERTY=ON" ;; cuda_on_cpu) - conf_options="$conf_options -DCUDA_ON_CPU=ON" + conf_options="$conf_options -DCUDA_ON_BACKEND=SEQUENTIAL" ;; test_performance) conf_options="$conf_options -DTEST_PERFORMANCE=ON" ;; gpu) - conf_options="$conf_options -DCMAKE_CUDA_HOST_COMPILER=$(which mpic++) " + if [ x"$CXX" == x"" ]; then + conf_options="$conf_options" + else + conf_options="$conf_options -DCMAKE_CUDA_HOST_COMPILER=$(which $CXX)" + fi if [ x"$CXXCUDA" == x"" ]; then conf_options="$conf_options" else @@ -259,10 +261,6 @@ do fi conf_options="$conf_options -DENABLE_GPU=ON" ;; - hip) - conf_options="$conf_options -DHIP_ENABLE=ON -DENABLE_GPU=ON" - enable_hip_conf=1 - ;; asan) conf_options="$conf_options -DENABLE_ASAN=ON" ;; @@ -477,6 +475,9 @@ do ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_useropt in + cuda_on_backend) + conf_options="$conf_options -DCUDA_ON_BACKEND=$ac_optarg" + ;; libhilbert) conf_options="$conf_options -DLIBHILBERT_ROOT=$ac_optarg" ;; @@ -514,12 +515,6 @@ 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" ;; @@ -594,10 +589,6 @@ fi cd build ## remove enerything -if [ x"$enable_hip_conf" != x"1" ]; then - conf_options="$conf_options -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpic++" -fi - echo "Calling cmake ../. $conf_options" printf "cmake ../. $conf_options" > cmake_build_options rm ../error_code diff --git a/example/Numerics/OdeInt/Makefile b/example/Numerics/OdeInt/Makefile index 49784aa93f9eb62a4f0fa3fb77ccffb40999513e..6f7eb526c4fba5204d2a60a76d6fe0e6cb20c5be 100644 --- a/example/Numerics/OdeInt/Makefile +++ b/example/Numerics/OdeInt/Makefile @@ -8,7 +8,7 @@ OBJ = main.o OBJ2 = main2.o %.o: %.cpp - $(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH) + $(CC) -O3 -c --std=c++14 -o $@ $< $(INCLUDE_PATH) example_odeint: $(OBJ) $(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS) diff --git a/example/SparseGrid/1_gray_scott_3d_sparse_gpu/Makefile b/example/SparseGrid/1_gray_scott_3d_sparse_gpu/Makefile index d815f8d56145b1bbe9bb064359549e4943477684..584d57a653262a160ca02024efb45045d9fbce5c 100644 --- a/example/SparseGrid/1_gray_scott_3d_sparse_gpu/Makefile +++ b/example/SparseGrid/1_gray_scott_3d_sparse_gpu/Makefile @@ -8,7 +8,7 @@ ifdef CUDA_ON_CPU INCLUDE_PATH_NVCC= CUDA_CC_LINK=mpic++ CUDA_OPTIONS=-DCUDA_ON_CPU -D__NVCC__ -DCUDART_VERSION=11000 - LIBS_SELECT=$(LIBS_CUDA_ON_CPU) + LIBS_SELECT=$(LIBS) else ifeq (, $(shell which nvcc)) CUDA_CC=mpic++ -x c++ $(INCLUDE_PATH) diff --git a/example/SparseGrid/2_gray_scott_3d_sparse_gpu_opt/Makefile b/example/SparseGrid/2_gray_scott_3d_sparse_gpu_opt/Makefile index 7c80e2810f9bc30ccf4df3c880e5d1a58876fca8..7e018d4c11fc04934f50cc6208ebd60e6aaed81f 100644 --- a/example/SparseGrid/2_gray_scott_3d_sparse_gpu_opt/Makefile +++ b/example/SparseGrid/2_gray_scott_3d_sparse_gpu_opt/Makefile @@ -8,7 +8,7 @@ ifdef CUDA_ON_CPU INCLUDE_PATH_NVCC= CUDA_CC_LINK=mpic++ CUDA_OPTIONS=-DCUDA_ON_CPU -D__NVCC__ -DCUDART_VERSION=11000 - LIBS_SELECT=$(LIBS_CUDA_ON_CPU) + LIBS_SELECT=$(LIBS) else ifeq (, $(shell which nvcc)) CUDA_CC=mpic++ -x c++ $(INCLUDE_PATH) diff --git a/example/SparseGrid/3_gray_scott_3d_sparse_gpu_cs_opt/Makefile b/example/SparseGrid/3_gray_scott_3d_sparse_gpu_cs_opt/Makefile index 15133370060405ef2c77e59de99de4d9ecd6eac5..8cb8a8b165b74e1c2813267715a7dfbc9869e8b7 100644 --- a/example/SparseGrid/3_gray_scott_3d_sparse_gpu_cs_opt/Makefile +++ b/example/SparseGrid/3_gray_scott_3d_sparse_gpu_cs_opt/Makefile @@ -9,7 +9,7 @@ ifdef CUDA_ON_CPU INCLUDE_PATH_NVCC= CUDA_CC_LINK=mpic++ CUDA_OPTIONS=-DCUDA_ON_CPU -D__NVCC__ -DCUDART_VERSION=11000 - LIBS_SELECT=$(LIBS_CUDA_ON_CPU) + LIBS_SELECT=$(LIBS) else ifeq (, $(shell which nvcc)) CUDA_CC=mpic++ -x c++ $(INCLUDE_PATH) diff --git a/example/SparseGrid/4_gray_scott_3d_sparse_surface_cs/Makefile b/example/SparseGrid/4_gray_scott_3d_sparse_surface_cs/Makefile index 6239057a8dd94a2061672be96d85a91cb426ea7d..6f7669c147c66ceefe7dfd51d05a37133d333873 100644 --- a/example/SparseGrid/4_gray_scott_3d_sparse_surface_cs/Makefile +++ b/example/SparseGrid/4_gray_scott_3d_sparse_surface_cs/Makefile @@ -9,7 +9,7 @@ gray_scott_sparse_cs_surface: OPT += -DTEST_RUN gray_scott_sparse_cs_surface: gray_scott_sparse_surface_cs %.o: %.cpp - $(CC) -O3 -g $(OPT) -c --std=c++11 -o $@ $< $(INCLUDE_PATH) + $(CC) -O3 -g $(OPT) -c --std=c++14 -o $@ $< $(INCLUDE_PATH) gray_scott_sparse_surface_cs: $(OBJ) $(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS) diff --git a/example/SparseGrid/7_gray_scott_3d_sparse_gpu_sphere_expanding/Makefile b/example/SparseGrid/7_gray_scott_3d_sparse_gpu_sphere_expanding/Makefile index 15133370060405ef2c77e59de99de4d9ecd6eac5..8cb8a8b165b74e1c2813267715a7dfbc9869e8b7 100644 --- a/example/SparseGrid/7_gray_scott_3d_sparse_gpu_sphere_expanding/Makefile +++ b/example/SparseGrid/7_gray_scott_3d_sparse_gpu_sphere_expanding/Makefile @@ -9,7 +9,7 @@ ifdef CUDA_ON_CPU INCLUDE_PATH_NVCC= CUDA_CC_LINK=mpic++ CUDA_OPTIONS=-DCUDA_ON_CPU -D__NVCC__ -DCUDART_VERSION=11000 - LIBS_SELECT=$(LIBS_CUDA_ON_CPU) + LIBS_SELECT=$(LIBS) else ifeq (, $(shell which nvcc)) CUDA_CC=mpic++ -x c++ $(INCLUDE_PATH) diff --git a/example/SparseGrid/8_filling_benchmark/Makefile b/example/SparseGrid/8_filling_benchmark/Makefile index 94629ac16d26f46dee525a56e3efa9159628326c..26f3b8401d9f68bcddc697905a274dc62904461c 100644 --- a/example/SparseGrid/8_filling_benchmark/Makefile +++ b/example/SparseGrid/8_filling_benchmark/Makefile @@ -9,7 +9,7 @@ gray_scott_sparse_opt_test: OPT += -DTEST_RUN gray_scott_sparse_opt_test: gray_scott_sparse_opt %.o: %.cpp - $(CC) -mavx -O3 -g $(OPT) -c --std=c++11 -o $@ $< $(INCLUDE_PATH) + $(CC) -mavx -O3 -g $(OPT) -c --std=c++14 -o $@ $< $(INCLUDE_PATH) gray_scott_sparse_opt: $(OBJ) $(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS) diff --git a/example/SparseGrid/8_filling_benchmark_gpu/Makefile b/example/SparseGrid/8_filling_benchmark_gpu/Makefile index c6a4b43bbd6b2846da27e6f3b042aa403d726697..872e123da5369f47a8643425bb40ad2c5936a6b3 100644 --- a/example/SparseGrid/8_filling_benchmark_gpu/Makefile +++ b/example/SparseGrid/8_filling_benchmark_gpu/Makefile @@ -8,7 +8,7 @@ ifdef CUDA_ON_CPU INCLUDE_PATH_NVCC= CUDA_CC_LINK=mpic++ CUDA_OPTIONS=-DCUDA_ON_CPU -D__NVCC__ -DCUDART_VERSION=11000 - LIBS_SELECT=$(LIBS_CUDA_ON_CPU) + LIBS_SELECT=$(LIBS) else ifeq (, $(shell which nvcc)) CUDA_CC=mpic++ -x c++ $(INCLUDE_PATH) 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 cc97a218fbeeccf2c5a19601554dc9a4f8c8dfb6..4e078ee175e20359a51a9c2003d551259e272023 100755 --- a/install +++ b/install @@ -297,7 +297,7 @@ configure_options=" $configure_options --with-parmetis=$i_dir/PARMETIS " configure_options=" $configure_options --with-metis=$i_dir/METIS " if [ x"$gpu_support" == x"1" ]; then - configure_options=" $configure_options --enable-gpu " + configure_options=" $configure_options --with-cuda-on-backend=CUDA" fi MPI_installed=0 diff --git a/openfpm_data b/openfpm_data index 98ea2a2f1d55516f99189ba4c7d10ebfd3186665..e63938e7f2c2a91c62039aed9bee60084df97290 160000 --- a/openfpm_data +++ b/openfpm_data @@ -1 +1 @@ -Subproject commit 98ea2a2f1d55516f99189ba4c7d10ebfd3186665 +Subproject commit e63938e7f2c2a91c62039aed9bee60084df97290 diff --git a/openfpm_devices b/openfpm_devices index 162b8cabf2c0e91a7cb9a4d19e9d6784b26c4661..853f020c131a8ada56a88439b4b1345648dd65db 160000 --- a/openfpm_devices +++ b/openfpm_devices @@ -1 +1 @@ -Subproject commit 162b8cabf2c0e91a7cb9a4d19e9d6784b26c4661 +Subproject commit 853f020c131a8ada56a88439b4b1345648dd65db diff --git a/openfpm_io b/openfpm_io index 49900f22654dff41bd2698a2a1f37ba6b2d05c49..6142d9418c872c2a487e23fcbc57aade3e44fb1e 160000 --- a/openfpm_io +++ b/openfpm_io @@ -1 +1 @@ -Subproject commit 49900f22654dff41bd2698a2a1f37ba6b2d05c49 +Subproject commit 6142d9418c872c2a487e23fcbc57aade3e44fb1e diff --git a/openfpm_numerics b/openfpm_numerics index a6d5855baa64f55bc90d95922f74c88927c141d9..a0073269fa164fba2ca246540d5b9ee29d3659d7 160000 --- a/openfpm_numerics +++ b/openfpm_numerics @@ -1 +1 @@ -Subproject commit a6d5855baa64f55bc90d95922f74c88927c141d9 +Subproject commit a0073269fa164fba2ca246540d5b9ee29d3659d7 diff --git a/openfpm_vcluster b/openfpm_vcluster index 49fe0597f9521146ae907c7f016f20f5326fc1bf..2102684c8d2cbfd71be5bf797ac36954984c35c2 160000 --- a/openfpm_vcluster +++ b/openfpm_vcluster @@ -1 +1 @@ -Subproject commit 49fe0597f9521146ae907c7f016f20f5326fc1bf +Subproject commit 2102684c8d2cbfd71be5bf797ac36954984c35c2 diff --git a/script/help b/script/help index 8ef53c443a0d832020cc14c62d1e0b50b92c0739..71339d236856bca21e07cb0f2755c173fdb1d19b 100755 --- a/script/help +++ b/script/help @@ -7,11 +7,13 @@ function HELP { echo -e " \033[1mOptions:\033[0m" echo -e " \033[1;34m-n\033[0m upgrade openfpm, it upgrades openfpm to the new version" echo -e " \033[1;34m-u\033[0m update openfpm, it updates the current openfpm release with the latest bug fixes" - echo -e " \033[1;34m-g\033[0m enable GPU" + echo -e " \033[1;34m-g\033[0m enable GPU with CUDA backend" echo -e " \033[1;34m-i\033[0m directory Set the directory where to install the required dependencies" echo -e " \033[1;34m-d\033[0m disable installation of requirements" echo -e " \033[1;34m-s\033[0m skip user input" - echo -e " \033[1;34m-c\033[0m foward this options to configure" + echo -e " \033[1;34m-c\033[0m foward this options to configure, possible options:" + echo -e " --prefix=/where/to/install" + echo -e " --with-cuda-on-backend=CUDA,SEQUENTIAL,OpenMP,HIP (equivalent CUDA is equivalent to -g)" echo -e " \033[1;34m-h\033[0m Displays this help message"\\n echo -e " \033[1;34m-m\033[0m Skip compilation"\\n echo -e " \033[1;34m-l\033[0m do not install linear algebra"\\n diff --git a/script/install_BOOST.sh b/script/install_BOOST.sh index 0deb5de824058a09eb16661732b084b36848bdde..d080b347e8710c4caa5098d820ec6b15796827d0 100755 --- a/script/install_BOOST.sh +++ b/script/install_BOOST.sh @@ -1,6 +1,6 @@ #!/bin/bash -source script/discover_os +source discover_os discover_os # check if the directory $1/BOOST exist @@ -35,7 +35,7 @@ if [ x"$platform" == x"osx" ]; then ./b2 -j $2 install --prefix=$1/BOOST address-model=64 architecture=arm abi=aapcs binary-format=mach-o toolset=$3 fi else - ./b2 -j $2 install --prefix=$1/BOOST + ./b2 -j $2 install --prefix=$1/BOOST address-model=64 architecture=x86 abi=sysv binary-format=mach-o toolset=clang fi else ./b2 -j $2 install --prefix=$1/BOOST diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eee5aed20acdc3480b6526182051075b789c9e3e..07b37e322e0f3f027fd625fee14669e9f27c5a9f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,7 +5,7 @@ add_definitions(-DSCAN_WITH_CUB) ########################### Executables -if(CUDA_FOUND OR CUDA_ON_CPU OR HIP_FOUND) +if(NOT CUDA_ON_BACKEND STREQUAL "None") set(CUDA_SOURCES Grid/tests/sgrid_dist_id_gpu_unit_tests.cu Vector/cuda/vector_dist_gpu_MP_tests.cu @@ -21,10 +21,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") add_definitions("-DBOOST_MPL_CFG_HAS_TYPEOF") endif() -if (CUDA_ON_CPU) - add_definitions(-DCUDA_ON_CPU) + +if (CUDA_ON_BACKEND STREQUAL "OpenMP" OR CUDA_ON_BACKEND STREQUAL "SEQUENTIAL") + set_source_files_properties(${CUDA_SOURCES} PROPERTIES COMPILE_FLAGS "-D__NVCC__ -DCUDART_VERSION=11000") set_source_files_properties(${CUDA_SOURCES} PROPERTIES LANGUAGE CXX) - set_source_files_properties(${CUDA_SOURCES} PROPERTIES COMPILE_FLAGS "-D__NVCC__ -DCUDART_VERSION=11000") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel") add_definitions("-x c++") endif() @@ -196,6 +196,9 @@ target_link_libraries(pdata ${MPI_C_LIBRARIES}) target_link_libraries(pdata ${MPI_CXX_LIBRARIES}) target_link_libraries(pdata vcluster) target_link_libraries(pdata ofpmmemory) +if (OpenMP::OpenMP_CXX) + target_link_libraries(pdata OpenMP::OpenMP_CXX) +endif() #target_link_libraries(isolation_pdata ${Boost_LIBRARIES}) #target_link_libraries(isolation_pdata ${PARMETIS_LIBRARIES}) diff --git a/src/Vector/cuda/vector_dist_gpu_unit_tests.cu b/src/Vector/cuda/vector_dist_gpu_unit_tests.cu index 9380e1e72cc5c1ca6b32525735cc374f0d623af7..0dcaed75000e430846baca3b394ee344803ee2c9 100644 --- a/src/Vector/cuda/vector_dist_gpu_unit_tests.cu +++ b/src/Vector/cuda/vector_dist_gpu_unit_tests.cu @@ -1857,6 +1857,10 @@ BOOST_AUTO_TEST_CASE(vector_dist_overflow_se_class1) BOOST_AUTO_TEST_CASE( vector_dist_ghost_put_gpu ) { + +// This example require float atomic, until C++20 we are out of luck +#ifndef CUDIFY_USE_OPENMP + Vcluster<> & v_cl = create_vcluster(); long int k = 25*25*25*create_vcluster().getProcessingUnits(); @@ -2069,6 +2073,8 @@ BOOST_AUTO_TEST_CASE( vector_dist_ghost_put_gpu ) BOOST_REQUIRE_EQUAL(ret,true); } } + +#endif } BOOST_AUTO_TEST_SUITE_END() diff --git a/src/config/config_cmake.h.in b/src/config/config_cmake.h.in index ef3eb90ec3ed96273f9a864c41a8a404171b104e..2637a83154496169f06d34f2864921938c87ac68 100644 --- a/src/config/config_cmake.h.in +++ b/src/config/config_cmake.h.in @@ -4,13 +4,18 @@ ${DEFINE_COVERTY_SCAN} /* GPU support */ ${DEFINE_CUDA_GPU} +/* Define CUDIFY backend */ +${DEFINE_CUDIFY_BACKEND} + +/* OpenMP support */ +${DEFINE_HAVE_OPENMP} + /* HIP GPU support */ ${DEFINE_HIP_GPU} /* HIP Cudify GPU support */ ${DEFINE_CUDIFY_USE_HIP} - /* Debug */ ${DEFINE_DEBUG} /**/ @@ -184,9 +189,6 @@ ${DEFINE_STOP_ON_ERROR} /* Garbage injector*/ ${DEFINE_GARBAGE_INJECTOR} -/* VCluster Garbage injector*/ -${DEFINE_VCLUSTER_GARBAGE_INJECTOR} - /* Test coverage mode */ ${DEFINE_TEST_COVERAGE_MODE}