#include <cublas_v2.h>
#include <exception>
#include <fmt/core.h>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <string_view>
Go to the source code of this file.
|
| #define | CHECK_CUBLAS_ERROR_TYPE(code, x) |
| |
| #define | OPM_CUBLAS_SAFE_CALL(expression) ::Opm::gpuistl::detail::cublasSafeCall(expression, #expression, __FILE__, __func__, __LINE__) |
| | 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. More...
|
| |
| #define | OPM_CUBLAS_WARN_IF_ERROR(expression) ::Opm::gpuistl::detail::cublasWarnIfError(expression, #expression, __FILE__, __func__, __LINE__) |
| | OPM_CUBLAS_WARN_IF_ERROR checks the return type of the cublas expression (function call) and issues a warning if it does not equal CUBLAS_STATUS_SUCCESS. More...
|
| |
|
| std::string | Opm::gpuistl::detail::getCublasErrorMessage (cublasStatus_t error, const std::string_view &expression, const std::string_view &filename, const std::string_view &functionName, size_t lineNumber) |
| | getCublasErrorMessage generates the error message to display for a given error. More...
|
| |
| void | Opm::gpuistl::detail::cublasSafeCall (cublasStatus_t error, const std::string_view &expression, const std::string_view &filename, const std::string_view &functionName, size_t lineNumber) |
| | cublasSafeCall checks the return type of the CUBLAS expression (function call) and throws an exception if it does not equal CUBLAS_STATUS_SUCCESS. More...
|
| |
| cublasStatus_t | Opm::gpuistl::detail::cublasWarnIfError (cublasStatus_t error, const std::string_view &expression, const std::string_view &filename, const std::string_view &functionName, size_t lineNumber) |
| | cublasWarnIfError checks the return type of the CUBLAS expression (function call) and issues a warning if it does not equal CUBLAS_STATUS_SUCCESS. More...
|
| |
◆ CHECK_CUBLAS_ERROR_TYPE
| #define CHECK_CUBLAS_ERROR_TYPE |
( |
|
code, |
|
|
|
x |
|
) |
| |
Value: if (code == x) { \
return #x; \
}
◆ OPM_CUBLAS_SAFE_CALL
| #define OPM_CUBLAS_SAFE_CALL |
( |
|
expression | ) |
::Opm::gpuistl::detail::cublasSafeCall(expression, #expression, __FILE__, __func__, __LINE__) |
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.
Example usage:
#include <cublas_v2.h>
void some_function() {
cublasHandle_t cublasHandle;
}
#define OPM_CUBLAS_SAFE_CALL(expression)
OPM_CUBLAS_SAFE_CALL checks the return type of the cublas expression (function call) and throws an ex...
Definition: cublas_safe_call.hpp:196
- Note
- This should be used for any call to cuBlas unless you have a good reason not to.
◆ OPM_CUBLAS_WARN_IF_ERROR
| #define OPM_CUBLAS_WARN_IF_ERROR |
( |
|
expression | ) |
::Opm::gpuistl::detail::cublasWarnIfError(expression, #expression, __FILE__, __func__, __LINE__) |
OPM_CUBLAS_WARN_IF_ERROR checks the return type of the cublas expression (function call) and issues a warning if it does not equal CUBLAS_STATUS_SUCCESS.
Example usage:
#include <cublas_v2.h>
void some_function() {
cublasHandle_t cublasHandle;
}
#define OPM_CUBLAS_WARN_IF_ERROR(expression)
OPM_CUBLAS_WARN_IF_ERROR checks the return type of the cublas expression (function call) and issues a...
Definition: cublas_safe_call.hpp:216
- Note
- Prefer the cublasSafeCall/OPM_CUBLAS_SAFE_CALL counterpart unless you really don't want to throw an exception.