cuSBF
Loading...
Searching...
No Matches
Macros
cuda_error.hpp File Reference
#include <cusbf/error.hpp>
#include <stdexcept>
Include dependency graph for cuda_error.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CUSBF_CUDA_CALL(err)
 Checks a CUDA runtime call and throws std::runtime_error on failure.
 

Macro Definition Documentation

◆ CUSBF_CUDA_CALL

#define CUSBF_CUDA_CALL (   err)
Value:
do { \
if (cudaError_t _cusbf_err = (err); _cusbf_err != cudaSuccess) { \
throw std::runtime_error(::cusbf::Error::cuda(_cusbf_err).message()); \
} \
} while (0)
static Error cuda(cudaError_t code, std::source_location location=std::source_location::current())
Definition error.hpp:110

Checks a CUDA runtime call and throws std::runtime_error on failure.

Use in non-cusbf::Result functions (benchmarks, RAII helpers). Prefer CUSBF_CUDA_TRY inside functions that return cusbf::Result.

Definition at line 11 of file cuda_error.hpp.

12 { \
13 if (cudaError_t _cusbf_err = (err); _cusbf_err != cudaSuccess) { \
14 throw std::runtime_error(::cusbf::Error::cuda(_cusbf_err).message()); \
15 } \
16 } while (0)