Fixed documentation and formatting.

This commit is contained in:
Kjetil Olsen Lye 2023-05-09 13:10:29 +02:00
parent b456fee209
commit e4c0ce08dc
3 changed files with 17 additions and 12 deletions

View File

@ -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 <opm/simulators/linalg/cuistl/detail/cuda_safe_call.hpp>
* #include <opm/simulators/linalg/cuistl/detail/cublas_safe_call.hpp>
* #include <cublas_v2.h>
*
* 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.

View File

@ -23,15 +23,15 @@
#include <opm/simulators/linalg/cuistl/detail/cuda_safe_call.hpp>
/**
* @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 <opm/simulators/linalg/cuistl/detail/cuda_safe_call.hpp>
* #include <opm/simulators/linalg/cuistl/detail/cuda_check_last_error.hpp>
*
* 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 <opm/simulators/linalg/cuistl/detail/cuda_safe_call.hpp>
*
* 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 <opm/simulators/linalg/cuistl/detail/cuda_safe_call.hpp>
* #include <opm/simulators/linalg/cuistl/detail/cuda_check_last_error.hpp>
*
* 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 <opm/simulators/linalg/cuistl/detail/cuda_safe_call.hpp>
* #include <opm/simulators/linalg/cuistl/detail/cuda_check_last_error.hpp>
*
* 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

View File

@ -61,11 +61,11 @@ getCusparseErrorMessage(int code)
*
* Example usage:
* @code{.cpp}
* #include <opm/simulators/linalg/cuistl/detail/cuda_safe_call.hpp>
* #include <opm/simulators/linalg/cuistl/detail/cusparse_safe_call.hpp>
* #include <cublas_v2.h>
*
* void some_function() {
* cublasHandle_t cublasHandle;
* cusparseHandle_t cusparseHandle;
* cudaSafeCall(cusparseCreate(&cusparseHandle), "cusparseCreate(&cusparseHandle)", __FILE__, __func__, __LINE__);
* }
* @endcode