Jetson Inference
DNN Vision Library
cudaUtility.h File Reference
#include <cuda_runtime.h>
#include <cuda.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "logging.h"

Go to the source code of this file.

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...
 
#define SAFE_DELETE(x)   if(x != NULL) { delete x; x = NULL; }
 Check for non-NULL pointer before deleting it, and then set the pointer to NULL. More...
 
#define SAFE_FREE(x)   if(x != NULL) { free(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...
 
__device__ __host__ int iDivUp (int a, int b)
 If a / b has a remainder, round up. More...