cuDDL
Loading...
Searching...
No Matches
Macros
cuda_error.hpp File Reference
#include <cuddl/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 CUDDL_CUDA_CALL(err)
 Checks a CUDA runtime call and throws std::runtime_error on failure.
 

Macro Definition Documentation

◆ CUDDL_CUDA_CALL

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

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

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

Definition at line 11 of file cuda_error.hpp.

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