From: Daniel Arndt Date: Sat, 18 Aug 2018 21:29:40 +0000 (+0200) Subject: Add Nothrow variants to CUDA and CUSPARSE assert X-Git-Tag: v9.1.0-rc1~803^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4f35333f0be6f29f5e0f2c6da381bc20df7f904;p=dealii.git Add Nothrow variants to CUDA and CUSPARSE assert --- 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( \