Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/error-handling-sunmatrix…
Browse files Browse the repository at this point in the history
…' into feature/error-handling-sunmatrix
  • Loading branch information
balos1 committed Dec 12, 2023
2 parents b05cb89 + e41456a commit 4f54da8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions doc/shared/sunmatrix/SUNMatrix_MagmaDense.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ implementation specific functions:
**Return value:**
* ``SUN_SUCCESS`` -- if the copy is successful.
* ``SUN_ERR_ARG_INCOMPATIBLE`` -- if either the ``SUNMatrix`` is not a
* ``SUN_ERR_ARG_INCOMPATIBLE`` -- if the ``SUNMatrix`` is not a
``SUNMATRIX_MAGMADENSE`` matrix.
* ``SUN_ERR_MEM_FAIL`` -- if the copy fails.
Expand All @@ -300,7 +300,7 @@ implementation specific functions:
**Return value:**
* ``SUN_SUCCESS`` -- if the copy is successful.
* ``SUN_ERR_ARG_INCOMPATIBLE`` -- if either the ``SUNMatrix`` is not a
* ``SUN_ERR_ARG_INCOMPATIBLE`` -- if the ``SUNMatrix`` is not a
``SUNMATRIX_MAGMADENSE`` matrix.
* ``SUN_ERR_MEM_FAIL`` -- if the copy fails.
Expand Down
4 changes: 2 additions & 2 deletions doc/shared/sunmatrix/SUNMatrix_OneMklDense.rst
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ Copy Data
**Return value:**
* ``SUN_SUCCESS`` -- if the copy is successful.
* ``SUN_ERR_ARG_INCOMPATIBLE`` -- if either the ``SUNMatrix`` is not a
* ``SUN_ERR_ARG_INCOMPATIBLE`` -- if the ``SUNMatrix`` is not a
``SUNMATRIX_ONEMKLDENSE`` matrix.
* ``SUN_ERR_MEM_FAIL`` -- if the copy fails.
Expand All @@ -330,7 +330,7 @@ Copy Data
**Return value:**
* ``SUN_SUCCESS`` -- if the copy is successful.
* ``SUN_ERR_ARG_INCOMPATIBLE`` -- if either the ``SUNMatrix`` is not a
* ``SUN_ERR_ARG_INCOMPATIBLE`` -- if the ``SUNMatrix`` is not a
``SUNMATRIX_ONEMKLDENSE`` matrix.
* ``SUN_ERR_MEM_FAIL`` -- if the copy fails.
Expand Down
4 changes: 2 additions & 2 deletions include/sunmatrix/sunmatrix_cusparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ SUNDIALS_EXPORT int* SUNMatrix_cuSparse_IndexPointers(SUNMatrix A);
SUNDIALS_EXPORT int* SUNMatrix_cuSparse_IndexValues(SUNMatrix A);
SUNDIALS_EXPORT sunrealtype* SUNMatrix_cuSparse_Data(SUNMatrix A);

SUNDIALS_EXPORT SUNErrCode
SUNMatrix_cuSparse_SetFixedPattern(SUNMatrix A, sunbooleantype yesno);
SUNDIALS_EXPORT
SUNErrCode SUNMatrix_cuSparse_SetFixedPattern(SUNMatrix A, sunbooleantype yesno);
SUNDIALS_EXPORT SUNErrCode SUNMatrix_cuSparse_SetKernelExecPolicy(
SUNMatrix A, SUNCudaExecPolicy* exec_policy);
SUNDIALS_EXPORT int SUNMatrix_cuSparse_NumBlocks(SUNMatrix A);
Expand Down
4 changes: 2 additions & 2 deletions include/sunmatrix/sunmatrix_magmadense.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ SUNDIALS_EXPORT sunindextype SUNMatrix_MagmaDense_NumBlocks(SUNMatrix A);
SUNDIALS_EXPORT sunrealtype** SUNMatrix_MagmaDense_BlockData(SUNMatrix A);
SUNDIALS_EXPORT SUNErrCode SUNMatrix_MagmaDense_CopyToDevice(SUNMatrix A,
sunrealtype* h_data);
SUNDIALS_EXPORT SUNErrCode
SUNMatrix_MagmaDense_CopyFromDevice(SUNMatrix A, sunrealtype* h_data);
SUNDIALS_EXPORT
SUNErrCode SUNMatrix_MagmaDense_CopyFromDevice(SUNMatrix A, sunrealtype* h_data);

SUNDIALS_STATIC_INLINE
sunrealtype* SUNMatrix_MagmaDense_Block(SUNMatrix Amat, sunindextype k)
Expand Down
6 changes: 4 additions & 2 deletions src/sunmatrix/sparse/sunmatrix_sparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ SUNMatrix SUNSparseFromDenseMatrix(SUNMatrix Ad, sunrealtype droptol,
sunindextype M, N;
SUNMatrix As;

SUNAssertNull(SUNMatGetID(Ad) == SUNMATRIX_DENSE, SUN_ERR_ARG_OUTOFRANGE);
SUNAssertNull(SUNMatGetID(Ad) == SUNMATRIX_DENSE, SUN_ERR_ARG_WRONGTYPE);
SUNAssertNull(sparsetype == CSC_MAT || sparsetype == CSR_MAT,
SUN_ERR_ARG_OUTOFRANGE);
SUNAssertNull(droptol >= ZERO, SUN_ERR_ARG_OUTOFRANGE);
Expand Down Expand Up @@ -226,7 +226,7 @@ SUNMatrix SUNSparseFromBandMatrix(SUNMatrix Ab, sunrealtype droptol,
sunindextype M, N;
SUNMatrix As;

SUNAssertNull(SUNMatGetID(Ab) == SUNMATRIX_BAND, SUN_ERR_ARG_OUTOFRANGE);
SUNAssertNull(SUNMatGetID(Ab) == SUNMATRIX_BAND, SUN_ERR_ARG_WRONGTYPE);
SUNAssertNull(sparsetype == CSC_MAT || sparsetype == CSR_MAT,
SUN_ERR_ARG_OUTOFRANGE);
SUNAssertNull(droptol >= ZERO, SUN_ERR_ARG_OUTOFRANGE);
Expand Down Expand Up @@ -697,7 +697,9 @@ SUNErrCode SUNMatScaleAddI_Sparse(sunrealtype c, SUNMatrix A)
/* create work arrays for nonzero row (column) indices and values in a
* single column (row) */
w = (sunindextype*)malloc(M * sizeof(sunindextype));
SUNAssert(w, SUN_ERR_MALLOC_FAIL);
x = (sunrealtype*)malloc(M * sizeof(sunrealtype));
SUNAssert(x, SUN_ERR_MALLOC_FAIL);

/* determine storage location where last column (row) should end */
nz = Ap[N] + newvals;
Expand Down

0 comments on commit 4f54da8

Please sign in to comment.