From e4c0ce08dc34a9edf822107df2e6463c958e5926 Mon Sep 17 00:00:00 2001 From: Kjetil Olsen Lye Date: Tue, 9 May 2023 13:10:29 +0200 Subject: [PATCH] Fixed documentation and formatting. --- .../linalg/cuistl/detail/cublas_safe_call.hpp | 5 +++-- .../cuistl/detail/cuda_check_last_error.hpp | 20 +++++++++++-------- .../cuistl/detail/cusparse_safe_call.hpp | 4 ++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/opm/simulators/linalg/cuistl/detail/cublas_safe_call.hpp b/opm/simulators/linalg/cuistl/detail/cublas_safe_call.hpp index 36074c5c2..8b72a6be6 100644 --- a/opm/simulators/linalg/cuistl/detail/cublas_safe_call.hpp +++ b/opm/simulators/linalg/cuistl/detail/cublas_safe_call.hpp @@ -57,14 +57,14 @@ getCublasErrorMessage(int code) return fmt::format("UNKNOWN CUBLAS ERROR {}.", code); } -#undef CHECK_CUSPRASE_ERROR_TYPE +#undef CHECK_CUBLAS_ERROR_TYPE /** * @brief cublasSafeCall checks the return type of the CUBLAS expression (function call) and throws an exception if it * does not equal CUBLAS_STATUS_SUCCESS. * * Example usage: * @code{.cpp} - * #include + * #include * #include * * void some_function() { @@ -98,6 +98,7 @@ cublasSafeCall(cublasStatus_t error, } } } // namespace Opm::cuistl::detail + /** * @brief OPM_CUBLAS_SAFE_CALL checks the return type of the cublas expression (function call) and throws an exception * if it does not equal CUBLAS_STATUS_SUCCESS. diff --git a/opm/simulators/linalg/cuistl/detail/cuda_check_last_error.hpp b/opm/simulators/linalg/cuistl/detail/cuda_check_last_error.hpp index d0c0da106..5f7ea44c0 100644 --- a/opm/simulators/linalg/cuistl/detail/cuda_check_last_error.hpp +++ b/opm/simulators/linalg/cuistl/detail/cuda_check_last_error.hpp @@ -23,15 +23,15 @@ #include /** - * @brief OPM_CUDA_CHECK_LAST_ERROR checks the return type of cudaDeviceSynchronize(), + * @brief OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE checks the return type of cudaDeviceSynchronize(), * and throws an exception if cudaDeviceSynchronize() does not equal cudaSuccess. * * Example usage: * @code{.cpp} - * #include + * #include * * void some_function() { - * OPM_CUDA_CHECK_LAST_ERROR; + * OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE; * } * @endcode * @@ -43,8 +43,9 @@ #ifdef NDEBUG #define OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE_IF_DEBUG #else + /** - * @brief OPM_CUDA_CHECK_LAST_ERROR_IF_DEBUG checks the return type of cudaDeviceSynchronize only if NDEBUG is not defined, + * @brief OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE_IF_DEBUG checks the return type of cudaDeviceSynchronize only if NDEBUG is not defined, * and throws an exception if cudaDeviceSynchronize() does not equal cudaSuccess. * * Example usage: @@ -52,7 +53,7 @@ * #include * * void some_function() { - * OPM_CUDA_CHECK_LAST_ERROR; + * OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE_IF_DEBUG; * } * @endcode * @@ -68,7 +69,7 @@ * * Example usage: * @code{.cpp} - * #include + * #include * * void some_function() { * OPM_CUDA_CHECK_LAST_ERROR; @@ -78,19 +79,21 @@ * @note This can be used to debug the code, or simply make sure that no error has occured. */ #define OPM_CUDA_CHECK_LAST_ERROR OPM_CUDA_SAFE_CALL(cudaGetLastError()) + #ifdef NDEBUG #define OPM_CUDA_CHECK_LAST_ERROR_IF_DEBUG #else + /** * @brief OPM_CUDA_CHECK_LAST_ERROR_IF_DEBUG checks the return type of cudaGetLastError() only if NDEBUG is not defined, * and throws an exception if cudaGetLastError() does not equal cudaSuccess. * * Example usage: * @code{.cpp} - * #include + * #include * * void some_function() { - * OPM_CUDA_CHECK_LAST_ERROR; + * OPM_CUDA_CHECK_LAST_ERROR_IF_DEBUG; * } * @endcode * @@ -98,4 +101,5 @@ */ #define OPM_CUDA_CHECK_LAST_ERROR_IF_DEBUG OPM_CUDA_CHECK_LAST_ERROR #endif + #endif diff --git a/opm/simulators/linalg/cuistl/detail/cusparse_safe_call.hpp b/opm/simulators/linalg/cuistl/detail/cusparse_safe_call.hpp index 19b7ca287..afaab60a0 100644 --- a/opm/simulators/linalg/cuistl/detail/cusparse_safe_call.hpp +++ b/opm/simulators/linalg/cuistl/detail/cusparse_safe_call.hpp @@ -61,11 +61,11 @@ getCusparseErrorMessage(int code) * * Example usage: * @code{.cpp} - * #include + * #include * #include * * void some_function() { - * cublasHandle_t cublasHandle; + * cusparseHandle_t cusparseHandle; * cudaSafeCall(cusparseCreate(&cusparseHandle), "cusparseCreate(&cusparseHandle)", __FILE__, __func__, __LINE__); * } * @endcode