diff --git a/opm/simulators/linalg/gpuistl/GpuDILU.cpp b/opm/simulators/linalg/gpuistl/GpuDILU.cpp index cb114d8681..d3fa93f292 100644 --- a/opm/simulators/linalg/gpuistl/GpuDILU.cpp +++ b/opm/simulators/linalg/gpuistl/GpuDILU.cpp @@ -83,28 +83,30 @@ GpuDILU::GpuDILU(const typename GpuDILU::GPUMatrix& gpuM OPM_THROW(std::runtime_error, "Reordering is only supported for full precision matrices without matrix splitting."); } - if (m_splitMatrix) { - m_gpuMatrixReorderedDiag = std::make_unique>(blocksize_ * blocksize_ * cpuMatrix.N()); - std::tie(m_gpuMatrixReorderedLower, m_gpuMatrixReorderedUpper) - = detail::extractLowerAndUpperMatrices>(cpuMatrix, - m_reorderedToNatural); - } else { - m_gpuMatrixReordered = detail::createReorderedMatrix>( - cpuMatrix, m_reorderedToNatural); - } - - if (m_mixedPrecisionScheme != MatrixStorageMPScheme::DOUBLE_DIAG_DOUBLE_OFFDIAG) { - if (!m_splitMatrix) { - OPM_THROW(std::runtime_error, "Matrix must be split when storing as float."); + if (m_reorder) { + if (m_splitMatrix) { + m_gpuMatrixReorderedDiag = std::make_unique>(blocksize_ * blocksize_ * cpuMatrix.N()); + std::tie(m_gpuMatrixReorderedLower, m_gpuMatrixReorderedUpper) + = detail::extractLowerAndUpperMatrices>(cpuMatrix, + m_reorderedToNatural); + } else { + m_gpuMatrixReordered = detail::createReorderedMatrix>( + cpuMatrix, m_reorderedToNatural); } - m_gpuMatrixReorderedLowerFloat = std::make_unique( - m_gpuMatrixReorderedLower->getRowIndices(), m_gpuMatrixReorderedLower->getColumnIndices(), blocksize_); - m_gpuMatrixReorderedUpperFloat = std::make_unique( - m_gpuMatrixReorderedUpper->getRowIndices(), m_gpuMatrixReorderedUpper->getColumnIndices(), blocksize_); - if (m_mixedPrecisionScheme == MatrixStorageMPScheme::FLOAT_DIAG_FLOAT_OFFDIAG) { - m_gpuDInvFloat - = std::make_unique(m_gpuMatrix.N() * m_gpuMatrix.blockSize() * m_gpuMatrix.blockSize()); + if (m_mixedPrecisionScheme != MatrixStorageMPScheme::DOUBLE_DIAG_DOUBLE_OFFDIAG) { + if (!m_splitMatrix) { + OPM_THROW(std::runtime_error, "Matrix must be split when storing as float."); + } + m_gpuMatrixReorderedLowerFloat = std::make_unique( + m_gpuMatrixReorderedLower->getRowIndices(), m_gpuMatrixReorderedLower->getColumnIndices(), blocksize_); + m_gpuMatrixReorderedUpperFloat = std::make_unique( + m_gpuMatrixReorderedUpper->getRowIndices(), m_gpuMatrixReorderedUpper->getColumnIndices(), blocksize_); + + if (m_mixedPrecisionScheme == MatrixStorageMPScheme::FLOAT_DIAG_FLOAT_OFFDIAG) { + m_gpuDInvFloat + = std::make_unique(m_gpuMatrix.N() * m_gpuMatrix.blockSize() * m_gpuMatrix.blockSize()); + } } }