From 7e1e926623f988cdf1a81f9cbca4cc3d3ca0aec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20=C3=9Clgen?= Date: Tue, 27 Aug 2024 22:29:52 +0100 Subject: [PATCH] Revert "Use float gam instead of double in CudaOptimiser" This reverts commit b9c9beca65c9c7f6862e1c1ca50c70eaafd1fbfa. --- niftyreg_build_version.txt | 2 +- reg-lib/cuda/CudaOptimiser.cu | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/niftyreg_build_version.txt b/niftyreg_build_version.txt index 21fbd2eb..e828e5d0 100644 --- a/niftyreg_build_version.txt +++ b/niftyreg_build_version.txt @@ -1 +1 @@ -433 +434 diff --git a/reg-lib/cuda/CudaOptimiser.cu b/reg-lib/cuda/CudaOptimiser.cu index 7a4e13a7..9b1618c9 100644 --- a/reg-lib/cuda/CudaOptimiser.cu +++ b/reg-lib/cuda/CudaOptimiser.cu @@ -236,7 +236,7 @@ void GetConjugateGradient(float4 *gradientCuda, return make_double2(dgg, gg); }; - float gam; + double gam; thrust::counting_iterator it(0); const double2 gg = thrust::transform_reduce(thrust::device, it, it + nVoxels, [=]__device__(const int index) { return calcGam(gradientTexture, conjugateGTexture, conjugateHTexture, index); @@ -246,8 +246,8 @@ void GetConjugateGradient(float4 *gradientCuda, const double2 ggBw = thrust::transform_reduce(thrust::device, it, it + nVoxelsBw, [=]__device__(const int index) { return calcGam(gradientBwTexture, conjugateGBwTexture, conjugateHBwTexture, index); }, make_double2(0, 0), thrust::plus()); - gam = static_cast((gg.x + ggBw.x) / (gg.y + ggBw.y)); - } else gam = static_cast(gg.x / gg.y); + gam = (gg.x + ggBw.x) / (gg.y + ggBw.y); + } else gam = gg.x / gg.y; // Conjugate gradient auto conjugate = [gam]__device__(float4 *gradientCuda, float4 *conjugateGCuda, float4 *conjugateHCuda,