summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cuda/2d/util.cu9
-rw-r--r--include/astra/cuda/2d/util.h1
-rw-r--r--include/astra/cuda/3d/util3d.h2
3 files changed, 12 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;
+ }
+}
}
diff --git a/include/astra/cuda/2d/util.h b/include/astra/cuda/2d/util.h
index 49079ef..a7bba89 100644
--- a/include/astra/cuda/2d/util.h
+++ b/include/astra/cuda/2d/util.h
@@ -74,6 +74,7 @@ void duplicateProjectionData(float* D_dst, float* D_src, unsigned int pitch, con
bool cudaTextForceKernelsCompletion();
void reportCudaError(cudaError_t err);
+bool checkCuda(cudaError_t err, const char *msg);
float dotProduct2D(float* D_data, unsigned int pitch,
diff --git a/include/astra/cuda/3d/util3d.h b/include/astra/cuda/3d/util3d.h
index 5f805df..e902a85 100644
--- a/include/astra/cuda/3d/util3d.h
+++ b/include/astra/cuda/3d/util3d.h
@@ -38,6 +38,8 @@ along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>.
namespace astraCUDA3d {
+using astraCUDA::checkCuda;
+
cudaPitchedPtr allocateVolumeData(const SDimensions3D& dims);
cudaPitchedPtr allocateProjectionData(const SDimensions3D& dims);
bool zeroVolumeData(cudaPitchedPtr& D_data, const SDimensions3D& dims);