diff --git a/opm/simulators/linalg/cuistl/CuSparseMatrix.cpp b/opm/simulators/linalg/cuistl/CuSparseMatrix.cpp index 30d64cdf1..f478e51d0 100644 --- a/opm/simulators/linalg/cuistl/CuSparseMatrix.cpp +++ b/opm/simulators/linalg/cuistl/CuSparseMatrix.cpp @@ -75,6 +75,9 @@ CuSparseMatrix::CuSparseMatrix(const T* nonZeroElements, , m_matrixDescription(detail::createMatrixDescription()) , m_cusparseHandle(detail::CuSparseHandle::getInstance()) { + if (detail::to_size_t(rowIndices[numberOfRows]) != numberOfNonzeroBlocks) { + OPM_THROW(std::invalid_argument, "Wrong sparsity format. Needs to be CSR compliant. "); + } } template