diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index ad147010f2..80a4682e24 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -400,7 +400,6 @@ if(CUDA_FOUND OR hip_FOUND) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg hypreinterface/HypreErrorHandling.hpp) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg hypreinterface/HypreGpuTransfers.hpp) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg hypreinterface/HypreSetup.hpp) - ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg hypreinterface/HypreUtils.hpp) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg PinnedMemoryHolder.hpp) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg GpuPressureTransferPolicy.hpp) ADD_CUDA_OR_HIP_FILE(PUBLIC_HEADER_FILES opm/simulators/linalg detail/gpu_preconditioner_utils.hpp) @@ -1422,6 +1421,7 @@ endif() if(HYPRE_FOUND) list(APPEND PUBLIC_HEADER_FILES opm/simulators/linalg/HyprePreconditioner.hpp + opm/simulators/linalg/hypreinterface/HypreUtils.hpp ) endif() diff --git a/opm/simulators/linalg/gpuistl/HypreInterface.hpp b/opm/simulators/linalg/gpuistl/HypreInterface.hpp index f1eaadf7ae..f1d7dd81fa 100644 --- a/opm/simulators/linalg/gpuistl/HypreInterface.hpp +++ b/opm/simulators/linalg/gpuistl/HypreInterface.hpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include // Fix conflict with Dune's matrixmarket.hh header - HYPRE defines MM_MAX_LINE_LENGTH as macro // but Dune expects it as enum value diff --git a/opm/simulators/linalg/gpuistl/hypreinterface/HypreUtils.hpp b/opm/simulators/linalg/hypreinterface/HypreUtils.hpp similarity index 99% rename from opm/simulators/linalg/gpuistl/hypreinterface/HypreUtils.hpp rename to opm/simulators/linalg/hypreinterface/HypreUtils.hpp index e0f9403022..c7601a9758 100644 --- a/opm/simulators/linalg/gpuistl/hypreinterface/HypreUtils.hpp +++ b/opm/simulators/linalg/hypreinterface/HypreUtils.hpp @@ -34,7 +34,7 @@ #include #include -namespace Opm::gpuistl::HypreInterface +namespace Opm::linalg::HypreInterface { /** * @brief Get matrix values from Hypre matrix diff --git a/tests/HypreTestHelper.hpp b/tests/HypreTestHelper.hpp index 33b5bb3596..8a64b67ff1 100644 --- a/tests/HypreTestHelper.hpp +++ b/tests/HypreTestHelper.hpp @@ -399,10 +399,10 @@ void testVectorTransfer(bool use_gpu_backend) template void testMatrixTransfer(bool use_gpu_backend) { - using namespace Opm::gpuistl; + using namespace Opm::linalg; // Initialize HypreInterface - HypreInterface::initialize(use_gpu_backend); + ::Opm::gpuistl::HypreInterface::initialize(use_gpu_backend); // Create test matrix - start with CPU matrix using CpuMatrix = Dune::BCRSMatrix>; @@ -448,24 +448,24 @@ void testMatrixTransfer(bool use_gpu_backend) // Create HYPRE matrix Dune::Amg::SequentialInformation comm; - auto hypre_matrix = HypreInterface::createMatrix(3, 0, comm); + auto hypre_matrix = ::Opm::gpuistl::HypreInterface::createMatrix(3, 0, comm); // Setup arrays for HypreInterface - HypreInterface::SparsityPattern sparsity_pattern; + ::Opm::gpuistl::HypreInterface::SparsityPattern sparsity_pattern; sparsity_pattern.ncols = ncols; sparsity_pattern.rows = rows; sparsity_pattern.cols = cols; sparsity_pattern.nnz = cols.size(); - HypreInterface::HostArrays host_arrays; + ::Opm::gpuistl::HypreInterface::HostArrays host_arrays; std::vector local_dune_to_local_hypre(3); for (int i = 0; i < 3; ++i) { local_dune_to_local_hypre[i] = i; } bool owner_first = true; - host_arrays.row_indexes = HypreInterface::computeRowIndexes(matrix, ncols, local_dune_to_local_hypre, owner_first); + host_arrays.row_indexes = ::Opm::gpuistl::HypreInterface::computeRowIndexes(matrix, ncols, local_dune_to_local_hypre, owner_first); - HypreInterface::DeviceArrays device_arrays; + ::Opm::gpuistl::HypreInterface::DeviceArrays device_arrays; // Allocate device arrays if using GPU backend if (use_gpu_backend) { @@ -488,7 +488,7 @@ void testMatrixTransfer(bool use_gpu_backend) } // Test matrix update - HypreInterface::updateMatrixValues(matrix, hypre_matrix, sparsity_pattern, host_arrays, device_arrays, use_gpu_backend); + ::Opm::gpuistl::HypreInterface::updateMatrixValues(matrix, hypre_matrix, sparsity_pattern, host_arrays, device_arrays, use_gpu_backend); // Verify values auto values_hypre = HypreInterface::getMatrixValues(hypre_matrix, ncols, rows, cols, use_gpu_backend); @@ -510,7 +510,7 @@ void testMatrixTransfer(bool use_gpu_backend) #endif } - HypreInterface::destroyMatrix(hypre_matrix); + ::Opm::gpuistl::HypreInterface::destroyMatrix(hypre_matrix); } /**