1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-24 12:45:56 +01:00

Mixed precision changes

This commit is contained in:
Quadro 2021-06-01 13:39:33 -04:00
parent 2f3a96e5de
commit 9164cfbfc6

View File

@ -32,26 +32,22 @@ NAMESPACE_BEGIN(Grid);
/////////////////////////////////////// ///////////////////////////////////////
// Two flavour ratio // Two flavour ratio
/////////////////////////////////////// ///////////////////////////////////////
template<class Impl> template<class ImplD,class ImplF>
class DomainDecomposedBoundaryTwoFlavourBosonPseudoFermion : public Action<typename Impl::GaugeField> { class DomainDecomposedBoundaryTwoFlavourBosonPseudoFermion : public Action<typename ImplD::GaugeField> {
public: public:
INHERIT_IMPL_TYPES(Impl); INHERIT_IMPL_TYPES(ImplD);
private: private:
SchurFactoredFermionOperator<Impl> & NumOp;// the basic operator SchurFactoredFermionOperator<ImplD,ImplF> & NumOp;// the basic operator
RealD ActionStoppingCondition;
OperatorFunction<FermionField> &DerivativeSolver; RealD DerivativeStoppingCondition;
OperatorFunction<FermionField> &ActionSolver;
FermionField Phi; // the pseudo fermion field for this trajectory FermionField Phi; // the pseudo fermion field for this trajectory
public: public:
DomainDecomposedBoundaryTwoFlavourBosonPseudoFermion(SchurFactoredFermionOperator<Impl> &_NumOp, DomainDecomposedBoundaryTwoFlavourBosonPseudoFermion(SchurFactoredFermionOperator<ImplD,ImplF> &_NumOp,RealD _DerivativeTol, RealD _ActionTol)
OperatorFunction<FermionField> & DS, : NumOp(_NumOp),
OperatorFunction<FermionField> & AS DerivativeStoppingCondition(_DerivativeTol),
) : NumOp(_NumOp), ActionStoppingCondition(_ActionTol),
DerivativeSolver(DS), ActionSolver(AS), Phi(_NumOp.FermionGrid()) {};
Phi(_NumOp.FermOp.FermionGrid()) {};
virtual std::string action_name(){return "DomainDecomposedBoundaryTwoFlavourBosonPseudoFermion";} virtual std::string action_name(){return "DomainDecomposedBoundaryTwoFlavourBosonPseudoFermion";}
@ -77,16 +73,17 @@ public:
// //
RealD scale = std::sqrt(0.5); RealD scale = std::sqrt(0.5);
NumOp.tol=ActionStoppingCondition;
NumOp.ImportGauge(U); NumOp.ImportGauge(U);
FermionField eta(NumOp.FermOp.FermionGrid()); FermionField eta(NumOp.FermionGrid());
gaussian(pRNG,eta); eta=eta*scale; gaussian(pRNG,eta); eta=eta*scale;
NumOp.ProjectBoundaryBar(eta); NumOp.ProjectBoundaryBar(eta);
NumOp.RInv(eta,Phi); NumOp.RInv(eta,Phi);
DumpSliceNorm("Phi",Phi,-1); //DumpSliceNorm("Phi",Phi,-1);
}; };
@ -95,9 +92,10 @@ public:
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
virtual RealD S(const GaugeField &U) { virtual RealD S(const GaugeField &U) {
NumOp.tol=ActionStoppingCondition;
NumOp.ImportGauge(U); NumOp.ImportGauge(U);
FermionField Y(NumOp.FermOp.FermionGrid()); FermionField Y(NumOp.FermionGrid());
NumOp.R(Phi,Y); NumOp.R(Phi,Y);
@ -108,10 +106,11 @@ public:
virtual void deriv(const GaugeField &U,GaugeField & dSdU) virtual void deriv(const GaugeField &U,GaugeField & dSdU)
{ {
NumOp.tol=DerivativeStoppingCondition;
NumOp.ImportGauge(U); NumOp.ImportGauge(U);
GridBase *fgrid = NumOp.FermOp.FermionGrid(); GridBase *fgrid = NumOp.FermionGrid();
GridBase *ugrid = NumOp.FermOp.GaugeGrid(); GridBase *ugrid = NumOp.GaugeGrid();
FermionField X(fgrid); FermionField X(fgrid);
FermionField Y(fgrid); FermionField Y(fgrid);
@ -142,13 +141,13 @@ public:
X = DobiDdbPhi; X = DobiDdbPhi;
Y = DobidDddDoidP_Phi; Y = DobidDddDoidP_Phi;
NumOp.DirichletFermOp.MDeriv(force,Y,X,DaggerNo); dSdU=force; NumOp.DirichletFermOpD.MDeriv(force,Y,X,DaggerNo); dSdU=force;
NumOp.DirichletFermOp.MDeriv(force,X,Y,DaggerYes); dSdU=dSdU+force; NumOp.DirichletFermOpD.MDeriv(force,X,Y,DaggerYes); dSdU=dSdU+force;
X = DoiDdDobiDdbPhi; X = DoiDdDobiDdbPhi;
Y = DoidP_Phi; Y = DoidP_Phi;
NumOp.DirichletFermOp.MDeriv(force,Y,X,DaggerNo); dSdU=dSdU+force; NumOp.DirichletFermOpD.MDeriv(force,Y,X,DaggerNo); dSdU=dSdU+force;
NumOp.DirichletFermOp.MDeriv(force,X,Y,DaggerYes); dSdU=dSdU+force; NumOp.DirichletFermOpD.MDeriv(force,X,Y,DaggerYes); dSdU=dSdU+force;
dSdU *= -1.0; dSdU *= -1.0;