From d59619737b79ca3bd732fedaff6665e600ee1335 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 16 Nov 2021 11:28:05 +0100 Subject: Add new checkCuda function to simplify error handling --- include/astra/cuda/2d/util.h | 1 + include/astra/cuda/3d/util3d.h | 2 ++ 2 files changed, 3 insertions(+) (limited to 'include') 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 . namespace astraCUDA3d { +using astraCUDA::checkCuda; + cudaPitchedPtr allocateVolumeData(const SDimensions3D& dims); cudaPitchedPtr allocateProjectionData(const SDimensions3D& dims); bool zeroVolumeData(cudaPitchedPtr& D_data, const SDimensions3D& dims); -- cgit v1.2.3 From 1875e824a0358a7e7510b31f5e87708b304652bc Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 16 Nov 2021 11:38:02 +0100 Subject: Remove reportCudaError function --- include/astra/cuda/2d/util.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/astra/cuda/2d/util.h b/include/astra/cuda/2d/util.h index a7bba89..9eeb561 100644 --- a/include/astra/cuda/2d/util.h +++ b/include/astra/cuda/2d/util.h @@ -40,7 +40,7 @@ along with the ASTRA Toolbox. If not, see . #define M_PI 3.14159265358979323846 #endif -#define ASTRA_CUDA_ASSERT(err) do { if (err != cudaSuccess) { astraCUDA::reportCudaError(err); assert(err == cudaSuccess); } } while(0) +#define ASTRA_CUDA_ASSERT(err) do { if (!checkCuda(err, __FUNCTION__)) { assert(err == cudaSuccess); } } while(0) namespace astraCUDA { @@ -72,7 +72,6 @@ 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); -- cgit v1.2.3 From b492e3d049e300132d2f22eee7922ff308342a84 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 16 Nov 2021 11:46:17 +0100 Subject: Remove ASTRA_CUDA_ASSERT --- include/astra/cuda/2d/util.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/astra/cuda/2d/util.h b/include/astra/cuda/2d/util.h index 9eeb561..d504355 100644 --- a/include/astra/cuda/2d/util.h +++ b/include/astra/cuda/2d/util.h @@ -40,9 +40,6 @@ along with the ASTRA Toolbox. If not, see . #define M_PI 3.14159265358979323846 #endif -#define ASTRA_CUDA_ASSERT(err) do { if (!checkCuda(err, __FUNCTION__)) { assert(err == cudaSuccess); } } while(0) - - namespace astraCUDA { bool copyVolumeToDevice(const float* in_data, unsigned int in_pitch, @@ -59,12 +56,12 @@ bool copySinogramToDevice(const float* in_data, unsigned int in_pitch, float* outD_data, unsigned int out_pitch); bool allocateVolume(float*& D_ptr, unsigned int width, unsigned int height, unsigned int& pitch); -void zeroVolume(float* D_data, unsigned int pitch, unsigned int width, unsigned int height); +bool zeroVolume(float* D_data, unsigned int pitch, unsigned int width, unsigned int height); bool allocateVolumeData(float*& D_ptr, unsigned int& pitch, const SDimensions& dims); bool allocateProjectionData(float*& D_ptr, unsigned int& pitch, const SDimensions& dims); -void zeroVolumeData(float* D_ptr, unsigned int pitch, const SDimensions& dims); -void zeroProjectionData(float* D_ptr, unsigned int pitch, const SDimensions& dims); +bool zeroVolumeData(float* D_ptr, unsigned int pitch, const SDimensions& dims); +bool zeroProjectionData(float* D_ptr, unsigned int pitch, const SDimensions& dims); void duplicateVolumeData(float* D_dst, float* D_src, unsigned int pitch, const SDimensions& dims); void duplicateProjectionData(float* D_dst, float* D_src, unsigned int pitch, const SDimensions& dims); -- cgit v1.2.3 From 39582115bc93b5435d25e56891815ae7cb1898fd Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 16 Nov 2021 13:44:13 +0100 Subject: Remove cudaTextForceKernelsCompletion --- include/astra/cuda/2d/util.h | 5 ----- include/astra/cuda/3d/util3d.h | 2 -- 2 files changed, 7 deletions(-) (limited to 'include') diff --git a/include/astra/cuda/2d/util.h b/include/astra/cuda/2d/util.h index d504355..0fab9b1 100644 --- a/include/astra/cuda/2d/util.h +++ b/include/astra/cuda/2d/util.h @@ -66,13 +66,8 @@ bool zeroProjectionData(float* D_ptr, unsigned int pitch, const SDimensions& dim void duplicateVolumeData(float* D_dst, float* D_src, unsigned int pitch, const SDimensions& dims); void duplicateProjectionData(float* D_dst, float* D_src, unsigned int pitch, const SDimensions& dims); - - -bool cudaTextForceKernelsCompletion(); - bool checkCuda(cudaError_t err, const char *msg); - float dotProduct2D(float* D_data, unsigned int pitch, unsigned int width, unsigned int height); diff --git a/include/astra/cuda/3d/util3d.h b/include/astra/cuda/3d/util3d.h index e902a85..e147e42 100644 --- a/include/astra/cuda/3d/util3d.h +++ b/include/astra/cuda/3d/util3d.h @@ -60,8 +60,6 @@ bool zeroVolumeArray(cudaArray* array, const SDimensions3D& dims); cudaArray* allocateProjectionArray(const SDimensions3D& dims); cudaArray* allocateVolumeArray(const SDimensions3D& dims); -bool cudaTextForceKernelsCompletion(); - float dotProduct3D(cudaPitchedPtr data, unsigned int x, unsigned int y, unsigned int z); int calcNextPowerOfTwo(int _iValue); -- cgit v1.2.3