1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-09 23:45:36 +00:00

Compile fix

This commit is contained in:
Peter Boyle 2019-06-15 17:03:15 +01:00
parent f710d7bd45
commit d7b3efe893
13 changed files with 8 additions and 393 deletions

View File

@ -31,7 +31,6 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
#include <Grid/algorithms/SparseMatrix.h>
#include <Grid/algorithms/LinearOperator.h>
#include <Grid/algorithms/SchurDiagTwoKappa.h>
#include <Grid/algorithms/Preconditioner.h>
#include <Grid/algorithms/approx/Zolotarev.h>

View File

@ -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 <paboyle@ph.ed.ac.uk>
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 Matrix, class Field>
class KappaSimilarityTransform {
public:
INHERIT_IMPL_TYPES(Matrix);
Vector<Coeff_t> 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<typename vobj>
void sscale(const Lattice<vobj>& in, Lattice<vobj>& 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 Matrix,class Field>
class SchurDiagTwoKappaOperator : public SchurOperatorBase<Field> {
public:
KappaSimilarityTransform<Matrix, Field> _S;
SchurDiagTwoOperator<Matrix, Field> _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);

View File

@ -95,6 +95,7 @@ NAMESPACE_CHECK(WilsonTM5);
////////////////////////////////////////////////////////////////////////////////
// Move this group to a DWF specific tools/algorithms subdir?
////////////////////////////////////////////////////////////////////////////////
#include <Grid/qcd/action/fermion/SchurDiagTwoKappa.h>
#include <Grid/qcd/action/fermion/FourierAcceleratedPV.h>
#include <Grid/qcd/action/fermion/PauliVillarsInverters.h>
#include <Grid/qcd/action/fermion/Reconstruct5Dprop.h>

View File

@ -26,8 +26,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
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;ss<grid->oSites();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

View File

@ -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 <pabobyle@ph.ed.ac.uk>
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
Author: Peter Boyle <peterboyle@Peters-MacBook-Pro-2.local>
Author: paboyle <paboyle@ph.ed.ac.uk>
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 <Grid/qcd/action/fermion/FermionCore.h>
#include <Grid/qcd/action/fermion/CayleyFermion5D.h>
NAMESPACE_BEGIN(Grid);
// Pminus fowards
// Pplus backwards..
template<class Impl>
void CayleyFermion5D<Impl>::M5D(const FermionField &psi_i,
const FermionField &phi_i,
FermionField &chi_i,
Vector<Coeff_t> &lower,
Vector<Coeff_t> &diag,
Vector<Coeff_t> &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<Ls;s++){
auto res = extractLane(lane,phi[ss+s]);
res = diag_v[s]*res;
auto tmp = extractLane(lane,psi[ss+(s+1)%Ls]);
spProj5m(tmp,tmp);
res += upper_v[s]*tmp;
tmp = extractLane(lane,psi[ss+(s+Ls-1)%Ls]);
spProj5p(tmp,tmp);
res += lower_v[s]*tmp;
insertLane(lane,chi[ss+s],res);
}
});
M5Dtime+=usecond();
}
template<class Impl>
void CayleyFermion5D<Impl>::M5Ddag(const FermionField &psi_i,
const FermionField &phi_i,
FermionField &chi_i,
Vector<Coeff_t> &lower,
Vector<Coeff_t> &diag,
Vector<Coeff_t> &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<Ls;s++){
auto res = extractLane(lane,phi[ss+s]);
res = diag_v[s]*res;
auto tmp = extractLane(lane,psi[ss+(s+1)%Ls]);
spProj5p(tmp,tmp);
res += upper_v[s]*tmp;
tmp = extractLane(lane,psi[ss+(s+Ls-1)%Ls]);
spProj5m(tmp,tmp);
res += lower_v[s]*tmp;
insertLane(lane,chi[ss+s],res);
}
});
M5Dtime+=usecond();
}
template<class Impl>
void CayleyFermion5D<Impl>::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<Ls-1;s++){
res = extractLane(lane,psi[ss+s]);
res -= lee_v[s-1]*tmp;
spProj5m(tmp,res);
acc += leem_v[s]*tmp;
spProj5p(tmp,res);
insertLane(lane,chi[ss+s],res);
}
res = extractLane(lane,psi[ss+Ls-1]);
res = res - lee_v[Ls-2]*tmp - acc;
// Apply U_m^{-1} D^{-1} U^{-1}
res = (1.0/dee_v[Ls-1])*res;
insertLane(lane,chi[ss+Ls-1],res);
spProj5p(acc,res);
spProj5m(tmp,res);
for (int s=Ls-2;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<class Impl>
void CayleyFermion5D<Impl>::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<Ls-1;s++){
res = extractLane(lane,psi[ss+s]);
res -= conjugate(uee_v[s-1])*tmp;
spProj5p(tmp,res);
acc += conjugate(ueem_v[s])*tmp;
spProj5m(tmp,res);
insertLane(lane,chi[ss+s],res);
}
res = extractLane(lane,psi[ss+Ls-1]);
res = res - conjugate(uee_v[Ls-2])*tmp - acc;
// Apply L_m^{-\dagger} D^{-dagger} L^{-dagger}
res = conjugate(1.0/dee_v[Ls-1])*res;
insertLane(lane,chi[ss+Ls-1],res);
spProj5m(acc,res);
spProj5p(tmp,res);
for (int s=Ls-2;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);

View File

@ -352,7 +352,7 @@ void MobiusEOFAFermion<Impl>::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);
}
});

View File

@ -1 +0,0 @@
../ImprovedStaggeredFermion5DInstantiation.cc.master

View File

@ -1 +0,0 @@
#define IMPLEMENTATION StaggeredVec5dImplD

View File

@ -1 +0,0 @@
../ImprovedStaggeredFermion5DInstantiation.cc.master

View File

@ -1 +0,0 @@
#define IMPLEMENTATION StaggeredVec5dImplF

View File

@ -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