diff --git a/Grid/algorithms/Algorithms.h b/Grid/algorithms/Algorithms.h index 970e0237..b716c48f 100644 --- a/Grid/algorithms/Algorithms.h +++ b/Grid/algorithms/Algorithms.h @@ -31,7 +31,6 @@ Author: Peter Boyle #include #include -#include #include #include diff --git a/Grid/algorithms/SchurDiagTwoKappa.h b/Grid/algorithms/SchurDiagTwoKappa.h deleted file mode 100644 index 1545c245..00000000 --- a/Grid/algorithms/SchurDiagTwoKappa.h +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************************* - - Grid physics library, www.github.com/paboyle/Grid - - Source file: SchurDiagTwoKappa.h - - Copyright (C) 2017 - -Author: Christoph Lehner -Author: Peter Boyle - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - See the full license in the file "LICENSE" in the top level distribution directory -*************************************************************************************/ -/* END LEGAL */ -#pragma once - -NAMESPACE_BEGIN(Grid); - -// This is specific to (Z)mobius fermions -template -class KappaSimilarityTransform { -public: - INHERIT_IMPL_TYPES(Matrix); - Vector kappa, kappaDag, kappaInv, kappaInvDag; - - KappaSimilarityTransform (Matrix &zmob) { - for (int i=0;i<(int)zmob.bs.size();i++) { - Coeff_t k = 1.0 / ( 2.0 * (zmob.bs[i] *(4 - zmob.M5) + 1.0) ); - kappa.push_back( k ); - kappaDag.push_back( conj(k) ); - kappaInv.push_back( 1.0 / k ); - kappaInvDag.push_back( 1.0 / conj(k) ); - } - } - - template - void sscale(const Lattice& in, Lattice& out, Coeff_t* s) { - GridBase *grid=out.Grid(); - out.Checkerboard() = in.Checkerboard(); - assert(grid->_simd_layout[0] == 1); // should be fine for ZMobius for now - int Ls = grid->_rdimensions[0]; - thread_for(ss, grid->oSites(), - { - vobj tmp = s[ss % Ls]*in[ss]; - vstream(out[ss],tmp); - }); - } - - RealD sscale_norm(const Field& in, Field& out, Coeff_t* s) { - sscale(in,out,s); - return norm2(out); - } - - virtual RealD M (const Field& in, Field& out) { return sscale_norm(in,out,&kappa[0]); } - virtual RealD MDag (const Field& in, Field& out) { return sscale_norm(in,out,&kappaDag[0]);} - virtual RealD MInv (const Field& in, Field& out) { return sscale_norm(in,out,&kappaInv[0]);} - virtual RealD MInvDag (const Field& in, Field& out) { return sscale_norm(in,out,&kappaInvDag[0]);} - -}; - -template -class SchurDiagTwoKappaOperator : public SchurOperatorBase { -public: - KappaSimilarityTransform _S; - SchurDiagTwoOperator _Mat; - - SchurDiagTwoKappaOperator (Matrix &Mat): _S(Mat), _Mat(Mat) {}; - - virtual RealD Mpc (const Field &in, Field &out) { - Field tmp(in.Grid()); - - _S.MInv(in,out); - _Mat.Mpc(out,tmp); - return _S.M(tmp,out); - - } - virtual RealD MpcDag (const Field &in, Field &out){ - Field tmp(in.Grid()); - - _S.MDag(in,out); - _Mat.MpcDag(out,tmp); - return _S.MInvDag(tmp,out); - } -}; - -NAMESPACE_END(Grid); - - diff --git a/Grid/qcd/action/fermion/Fermion.h b/Grid/qcd/action/fermion/Fermion.h index 67a1872f..fb6f18bb 100644 --- a/Grid/qcd/action/fermion/Fermion.h +++ b/Grid/qcd/action/fermion/Fermion.h @@ -95,6 +95,7 @@ NAMESPACE_CHECK(WilsonTM5); //////////////////////////////////////////////////////////////////////////////// // Move this group to a DWF specific tools/algorithms subdir? //////////////////////////////////////////////////////////////////////////////// +#include #include #include #include diff --git a/Grid/qcd/action/fermion/SchurDiagTwoKappa.h b/Grid/qcd/action/fermion/SchurDiagTwoKappa.h index b6ab8a55..1545c245 100644 --- a/Grid/qcd/action/fermion/SchurDiagTwoKappa.h +++ b/Grid/qcd/action/fermion/SchurDiagTwoKappa.h @@ -26,8 +26,7 @@ Author: Peter Boyle See the full license in the file "LICENSE" in the top level distribution directory *************************************************************************************/ /* END LEGAL */ -#ifndef _SCHUR_DIAG_TWO_KAPPA_H -#define _SCHUR_DIAG_TWO_KAPPA_H +#pragma once NAMESPACE_BEGIN(Grid); @@ -54,7 +53,8 @@ public: out.Checkerboard() = in.Checkerboard(); assert(grid->_simd_layout[0] == 1); // should be fine for ZMobius for now int Ls = grid->_rdimensions[0]; - thread_loop( (int ss=0;ssoSites();ss++),{ + thread_for(ss, grid->oSites(), + { vobj tmp = s[ss % Ls]*in[ss]; vstream(out[ss],tmp); }); @@ -99,4 +99,4 @@ public: NAMESPACE_END(Grid); -#endif + diff --git a/Grid/qcd/action/fermion/implementation/CayleyFermion5Dgpu.h b/Grid/qcd/action/fermion/implementation/CayleyFermion5Dgpu.h deleted file mode 100644 index d43375a8..00000000 --- a/Grid/qcd/action/fermion/implementation/CayleyFermion5Dgpu.h +++ /dev/null @@ -1,268 +0,0 @@ -/************************************************************************************* - - Grid physics library, www.github.com/paboyle/Grid - - Source file: ./lib/qcd/action/fermion/CayleyFermion5D.cc - - Copyright (C) 2015 - -Author: Peter Boyle -Author: Peter Boyle -Author: Peter Boyle -Author: paboyle - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - See the full license in the file "LICENSE" in the top level distribution directory -*************************************************************************************/ -/* END LEGAL */ - -#include -#include - - -NAMESPACE_BEGIN(Grid); - -// Pminus fowards -// Pplus backwards.. -template -void CayleyFermion5D::M5D(const FermionField &psi_i, - const FermionField &phi_i, - FermionField &chi_i, - Vector &lower, - Vector &diag, - Vector &upper) -{ - chi_i.Checkerboard()=psi_i.Checkerboard(); - GridBase *grid=psi_i.Grid(); - auto psi = psi_i.View(); - auto phi = phi_i.View(); - auto chi = chi_i.View(); - Coeff_t *lower_v = &lower[0]; - Coeff_t *diag_v = &diag[0]; - Coeff_t *upper_v = &upper[0]; - int Ls =this->Ls; - assert(phi.Checkerboard() == psi.Checkerboard()); - - const uint64_t nsimd = grid->Nsimd(); - const uint64_t sites4d = nsimd * grid->oSites() / Ls; - - // 10 = 3 complex mult + 2 complex add - // Flops = 10.0*(Nc*Ns) *Ls*vol (/2 for red black counting) - M5Dcalls++; - M5Dtime-=usecond(); - - accelerator_loopN( sss, sites4d ,{ - uint64_t lane = sss % nsimd; - uint64_t ss = Ls * (sss / nsimd); - - for(int s=0;s -void CayleyFermion5D::M5Ddag(const FermionField &psi_i, - const FermionField &phi_i, - FermionField &chi_i, - Vector &lower, - Vector &diag, - Vector &upper) -{ - chi_i.Checkerboard()=psi_i.Checkerboard(); - GridBase *grid=psi_i.Grid(); - auto psi = psi_i.View(); - auto phi = phi_i.View(); - auto chi = chi_i.View(); - Coeff_t *lower_v = &lower[0]; - Coeff_t *diag_v = &diag[0]; - Coeff_t *upper_v = &upper[0]; - int Ls =this->Ls; - assert(phi.Checkerboard() == psi.Checkerboard()); - - const uint64_t nsimd = grid->Nsimd(); - const uint64_t sites4d = nsimd * grid->oSites() / Ls; - - // 10 = 3 complex mult + 2 complex add - // Flops = 10.0*(Nc*Ns) *Ls*vol (/2 for red black counting) - M5Dcalls++; - M5Dtime-=usecond(); - - accelerator_loopN( sss, sites4d ,{ - uint64_t lane = sss % nsimd; - uint64_t ss = Ls * (sss / nsimd); - - for(int s=0;s -void CayleyFermion5D::MooeeInv (const FermionField &psi_i, FermionField &chi_i) -{ - chi_i.Checkerboard()=psi_i.Checkerboard(); - GridBase *grid=psi_i.Grid(); - - auto psi = psi_i.View(); - auto chi = chi_i.View(); - Coeff_t *lee_v = &lee[0]; - Coeff_t *leem_v = &leem[0]; - Coeff_t *uee_v = &uee[0]; - Coeff_t *ueem_v = &ueem[0]; - Coeff_t *dee_v = &dee[0]; - - int Ls=this->Ls; - const uint64_t nsimd = grid->Nsimd(); - const uint64_t sites4d = nsimd * grid->oSites() / Ls; - - typedef typename SiteSpinor::scalar_object ScalarSiteSpinor; - - MooeeInvCalls++; - MooeeInvTime-=usecond(); - - accelerator_loopN( sss, sites4d ,{ - uint64_t lane = sss % nsimd; - uint64_t ss = Ls * (sss / nsimd); - ScalarSiteSpinor res, tmp, acc; - - // X = Nc*Ns - // flops = 2X + (Ls-2)(4X + 4X) + 6X + 1 + 2X + (Ls-1)(10X + 1) = -16X + Ls(1+18X) = -192 + 217*Ls flops - // Apply (L^{\prime})^{-1} L_m^{-1} - res = extractLane(lane,psi[ss]); - spProj5m(tmp,res); - acc = leem_v[0]*tmp; - spProj5p(tmp,res); - insertLane(lane,chi[ss],res); - - for(int s=1;s=0;s--){ - res = extractLane(lane,chi[ss+s]); - res = (1.0/dee_v[s])*res - uee_v[s]*tmp - ueem_v[s]*acc; - spProj5m(tmp,res); - insertLane(lane,chi[ss+s],res); - } - }); - - MooeeInvTime+=usecond(); - -} - -template -void CayleyFermion5D::MooeeInvDag (const FermionField &psi_i, FermionField &chi_i) -{ - chi_i.Checkerboard()=psi_i.Checkerboard(); - GridBase *grid=psi_i.Grid(); - - auto psi = psi_i.View(); - auto chi = chi_i.View(); - Coeff_t *lee_v = &lee[0]; - Coeff_t *leem_v = &leem[0]; - Coeff_t *uee_v = &uee[0]; - Coeff_t *ueem_v = &ueem[0]; - Coeff_t *dee_v = &dee[0]; - - int Ls=this->Ls; - const uint64_t nsimd = grid->Nsimd(); - const uint64_t sites4d = nsimd * grid->oSites() / Ls; - - typedef typename SiteSpinor::scalar_object ScalarSiteSpinor; - - MooeeInvCalls++; - MooeeInvTime-=usecond(); - - accelerator_loopN( sss, sites4d ,{ - uint64_t lane = sss % nsimd; - uint64_t ss = Ls * (sss / nsimd); - ScalarSiteSpinor res, tmp, acc; - - // X = Nc*Ns - // flops = 2X + (Ls-2)(4X + 4X) + 6X + 1 + 2X + (Ls-1)(10X + 1) = -16X + Ls(1+18X) = -192 + 217*Ls flops - // Apply (U^{\prime})^{-dagger} U_m^{-\dagger} - res = extractLane(lane,psi[ss]); - spProj5p(tmp,res); - acc = conjugate(ueem_v[0])*tmp; - spProj5m(tmp,res); - insertLane(lane,chi[ss],res); - - for(int s=1;s=0;s--){ - res = extractLane(lane,chi[ss+s]); - res = conjugate(1.0/dee_v[s])*res - conjugate(lee_v[s])*tmp - conjugate(leem_v[s])*acc; - spProj5p(tmp,res); - insertLane(lane,chi[ss+s],res); - } - }); - - MooeeInvTime+=usecond(); - -} - -NAMESPACE_END(Grid); diff --git a/Grid/qcd/action/fermion/implementation/MobiusEOFAFermionCache.h b/Grid/qcd/action/fermion/implementation/MobiusEOFAFermionCache.h index 7752cbbe..5825c06a 100644 --- a/Grid/qcd/action/fermion/implementation/MobiusEOFAFermionCache.h +++ b/Grid/qcd/action/fermion/implementation/MobiusEOFAFermionCache.h @@ -352,7 +352,7 @@ void MobiusEOFAFermion::MooeeInvDag(const FermionField &psi_i, FermionFiel // Apply L^{-dag} for(int s=Ls-2; s>=0; s--){ - spProj5p(tmp, chi[ss+s+1]); + spProj5p(tmp, chi(ss+s+1)); coalescedWrite(chi[ss+s], chi(ss+s) - this->lee[s]*tmp); } }); diff --git a/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplD/ImprovedStaggeredFermion5DInstantiationStaggeredVec5dImplD.cc b/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplD/ImprovedStaggeredFermion5DInstantiationStaggeredVec5dImplD.cc deleted file mode 120000 index a8082840..00000000 --- a/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplD/ImprovedStaggeredFermion5DInstantiationStaggeredVec5dImplD.cc +++ /dev/null @@ -1 +0,0 @@ -../ImprovedStaggeredFermion5DInstantiation.cc.master \ No newline at end of file diff --git a/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplD/StaggeredKernelsInstantiationStaggeredVec5dImplD.cc b/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplD/StaggeredKernelsInstantiationStaggeredVec5dImplD.cc deleted file mode 120000 index a4d1cbc9..00000000 --- a/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplD/StaggeredKernelsInstantiationStaggeredVec5dImplD.cc +++ /dev/null @@ -1 +0,0 @@ -../StaggeredKernelsInstantiation.cc.master \ No newline at end of file diff --git a/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplD/impl.h b/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplD/impl.h deleted file mode 100644 index a91aa2fe..00000000 --- a/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplD/impl.h +++ /dev/null @@ -1 +0,0 @@ -#define IMPLEMENTATION StaggeredVec5dImplD diff --git a/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplF/ImprovedStaggeredFermion5DInstantiationStaggeredVec5dImplF.cc b/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplF/ImprovedStaggeredFermion5DInstantiationStaggeredVec5dImplF.cc deleted file mode 120000 index a8082840..00000000 --- a/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplF/ImprovedStaggeredFermion5DInstantiationStaggeredVec5dImplF.cc +++ /dev/null @@ -1 +0,0 @@ -../ImprovedStaggeredFermion5DInstantiation.cc.master \ No newline at end of file diff --git a/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplF/StaggeredKernelsInstantiationStaggeredVec5dImplF.cc b/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplF/StaggeredKernelsInstantiationStaggeredVec5dImplF.cc deleted file mode 120000 index a4d1cbc9..00000000 --- a/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplF/StaggeredKernelsInstantiationStaggeredVec5dImplF.cc +++ /dev/null @@ -1 +0,0 @@ -../StaggeredKernelsInstantiation.cc.master \ No newline at end of file diff --git a/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplF/impl.h b/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplF/impl.h deleted file mode 100644 index 278770da..00000000 --- a/Grid/qcd/action/fermion/instantiation/StaggeredVec5dImplF/impl.h +++ /dev/null @@ -1 +0,0 @@ -#define IMPLEMENTATION StaggeredVec5dImplF diff --git a/Grid/qcd/action/fermion/instantiation/generate_instantiations.sh b/Grid/qcd/action/fermion/instantiation/generate_instantiations.sh index 96aec953..330dcfa8 100755 --- a/Grid/qcd/action/fermion/instantiation/generate_instantiations.sh +++ b/Grid/qcd/action/fermion/instantiation/generate_instantiations.sh @@ -4,9 +4,7 @@ STAG_IMPL_LIST=" \ StaggeredImplF \ StaggeredImplD " -STAG5_IMPL_LIST=" \ - StaggeredVec5dImplF \ - StaggeredVec5dImplD " +STAG5_IMPL_LIST="" WILSON_IMPL_LIST=" \ WilsonImplF \ @@ -41,7 +39,7 @@ GDWF_IMPL_LIST=" \ GparityWilsonImplDF" -IMPL_LIST="$STAG_IMPL_LIST $STAG5_IMPL_LIST $WILSON_IMPL_LIST $DWF_IMPL_LIST $GDWF_IMPL_LIST" +IMPL_LIST="$STAG_IMPL_LIST $WILSON_IMPL_LIST $DWF_IMPL_LIST $GDWF_IMPL_LIST" for impl in $IMPL_LIST do @@ -104,10 +102,3 @@ CC_LIST=" \ ImprovedStaggeredFermion5DInstantiation \ StaggeredKernelsInstantiation " -for impl in $STAG5_IMPL_LIST -do -for f in $CC_LIST -do - ln -f -s ../$f.cc.master $impl/$f$impl.cc -done -done