Improved CHECK_CUDA() macro

This commit is contained in:
Davis King 2016-04-24 10:05:37 -04:00
parent 935a0b4e48
commit 018e85f150
1 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@
// Check the return value of a call to the CUDA runtime for an error condition. // Check the return value of a call to the CUDA runtime for an error condition.
#define CHECK_CUDA(call) \ #define CHECK_CUDA(call) \
{ \ do{ \
const cudaError_t error = call; \ const cudaError_t error = call; \
if (error != cudaSuccess) \ if (error != cudaSuccess) \
{ \ { \
@ -24,7 +24,7 @@
sout << "code: " << error << ", reason: " << cudaGetErrorString(error);\ sout << "code: " << error << ", reason: " << cudaGetErrorString(error);\
throw dlib::cuda_error(sout.str()); \ throw dlib::cuda_error(sout.str()); \
} \ } \
} }while(false)
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------