Skip to content

Commit

Permalink
Revert "Use float gam instead of double in CudaOptimiser"
Browse files Browse the repository at this point in the history
This reverts commit b9c9bec.
  • Loading branch information
onurulgen committed Aug 27, 2024
1 parent d515493 commit 7e1e926
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion niftyreg_build_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
433
434
6 changes: 3 additions & 3 deletions reg-lib/cuda/CudaOptimiser.cu
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void GetConjugateGradient(float4 *gradientCuda,
return make_double2(dgg, gg);
};

float gam;
double gam;
thrust::counting_iterator<int> it(0);
const double2 gg = thrust::transform_reduce(thrust::device, it, it + nVoxels, [=]__device__(const int index) {
return calcGam(gradientTexture, conjugateGTexture, conjugateHTexture, index);
Expand All @@ -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<double2>());
gam = static_cast<float>((gg.x + ggBw.x) / (gg.y + ggBw.y));
} else gam = static_cast<float>(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,
Expand Down

0 comments on commit 7e1e926

Please sign in to comment.