cuda_check_last_error.hpp File Reference
#include <cuda_runtime.h>
#include <fmt/core.h>
#include <opm/simulators/linalg/cuistl/detail/cuda_safe_call.hpp>
Include dependency graph for cuda_check_last_error.hpp:

Go to the source code of this file.

Macros

#define OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE   OPM_CUDA_SAFE_CALL(cudaDeviceSynchronize())
 OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE checks the return type of cudaDeviceSynchronize(), and throws an exception if cudaDeviceSynchronize() does not equal cudaSuccess. More...
 
#define OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE_IF_DEBUG   OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE
 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. More...
 
#define OPM_CUDA_CHECK_LAST_ERROR   OPM_CUDA_SAFE_CALL(cudaGetLastError())
 OPM_CUDA_CHECK_LAST_ERROR checks the return type of cudaGetLastError(), and throws an exception if cudaGetLastError() does not equal cudaSuccess. More...
 
#define OPM_CUDA_CHECK_LAST_ERROR_IF_DEBUG   OPM_CUDA_CHECK_LAST_ERROR
 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. More...
 

Macro Definition Documentation

◆ OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE

#define OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE   OPM_CUDA_SAFE_CALL(cudaDeviceSynchronize())

OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE checks the return type of cudaDeviceSynchronize(), and throws an exception if cudaDeviceSynchronize() does not equal cudaSuccess.

Example usage:

void some_function() {
}
#define OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE
OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE checks the return type of cudaDeviceSynchronize(),...
Definition: cuda_check_last_error.hpp:41
Note
This can be used to debug the code, or simply make sure that no error has occured.
This is a rather heavy operation, so prefer to use only in Debug mode (see OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE_IF_DEBUG)

◆ OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE_IF_DEBUG

#define OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE_IF_DEBUG   OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE

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:

void some_function() {
}
#define OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE_IF_DEBUG
OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE_IF_DEBUG checks the return type of cudaDeviceSynchronize only if ND...
Definition: cuda_check_last_error.hpp:62
Note
This can be used to debug the code, or simply make sure that no error has occured.

◆ OPM_CUDA_CHECK_LAST_ERROR

#define OPM_CUDA_CHECK_LAST_ERROR   OPM_CUDA_SAFE_CALL(cudaGetLastError())

OPM_CUDA_CHECK_LAST_ERROR checks the return type of cudaGetLastError(), and throws an exception if cudaGetLastError() does not equal cudaSuccess.

Example usage:

void some_function() {
}
#define OPM_CUDA_CHECK_LAST_ERROR
OPM_CUDA_CHECK_LAST_ERROR checks the return type of cudaGetLastError(), and throws an exception if cu...
Definition: cuda_check_last_error.hpp:81
Note
This can be used to debug the code, or simply make sure that no error has occured.

◆ OPM_CUDA_CHECK_LAST_ERROR_IF_DEBUG

#define OPM_CUDA_CHECK_LAST_ERROR_IF_DEBUG   OPM_CUDA_CHECK_LAST_ERROR

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:

void some_function() {
}
#define OPM_CUDA_CHECK_LAST_ERROR_IF_DEBUG
OPM_CUDA_CHECK_LAST_ERROR_IF_DEBUG checks the return type of cudaGetLastError() only if NDEBUG is not...
Definition: cuda_check_last_error.hpp:102
Note
This can be used to debug the code, or simply make sure that no error has occured.