mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-11-02 20:30:55 -06:00
HypreUtils: move out of gpuistl
put in new folder/namespace linalg/hypreinterface
This commit is contained in:
1 parent
70e938a414
commit
9be8d7e55e
4 files changed
+12
-12
No files matched your search
@@ -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()
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <opm/simulators/linalg/gpuistl/hypreinterface/HypreErrorHandling.hpp>
|
||||
#include <opm/simulators/linalg/gpuistl/hypreinterface/HypreGpuTransfers.hpp>
|
||||
#include <opm/simulators/linalg/gpuistl/hypreinterface/HypreSetup.hpp>
|
||||
#include <opm/simulators/linalg/gpuistl/hypreinterface/HypreUtils.hpp>
|
||||
#include <opm/simulators/linalg/hypreinterface/HypreUtils.hpp>
|
||||
|
||||
// Fix conflict with Dune's matrixmarket.hh header - HYPRE defines MM_MAX_LINE_LENGTH as macro
|
||||
// but Dune expects it as enum value
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm::gpuistl::HypreInterface
|
||||
namespace Opm::linalg::HypreInterface
|
||||
{
|
||||
/**
|
||||
* @brief Get matrix values from Hypre matrix
|
||||
@@ -399,10 +399,10 @@ void testVectorTransfer(bool use_gpu_backend)
|
||||
template<typename MatrixType>
|
||||
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<Dune::FieldMatrix<double, 1, 1>>;
|
||||
@@ -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<int> 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user