Skip to content

Commit

Permalink
fix crucial if-else bug
Browse files Browse the repository at this point in the history
  • Loading branch information
multitalentloes committed Oct 23, 2024
1 parent e672209 commit 5ac078a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions opm/simulators/linalg/gpuistl/OpmGpuILU0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ OpmGpuILU0<M, X, Y, l>::OpmGpuILU0(const M& A, bool splitMatrix, bool tuneKernel
m_cpuMatrix, m_reorderedToNatural);
}

if (!m_mixedPrecisionScheme == MixedPrecisionScheme::DEFAULT){
if (m_mixedPrecisionScheme != MixedPrecisionScheme::DEFAULT){
OPM_ERROR_IF(!m_splitMatrix, "Mixed precision GpuILU0 is currently only supported when using split_matrix=true");

// initialize mixed precision datastructures
m_gpuMatrixReorderedLowerFloat = std::make_unique<FloatMat>(m_gpuMatrixReorderedLower->getRowIndices(), m_gpuMatrixReorderedLower->getColumnIndices(), blocksize_);
m_gpuMatrixReorderedUpperFloat = std::make_unique<FloatMat>(m_gpuMatrixReorderedUpper->getRowIndices(), m_gpuMatrixReorderedUpper->getColumnIndices(), blocksize_);
// The MixedPrecisionScheme::STORE_ONLY_FACTORIZED_DIAGONAL_AS_DOUBLE does not need to allocate this float vector
if (m_mixedPrecisionScheme == MixedPrecisionScheme::STORE_ENTIRE_FACTORIZATION_AS_FLOAT) {
printf("now using m_gpuMatrixReorderedDiagFloat\n");
m_gpuMatrixReorderedDiagFloat.emplace(GpuVector<float>(m_gpuMatrix.N() * m_gpuMatrix.blockSize() * m_gpuMatrix.blockSize()));
}
}
Expand Down Expand Up @@ -190,7 +191,7 @@ OpmGpuILU0<M, X, Y, l>::apply(X& v, const Y& d, int lowerSolveThreadBlockSize, i
v.data(),
upperSolveThreadBlockSize);
}
if (m_mixedPrecisionScheme == MixedPrecisionScheme::STORE_ONLY_FACTORIZED_DIAGONAL_AS_DOUBLE) {
else if (m_mixedPrecisionScheme == MixedPrecisionScheme::STORE_ONLY_FACTORIZED_DIAGONAL_AS_DOUBLE) {
detail::ILU0::solveUpperLevelSetSplit<blocksize_, field_type, float, field_type>(
m_gpuMatrixReorderedUpperFloat->getNonZeroValues().data(),
m_gpuMatrixReorderedUpperFloat->getRowIndices().data(),
Expand Down

0 comments on commit 5ac078a

Please sign in to comment.