From 5f175f95949ebbd293ee91640b99f59b0be26cc5 Mon Sep 17 00:00:00 2001 From: Alexey Spizhevoy Date: Mon, 14 Feb 2011 15:36:07 +0000 Subject: [PATCH] fixed warnings in GPU samples --- samples/gpu/multi.cpp | 11 +++++++---- samples/gpu/stereo_multi.cpp | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/samples/gpu/multi.cpp b/samples/gpu/multi.cpp index e2d1f2cf4b..8b2471c701 100644 --- a/samples/gpu/multi.cpp +++ b/samples/gpu/multi.cpp @@ -42,10 +42,13 @@ void destroyContexts(); #define safeCall(expr) safeCall_(expr, #expr, __FILE__, __LINE__) inline void safeCall_(int code, const char* expr, const char* file, int line) { - cout << "CUDA driver API error: code " << code << ", expr " << expr - << ", file " << file << ", line " << line << endl; - destroyContexts(); - exit(-1); + if (code != CUDA_SUCCESS) + { + cout << "CUDA driver API error: code " << code << ", expr " << expr + << ", file " << file << ", line " << line << endl; + destroyContexts(); + exit(-1); + } } // Each GPU is associated with its own context diff --git a/samples/gpu/stereo_multi.cpp b/samples/gpu/stereo_multi.cpp index a25ac02195..d18ad1c3fb 100644 --- a/samples/gpu/stereo_multi.cpp +++ b/samples/gpu/stereo_multi.cpp @@ -44,10 +44,13 @@ void destroyContexts(); #define safeCall(expr) safeCall_(expr, #expr, __FILE__, __LINE__) inline void safeCall_(int code, const char* expr, const char* file, int line) { - cout << "CUDA driver API error: code " << code << ", expr " << expr - << ", file " << file << ", line " << line << endl; - destroyContexts(); - exit(-1); + if (code != CUDA_SUCCESS) + { + cout << "CUDA driver API error: code " << code << ", expr " << expr + << ", file " << file << ", line " << line << endl; + destroyContexts(); + exit(-1); + } } // Each GPU is associated with its own context