From 628785fa700680dadf915b5eb6aed947e493b2c3 Mon Sep 17 00:00:00 2001 From: jakobtorben Date: Fri, 30 May 2025 02:39:07 +0200 Subject: [PATCH] Make updateNonzeroValues method use direct transfer where possible --- opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp | 2 +- opm/simulators/linalg/gpuistl/ISTLSolverGPUISTL.hpp | 2 +- opm/simulators/linalg/gpuistl/SolverAdapter.hpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp b/opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp index fb4326239b..eb90b696a9 100644 --- a/opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp +++ b/opm/simulators/linalg/gpuistl/GpuSeqILU0.cpp @@ -125,7 +125,7 @@ void GpuSeqILU0::update() { if constexpr (is_gpu_matrix_v) { - m_LU.updateNonzeroValues(detail::makeMatrixWithNonzeroDiagonal(m_underlyingMatrix)); + m_LU.updateNonzeroValues(detail::makeMatrixWithNonzeroDiagonal(m_underlyingMatrix), true); } else { m_LU.updateNonzeroValues(m_underlyingMatrix); } diff --git a/opm/simulators/linalg/gpuistl/ISTLSolverGPUISTL.hpp b/opm/simulators/linalg/gpuistl/ISTLSolverGPUISTL.hpp index b536dc19e5..8adef82da4 100644 --- a/opm/simulators/linalg/gpuistl/ISTLSolverGPUISTL.hpp +++ b/opm/simulators/linalg/gpuistl/ISTLSolverGPUISTL.hpp @@ -287,7 +287,7 @@ private: m_gpuSolver = std::make_unique( *m_matrix, parallel, m_propertyTree, pressureIndex, weightsCalculator, m_forceSerial, nullptr); } else { - m_matrix->updateNonzeroValues(M); + m_matrix->updateNonzeroValues(M, true); m_gpuSolver->update(); } } diff --git a/opm/simulators/linalg/gpuistl/SolverAdapter.hpp b/opm/simulators/linalg/gpuistl/SolverAdapter.hpp index 7b9574a524..af523836a7 100644 --- a/opm/simulators/linalg/gpuistl/SolverAdapter.hpp +++ b/opm/simulators/linalg/gpuistl/SolverAdapter.hpp @@ -94,7 +94,7 @@ public: { // TODO: Can we do this without reimplementing the other function? // TODO: [perf] Do we need to update the matrix every time? Probably yes - m_matrix.updateNonzeroValues(m_opOnCPUWithMatrix.getmat()); + m_matrix.updateNonzeroValues(m_opOnCPUWithMatrix.getmat(), true); if (!m_inputBuffer) { m_inputBuffer.reset(new XGPU(b.dim())); @@ -114,7 +114,7 @@ public: virtual void apply(X& x, X& b, Dune::InverseOperatorResult& res) override { // TODO: [perf] Do we need to update the matrix every time? Probably yes - m_matrix.updateNonzeroValues(m_opOnCPUWithMatrix.getmat()); + m_matrix.updateNonzeroValues(m_opOnCPUWithMatrix.getmat(), true); if (!m_inputBuffer) { m_inputBuffer.reset(new XGPU(b.dim()));