From bc67e2c584feac712856b87162bff5913f5a9df3 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Wed, 26 Aug 2026 17:58:18 -0400 Subject: [PATCH] abs thrust issue --- Grid/algorithms/multigrid/Smoothers.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Grid/algorithms/multigrid/Smoothers.h b/Grid/algorithms/multigrid/Smoothers.h index 938a188e2..1fce1cdb7 100644 --- a/Grid/algorithms/multigrid/Smoothers.h +++ b/Grid/algorithms/multigrid/Smoothers.h @@ -215,17 +215,22 @@ public: mmax = c.mmax; GRID_ASSERT(mmax>=1); nstep = c.Steps(); GRID_ASSERT(nstep>=1); a.resize(nstep); b.resize(nstep); + // No std::abs / std::isfinite on ComplexD: it is thrust::complex on HIP + // builds and neither overload exists. Work on the real and imaginary + // parts explicitly. + auto finite = [](ComplexD z){ RealD x=real(z), y=imag(z); return (x==x) && (y==y) && (x-x==0.0) && (y-y==0.0); }; + auto cabs = [](ComplexD z){ RealD x=real(z), y=imag(z); return std::sqrt(x*x+y*y); }; RealD amax=0.0, bmax=0.0; for(int k=0;k