From f4f35333f0be6f29f5e0f2c6da381bc20df7f904 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sat, 18 Aug 2018 23:29:40 +0200 Subject: [PATCH] Add Nothrow variants to CUDA and CUSPARSE assert --- include/deal.II/base/exceptions.h | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/include/deal.II/base/exceptions.h b/include/deal.II/base/exceptions.h index 0c20aacc57..7c0369f33f 100644 --- a/include/deal.II/base/exceptions.h +++ b/include/deal.II/base/exceptions.h @@ -1466,6 +1466,23 @@ namespace internal } # endif +/** + * The non-throwing equivalent of AssertCuda. + * + * @ingroup Exceptions + * @author Daniel Arndt, 2018 + */ +# ifdef DEBUG +# define AssertNothrowCuda(error_code) \ + AssertNothrow(error_code == cudaSuccess, \ + dealii::ExcCudaError(cudaGetErrorString(error_code))) +# else +# define AssertNothrowCuda(error_code) \ + { \ + (void)(error_code); \ + } +# endif + /** * An assertion that checks that the error code produced by calling a cuSPARSE * routine is equal to CUSPARSE_STATUS_SUCCESS. @@ -1487,6 +1504,33 @@ namespace internal } # endif +/** + * The non-throwing equivalent of AssertCusparse. + * + * @ingroup Exceptions + * @author Daniel Arndt, 2018 + */ +# ifdef DEBUG +# define AssertNothrowCusparse(error_code) \ + AssertNothrow( \ + error_code == CUSPARSE_STATUS_SUCCESS, \ + dealii::ExcCusparseError( \ + dealii::deal_II_exceptions::internals::get_cusparse_error_string( \ + error_code))) +# else +# define AssertNothrowCusparse(error_code) \ + { \ + (void)(error_code); \ + } +# endif + +/** + * An assertion that checks that the error code produced by calling a cuSOLVER + * routine is equal to CUSOLVER_STATUS_SUCCESS. + * + * @ingroup Exceptions + * @author Bruno Turcksin, 2018 + */ # ifdef DEBUG # define AssertCusolver(error_code) \ Assert( \ -- 2.39.5