summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasKulhanek <tomas.kulhanek@stfc.ac.uk>2018-12-07 05:34:34 +0000
committerTomasKulhanek <tomas.kulhanek@stfc.ac.uk>2018-12-07 05:34:34 +0000
commit51e09a7648d642ea78da5ec48a66c605831a0481 (patch)
treeee23395981cc120c63bb15b970077a9f456439a9
parent98fe4fbcf5ce35cff256b47da06da808e59ad4b0 (diff)
downloadregularization-51e09a7648d642ea78da5ec48a66c605831a0481.tar.gz
regularization-51e09a7648d642ea78da5ec48a66c605831a0481.tar.bz2
regularization-51e09a7648d642ea78da5ec48a66c605831a0481.tar.xz
regularization-51e09a7648d642ea78da5ec48a66c605831a0481.zip
check return instead of exit
-rw-r--r--Core/regularisers_GPU/PatchSelect_GPU_core.cu16
-rwxr-xr-xCore/regularisers_GPU/TV_SB_GPU_core.cu16
2 files changed, 28 insertions, 4 deletions
diff --git a/Core/regularisers_GPU/PatchSelect_GPU_core.cu b/Core/regularisers_GPU/PatchSelect_GPU_core.cu
index ba84105..28d0385 100644
--- a/Core/regularisers_GPU/PatchSelect_GPU_core.cu
+++ b/Core/regularisers_GPU/PatchSelect_GPU_core.cu
@@ -39,7 +39,19 @@
*/
// This will output the proper CUDA error strings in the event that a CUDA host call returns an error
-#define checkCudaErrors(err) __checkCudaErrors (err, __FILE__, __LINE__)
+#define checkCudaErrors(call) \
+{ \
+ const cudaError_t error = call; \
+ if (error != cudaSuccess) \
+ { \
+ fprintf(stderr, "Error: %s:%d, ", __FILE__, __LINE__); \
+ fprintf(stderr, "code: %d, reason: %s\n", error, \
+ cudaGetErrorString(error)); \
+ return; \
+ } \
+}
+
+/*#define checkCudaErrors(err) __checkCudaErrors (err, __FILE__, __LINE__)
inline void __checkCudaErrors(cudaError err, const char *file, const int line)
{
@@ -49,7 +61,7 @@ inline void __checkCudaErrors(cudaError err, const char *file, const int line)
file, line, (int)err, cudaGetErrorString(err));
return;
}
-}
+}*/
#define BLKXSIZE 16
#define BLKYSIZE 16
diff --git a/Core/regularisers_GPU/TV_SB_GPU_core.cu b/Core/regularisers_GPU/TV_SB_GPU_core.cu
index a97851c..a590981 100755
--- a/Core/regularisers_GPU/TV_SB_GPU_core.cu
+++ b/Core/regularisers_GPU/TV_SB_GPU_core.cu
@@ -39,7 +39,19 @@ limitations under the License.
*/
// This will output the proper CUDA error strings in the event that a CUDA host call returns an error
-#define checkCudaErrors(err) __checkCudaErrors (err, __FILE__, __LINE__)
+#define checkCudaErrors(call) \
+{ \
+ const cudaError_t error = call; \
+ if (error != cudaSuccess) \
+ { \
+ fprintf(stderr, "Error: %s:%d, ", __FILE__, __LINE__); \
+ fprintf(stderr, "code: %d, reason: %s\n", error, \
+ cudaGetErrorString(error)); \
+ return; \
+ } \
+}
+
+/*#define checkCudaErrors(err) __checkCudaErrors (err, __FILE__, __LINE__)
inline void __checkCudaErrors(cudaError err, const char *file, const int line)
{
@@ -49,7 +61,7 @@ inline void __checkCudaErrors(cudaError err, const char *file, const int line)
file, line, (int)err, cudaGetErrorString(err));
return;
}
-}
+}*/
#define BLKXSIZE2D 16
#define BLKYSIZE2D 16