OWL
OptiX7 Wrapper Library
cuda.h File Reference
#include "owl/common.h"
#include <cuda_runtime.h>

Go to the source code of this file.

Macros

#define CUDA_CHECK(call)
 
#define CUDA_CALL(call)   CUDA_CHECK(cuda##call)
 
#define CUDA_CHECK2(where, call)
 
#define CUDA_SYNC_CHECK()
 
#define CUDA_CHECK_NOTHROW(call)
 
#define CUDA_CALL_NOTHROW(call)   CUDA_CHECK_NOTHROW(cuda##call)
 
#define CUDA_CHECK2_NOTHROW(where, call)
 

Macro Definition Documentation

◆ CUDA_CALL

#define CUDA_CALL (   call)    CUDA_CHECK(cuda##call)

◆ CUDA_CALL_NOTHROW

#define CUDA_CALL_NOTHROW (   call)    CUDA_CHECK_NOTHROW(cuda##call)

◆ CUDA_CHECK

#define CUDA_CHECK (   call)
Value:
{ \
cudaError_t rc = call; \
if (rc != cudaSuccess) { \
fprintf(stderr, \
"CUDA call (%s) failed with code %d (line %d): %s\n", \
#call, rc, __LINE__, cudaGetErrorString(rc)); \
throw std::runtime_error("fatal cuda error"); \
} \
}

◆ CUDA_CHECK2

#define CUDA_CHECK2 (   where,
  call 
)
Value:
{ \
cudaError_t rc = call; \
if(rc != cudaSuccess) { \
if (where) \
fprintf(stderr, "at %s: CUDA call (%s) " \
"failed with code %d (line %d): %s\n", \
where,#call, rc, __LINE__, cudaGetErrorString(rc)); \
fprintf(stderr, \
"CUDA call (%s) failed with code %d (line %d): %s\n", \
#call, rc, __LINE__, cudaGetErrorString(rc)); \
throw std::runtime_error("fatal cuda error"); \
} \
}

◆ CUDA_CHECK2_NOTHROW

#define CUDA_CHECK2_NOTHROW (   where,
  call 
)
Value:
{ \
cudaError_t rc = call; \
if(rc != cudaSuccess) { \
if (where) \
fprintf(stderr, "at %s: CUDA call (%s) " \
"failed with code %d (line %d): %s\n", \
where,#call, rc, __LINE__, cudaGetErrorString(rc)); \
fprintf(stderr, \
"CUDA call (%s) failed with code %d (line %d): %s\n", \
#call, rc, __LINE__, cudaGetErrorString(rc)); \
throw std::runtime_error("fatal cuda error"); \
} \
}

◆ CUDA_CHECK_NOTHROW

#define CUDA_CHECK_NOTHROW (   call)
Value:
{ \
cudaError_t rc = call; \
if (rc != cudaSuccess) { \
fprintf(stderr, \
"CUDA call (%s) failed with code %d (line %d): %s\n", \
#call, rc, __LINE__, cudaGetErrorString(rc)); \
exit(2); \
} \
}

◆ CUDA_SYNC_CHECK

#define CUDA_SYNC_CHECK ( )
Value:
{ \
cudaDeviceSynchronize(); \
cudaError_t rc = cudaGetLastError(); \
if (rc != cudaSuccess) { \
fprintf(stderr, "error (%s: line %d): %s\n", \
__FILE__, __LINE__, cudaGetErrorString(rc)); \
throw std::runtime_error("fatal cuda error"); \
} \
}