summaryrefslogtreecommitdiffstats
path: root/cuda
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2021-11-16 11:28:05 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2021-11-16 11:28:05 +0100
commitd59619737b79ca3bd732fedaff6665e600ee1335 (patch)
tree0cd6892de61ec80dd9f718b7f5980a83b4111d3e /cuda
parent231dd3e5e28319aa16155efd9ec7fdc69834666b (diff)
downloadastra-d59619737b79ca3bd732fedaff6665e600ee1335.tar.gz
astra-d59619737b79ca3bd732fedaff6665e600ee1335.tar.bz2
astra-d59619737b79ca3bd732fedaff6665e600ee1335.tar.xz
astra-d59619737b79ca3bd732fedaff6665e600ee1335.zip
Add new checkCuda function to simplify error handling
Diffstat (limited to 'cuda')
-rw-r--r--cuda/2d/util.cu9
1 files changed, 9 insertions, 0 deletions
diff --git a/cuda/2d/util.cu b/cuda/2d/util.cu
index 2a47472..ce652cb 100644
--- a/cuda/2d/util.cu
+++ b/cuda/2d/util.cu
@@ -274,5 +274,14 @@ void reportCudaError(cudaError_t err)
ASTRA_ERROR("CUDA error %d: %s.", err, cudaGetErrorString(err));
}
+bool checkCuda(cudaError_t err, const char *msg)
+{
+ if (err != cudaSuccess) {
+ ASTRA_ERROR("%s: CUDA error %d: %s.", msg, err, cudaGetErrorString(err));
+ return false;
+ } else {
+ return true;
+ }
+}
}