#define safeCall(expr) safeCall_(expr, #expr, __FILE__, __LINE__)\r
inline void safeCall_(int code, const char* expr, const char* file, int line)\r
{\r
- cout << "CUDA driver API error: code " << code << ", expr " << expr\r
- << ", file " << file << ", line " << line << endl;\r
- destroyContexts();\r
- exit(-1);\r
+ if (code != CUDA_SUCCESS)\r
+ {\r
+ cout << "CUDA driver API error: code " << code << ", expr " << expr\r
+ << ", file " << file << ", line " << line << endl;\r
+ destroyContexts();\r
+ exit(-1);\r
+ }\r
}\r
\r
// Each GPU is associated with its own context\r
#define safeCall(expr) safeCall_(expr, #expr, __FILE__, __LINE__)\r
inline void safeCall_(int code, const char* expr, const char* file, int line)\r
{\r
- cout << "CUDA driver API error: code " << code << ", expr " << expr\r
- << ", file " << file << ", line " << line << endl;\r
- destroyContexts();\r
- exit(-1);\r
+ if (code != CUDA_SUCCESS)\r
+ {\r
+ cout << "CUDA driver API error: code " << code << ", expr " << expr\r
+ << ", file " << file << ", line " << line << endl;\r
+ destroyContexts();\r
+ exit(-1);\r
+ }\r
}\r
\r
// Each GPU is associated with its own context\r