Check Macros#

Defines

CUDA_CHECK(stat)

do                                                                                                                 \

{                                                                                                                  \

trt_edgellm::check::_checkCuda((stat), #stat, __FILE__, __LINE__);                                             \

} while (0)

#

Check CUDA runtime API calls.

Wraps CUDA runtime API calls and throws exception on error. Usage: CUDA_CHECK(cudaMalloc(&ptr, size));

CUDA_DRIVER_CHECK(stat)

do                                                                                                                 \

{                                                                                                                  \

trt_edgellm::check::_checkCudaDriver((stat), #stat, __FILE__, __LINE__);                                       \

} while (0)

#

Check CUDA driver API calls.

Wraps CUDA driver API calls and throws exception on error. Usage: CUDA_DRIVER_CHECK(cuMemAlloc(&dptr, size));

namespace trt_edgellm
namespace check#

Functions

inline void check(bool condition, std::string errorMsg)#

Check condition and throw exception if false.

Parameters:
  • condition – Condition to check

  • errorMsg – Error message to include in exception

Throws:

std::runtime_error – if condition is false

inline void _checkCuda(
cudaError_t result,
char const *const func,
char const *const file,
int const line
)#

Internal helper to check CUDA runtime errors.

Parameters:
  • result – CUDA error code

  • func – Function name string

  • file – Source file name

  • line – Source line number

Throws:

std::runtime_error – if CUDA error occurred

inline void _checkCudaDriver(
CUresult result,
char const *const func,
char const *const file,
int const line
)#

Internal helper to check CUDA driver API errors.

Parameters:
  • result – CUDA driver error code

  • func – Function name string

  • file – Source file name

  • line – Source line number

Throws:

std::runtime_error – if CUDA driver error occurred