#include <cusparse.h>
#include <exception>
#include <fmt/core.h>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
Go to the source code of this file.
|
| #define | CHECK_CUSPARSE_ERROR_TYPE(code, x) |
| |
| #define | OPM_CUSPARSE_SAFE_CALL(expression) ::Opm::gpuistl::detail::cusparseSafeCall(expression, #expression, __FILE__, __func__, __LINE__) |
| | OPM_CUSPARSE_SAFE_CALL checks the return type of the cusparse expression (function call) and throws an exception if it does not equal CUSPARSE_STATUS_SUCCESS. More...
|
| |
| #define | OPM_CUSPARSE_WARN_IF_ERROR(expression) ::Opm::gpuistl::detail::cusparseWarnIfError(expression, #expression, __FILE__, __func__, __LINE__) |
| | OPM_CUSPARSE_WARN_IF_ERROR checks the return type of the cusparse expression (function call) and issues a warning if it does not equal CUSPARSE_STATUS_SUCCESS. More...
|
| |
|
| std::string | Opm::gpuistl::detail::getCusparseErrorCodeToString (int code) |
| | getCusparseErrorCodeToString Converts an error code returned from a cusparse function a human readable string. More...
|
| |
| std::string | Opm::gpuistl::detail::getCusparseErrorMessage (cusparseStatus_t error, const std::string_view &expression, const std::string_view &filename, const std::string_view &functionName, size_t lineNumber) |
| | getCusparseErrorMessage generates the error message to display for a given error. More...
|
| |
| void | Opm::gpuistl::detail::cusparseSafeCall (cusparseStatus_t error, const std::string_view &expression, const std::string_view &filename, const std::string_view &functionName, size_t lineNumber) |
| | cusparseSafeCall checks the return type of the CUSPARSE expression (function call) and throws an exception if it does not equal CUSPARSE_STATUS_SUCCESS. More...
|
| |
| cusparseStatus_t | Opm::gpuistl::detail::cusparseWarnIfError (cusparseStatus_t error, const std::string_view &expression, const std::string_view &filename, const std::string_view &functionName, size_t lineNumber) |
| | cusparseWarnIfError checks the return type of the CUSPARSE expression (function call) and issues a warning if it does not equal CUSPARSE_STATUS_SUCCESS. More...
|
| |
◆ CHECK_CUSPARSE_ERROR_TYPE
| #define CHECK_CUSPARSE_ERROR_TYPE |
( |
|
code, |
|
|
|
x |
|
) |
| |
Value: if (code == x) { \
return #x; \
}
◆ OPM_CUSPARSE_SAFE_CALL
| #define OPM_CUSPARSE_SAFE_CALL |
( |
|
expression | ) |
::Opm::gpuistl::detail::cusparseSafeCall(expression, #expression, __FILE__, __func__, __LINE__) |
OPM_CUSPARSE_SAFE_CALL checks the return type of the cusparse expression (function call) and throws an exception if it does not equal CUSPARSE_STATUS_SUCCESS.
Example usage:
#include <cusparse.h>
void some_function() {
cusparseHandle_t cusparseHandle;
}
#define OPM_CUSPARSE_SAFE_CALL(expression)
OPM_CUSPARSE_SAFE_CALL checks the return type of the cusparse expression (function call) and throws a...
Definition: cusparse_safe_call.hpp:185
- Note
- This should be used for any call to cuSparse unless you have a good reason not to.
◆ OPM_CUSPARSE_WARN_IF_ERROR
| #define OPM_CUSPARSE_WARN_IF_ERROR |
( |
|
expression | ) |
::Opm::gpuistl::detail::cusparseWarnIfError(expression, #expression, __FILE__, __func__, __LINE__) |
OPM_CUSPARSE_WARN_IF_ERROR checks the return type of the cusparse expression (function call) and issues a warning if it does not equal CUSPARSE_STATUS_SUCCESS.
Example usage:
#include <cusparse.h>
void some_function() {
cusparseHandle_t cusparseHandle;
}
#define OPM_CUSPARSE_WARN_IF_ERROR(expression)
OPM_CUSPARSE_WARN_IF_ERROR checks the return type of the cusparse expression (function call) and issu...
Definition: cusparse_safe_call.hpp:206
- Note
- Prefer the cusparseSafeCall/OPM_CUBLAS_SAFE_CALL counterpart unless you really don't want to throw an exception.