From 22c654182af30273d55eb3df55fa52faecb00c07 Mon Sep 17 00:00:00 2001 From: Michael Marshall <43034299+mmphys@users.noreply.github.com> Date: Mon, 4 Nov 2019 17:24:34 +0000 Subject: [PATCH] Fixes for GPU compile --- Grid/qcd/utils/BaryonUtils.h | 16 ++++++++-------- Hadrons/Modules/MDistil/DistilCommon.hpp | 3 ++- Hadrons/Modules/MDistil/Perambulator.hpp | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Grid/qcd/utils/BaryonUtils.h b/Grid/qcd/utils/BaryonUtils.h index 73d41422..ad3236da 100644 --- a/Grid/qcd/utils/BaryonUtils.h +++ b/Grid/qcd/utils/BaryonUtils.h @@ -43,7 +43,7 @@ public: typedef typename ComplexField::vector_object vobj; static constexpr int epsilon[6][3] = {{0,1,2},{1,2,0},{2,0,1},{0,2,1},{2,1,0},{1,0,2}}; - static constexpr Complex epsilon_sgn[6]= {1,1,1,-1,-1,-1}; + static constexpr int epsilon_sgn[6]= {1,1,1,-1,-1,-1}; private: template @@ -86,7 +86,7 @@ public: template constexpr int BaryonUtils::epsilon[6][3]; template -constexpr Complex BaryonUtils::epsilon_sgn[6]; +constexpr int BaryonUtils::epsilon_sgn[6]; template template @@ -123,7 +123,7 @@ void BaryonUtils::baryon_site(const mobj &D1, for (int alpha_right=0; alpha_right(epsilon_sgn[ie_left] * epsilon_sgn[ie_right]) * pD1()(gamma_left,gamma_left)(c_right,c_left)*D2g()(alpha_right,beta_left)(a_right,a_left)*gD3()(alpha_right,beta_left)(b_right,b_left); }}} } //This is the \delta_{456}^{231} part @@ -132,7 +132,7 @@ void BaryonUtils::baryon_site(const mobj &D1, for (int alpha_right=0; alpha_right(epsilon_sgn[ie_left] * epsilon_sgn[ie_right]) * pD1g()(gamma_left,beta_left)(c_right,a_left)*D2()(alpha_right,beta_left)(a_right,b_left)*gD3()(alpha_right,gamma_left)(b_right,c_left); }}} } //This is the \delta_{456}^{312} part @@ -141,7 +141,7 @@ void BaryonUtils::baryon_site(const mobj &D1, for (int alpha_right=0; alpha_right(epsilon_sgn[ie_left] * epsilon_sgn[ie_right]) * pD1()(gamma_left,beta_left)(c_right,b_left)*D2()(alpha_right,gamma_left)(a_right,c_left)*gD3g()(alpha_right,beta_left)(b_right,a_left); }}} } //This is the \delta_{456}^{132} part @@ -150,7 +150,7 @@ void BaryonUtils::baryon_site(const mobj &D1, for (int alpha_right=0; alpha_right(epsilon_sgn[ie_left] * epsilon_sgn[ie_right]) * pD1()(gamma_left,gamma_left)(c_right,c_left)*D2()(alpha_right,beta_left)(a_right,b_left)*gD3g()(alpha_right,beta_left)(b_right,a_left); }}} } //This is the \delta_{456}^{321} part @@ -159,7 +159,7 @@ void BaryonUtils::baryon_site(const mobj &D1, for (int alpha_right=0; alpha_right(epsilon_sgn[ie_left] * epsilon_sgn[ie_right]) * pD1()(gamma_left,beta_left)(c_right,b_left)*D2g()(alpha_right,beta_left)(a_right,a_left)*gD3()(alpha_right,gamma_left)(b_right,c_left); }}} } //This is the \delta_{456}^{213} part @@ -168,7 +168,7 @@ void BaryonUtils::baryon_site(const mobj &D1, for (int alpha_right=0; alpha_right(epsilon_sgn[ie_left] * epsilon_sgn[ie_right]) * pD1g()(gamma_left,beta_left)(c_right,a_left)*D2()(alpha_right,gamma_left)(a_right,c_left)*gD3()(alpha_right,beta_left)(b_right,b_left); }}} } } diff --git a/Hadrons/Modules/MDistil/DistilCommon.hpp b/Hadrons/Modules/MDistil/DistilCommon.hpp index 96621367..16b87bf1 100644 --- a/Hadrons/Modules/MDistil/DistilCommon.hpp +++ b/Hadrons/Modules/MDistil/DistilCommon.hpp @@ -115,11 +115,12 @@ inline void RotateEigen(std::vector & evec) if( cplx0.imag() == 0 ) std::cout << GridLogMessage << "RotateEigen() : Site 0 : " << cplx0 << " => already meets phase convention" << std::endl; else { - const Real cplx0_mag = Grid::abs(cplx0); #ifdef GRID_NVCC + const Real cplx0_mag = thrust::abs(cplx0); const Grid::Complex phase = thrust::conj(cplx0 / cplx0_mag); const Real argphase = thrust::arg(phase); #else + const Real cplx0_mag = std::abs(cplx0); const Grid::Complex phase = std::conj(cplx0 / cplx0_mag); const Real argphase = std::arg(phase); #endif diff --git a/Hadrons/Modules/MDistil/Perambulator.hpp b/Hadrons/Modules/MDistil/Perambulator.hpp index b4339656..e2ab7e0d 100644 --- a/Hadrons/Modules/MDistil/Perambulator.hpp +++ b/Hadrons/Modules/MDistil/Perambulator.hpp @@ -240,7 +240,7 @@ void TPerambulator::execute(void) for (int ivec = 0; ivec < nvec; ivec++) { ExtractSliceLocal(evec3d,epack.evec[ivec],0,t-Ntfirst,Tdir); - pokeSpin(perambulator.tensor(t, ivec, dk, inoise,dt,ds),innerProduct(evec3d, result_3d),is); + pokeSpin(perambulator.tensor(t, ivec, dk, inoise,dt,ds),static_cast(innerProduct(evec3d, result_3d)),is); } } }