Jetson Inference
DNN Vision Library

Error checking and logging macros. More...

Macros

#define CUDA(x)   cudaCheckError((x), #x, __FILE__, __LINE__)
 Execute a CUDA call and print out any errors. More...
 
#define CUDA_SUCCESS(x)   (CUDA(x) == cudaSuccess)
 Evaluates to true on success. More...
 
#define CUDA_FAILED(x)   (CUDA(x) != cudaSuccess)
 Evaluates to true on failure. More...
 
#define CUDA_VERIFY(x)   if(CUDA_FAILED(x)) return false;
 Return from the boolean function if CUDA call fails. More...
 
#define LOG_CUDA   "[cuda] "
 LOG_CUDA string. More...
 
#define CUDA_FREE(x)   if(x != NULL) { cudaFree(x); x = NULL; }
 Check for non-NULL pointer before freeing it, and then set the pointer to NULL. More...
 
#define CUDA_FREE_HOST(x)   if(x != NULL) { cudaFreeHost(x); x = NULL; }
 Check for non-NULL pointer before freeing it, and then set the pointer to NULL. More...
 

Functions

cudaError_t cudaCheckError (cudaError_t retval, const char *txt, const char *file, int line)
 cudaCheckError More...
 

Detailed Description

Error checking and logging macros.

Macro Definition Documentation

◆ CUDA

#define CUDA (   x)    cudaCheckError((x), #x, __FILE__, __LINE__)

Execute a CUDA call and print out any errors.

Returns
the original cudaError_t result

◆ CUDA_FAILED

#define CUDA_FAILED (   x)    (CUDA(x) != cudaSuccess)

Evaluates to true on failure.

◆ CUDA_FREE

#define CUDA_FREE (   x)    if(x != NULL) { cudaFree(x); x = NULL; }

Check for non-NULL pointer before freeing it, and then set the pointer to NULL.

◆ CUDA_FREE_HOST

#define CUDA_FREE_HOST (   x)    if(x != NULL) { cudaFreeHost(x); x = NULL; }

Check for non-NULL pointer before freeing it, and then set the pointer to NULL.

◆ CUDA_SUCCESS

#define CUDA_SUCCESS (   x)    (CUDA(x) == cudaSuccess)

Evaluates to true on success.

◆ CUDA_VERIFY

#define CUDA_VERIFY (   x)    if(CUDA_FAILED(x)) return false;

Return from the boolean function if CUDA call fails.

◆ LOG_CUDA

#define LOG_CUDA   "[cuda] "

LOG_CUDA string.

Function Documentation

◆ cudaCheckError()

cudaError_t cudaCheckError ( cudaError_t  retval,
const char *  txt,
const char *  file,
int  line 
)
inline

cudaCheckError