diff --git a/CMakeLists.txt b/CMakeLists.txt index 67fd95d695..a4ec4e5cce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -732,6 +732,7 @@ if(CUDA_FOUND) if(USE_HIP) set(gpu_label "gpu_hip") endif() + set_tests_properties(cusparse_safe_call cublas_safe_call gpu_safe_call @@ -745,7 +746,6 @@ if(CUDA_FOUND) GpuVector GpuSparseMatrix GpuSeqILU0 - GpuOwnerOverlapCopy solver_adapter GpuBuffer GpuView @@ -757,6 +757,9 @@ if(CUDA_FOUND) is_gpu_pointer throw_macros_on_gpu PROPERTIES LABELS ${gpu_label}) + if(MPI_FOUND) + set_tests_properties(GpuOwnerOverlapCopy PROPERTIES LABELS ${gpu_label}) + endif() endif() if(HYPRE_FOUND) diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 3360f8fa6b..bd4960cbbf 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -317,7 +317,6 @@ if (HAVE_CUDA) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg GpuSeqILU0.hpp) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg detail/fix_zero_diagonal.hpp) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg PreconditionerConvertFieldTypeAdapter.hpp) - ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg GpuOwnerOverlapCopy.hpp) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg SolverAdapter.hpp) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg GpuBlockPreconditioner.hpp) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg PreconditionerHolder.hpp) @@ -325,7 +324,9 @@ if (HAVE_CUDA) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg gpu_smart_pointer.hpp) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg gpu_resources.hpp) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg detail/is_gpu_pointer.hpp) - + if(MPI_FOUND) + ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg GpuOwnerOverlapCopy.hpp) + endif() endif() if(USE_GPU_BRIDGE) @@ -472,7 +473,6 @@ if (HAVE_CUDA) ADD_CUDA_OR_HIP_FILE(TEST_SOURCE_FILES tests test_cuda_check_last_error.cpp) ADD_CUDA_OR_HIP_FILE(TEST_SOURCE_FILES tests test_GpuDILU.cpp) ADD_CUDA_OR_HIP_FILE(TEST_SOURCE_FILES tests test_GpuJac.cpp) - ADD_CUDA_OR_HIP_FILE(TEST_SOURCE_FILES tests test_GpuOwnerOverlapCopy.cpp) ADD_CUDA_OR_HIP_FILE(TEST_SOURCE_FILES tests test_GpuSeqILU0.cpp) ADD_CUDA_OR_HIP_FILE(TEST_SOURCE_FILES tests test_cusparse_handle.cpp) ADD_CUDA_OR_HIP_FILE(TEST_SOURCE_FILES tests test_cuSparse_matrix_operations.cpp) @@ -488,7 +488,9 @@ if (HAVE_CUDA) ADD_CUDA_OR_HIP_FILE(TEST_SOURCE_FILES tests test_gpu_resources.cu) ADD_CUDA_OR_HIP_FILE(TEST_SOURCE_FILES tests test_is_gpu_pointer.cpp) ADD_CUDA_OR_HIP_FILE(TEST_SOURCE_FILES tests test_throw_macros_on_gpu.cu) - + if(MPI_FOUND) + ADD_CUDA_OR_HIP_FILE(TEST_SOURCE_FILES tests test_GpuOwnerOverlapCopy.cpp) + endif() # for loop providing the flag --expt-relaxed-constexpr to fix some cuda issues with constexpr if(NOT CONVERT_CUDA_TO_HIP) diff --git a/opm/simulators/linalg/gpuistl/SolverAdapter.hpp b/opm/simulators/linalg/gpuistl/SolverAdapter.hpp index 0d563db509..1d0fbdc790 100644 --- a/opm/simulators/linalg/gpuistl/SolverAdapter.hpp +++ b/opm/simulators/linalg/gpuistl/SolverAdapter.hpp @@ -19,27 +19,32 @@ #ifndef OPM_SOLVERADAPTER_HPP #define OPM_SOLVERADAPTER_HPP -#include - #include #include #include #include #include + #include + #include -#include #include #include #include #include +#if HAVE_MPI +#include +#endif + #ifdef OPEN_MPI #if OPEN_MPI #include "mpi-ext.h" #endif #endif +#include + namespace Opm::gpuistl { //! @brief Wraps a CUDA solver to work with CPU data. @@ -141,6 +146,7 @@ private: // TODO: Use a std::forward // This is the MPI parallel case (general communication object) +#if HAVE_MPI template UnderlyingSolver constructSolver(std::shared_ptr> prec, scalar_real_type reduction, @@ -223,6 +229,7 @@ private: return UnderlyingSolver( overlappingCudaOperator, scalarProduct, mpiPreconditioner, reduction, maxit, verbose); } +#endif // This is the serial case (specific overload for Dune::Amg::SequentialInformation) UnderlyingSolver constructSolver(std::shared_ptr> prec, @@ -261,6 +268,7 @@ private: std::unique_ptr m_inputBuffer; std::unique_ptr m_outputBuffer; }; + } // namespace Opm::gpuistl #endif