mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-10-31 20:14:32 +00:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			feature/bo
			...
			b15d9b294c
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | b15d9b294c | ||
| 32e6d58356 | 
| @@ -419,15 +419,14 @@ until convergence | ||||
| 	} | ||||
|       } | ||||
|  | ||||
|       if ( Nconv < Nstop ) { | ||||
|       if ( Nconv < Nstop ) | ||||
| 	std::cout << GridLogIRL << "Nconv ("<<Nconv<<") < Nstop ("<<Nstop<<")"<<std::endl; | ||||
| 	std::cout << GridLogIRL << "returning Nstop vectors, the last "<< Nstop-Nconv << "of which might meet convergence criterion only approximately" <<std::endl; | ||||
|       } | ||||
|  | ||||
|       eval=eval2; | ||||
|        | ||||
|       //Keep only converged | ||||
|       eval.resize(Nstop);// was Nconv | ||||
|       evec.resize(Nstop,grid);// was Nconv | ||||
|       eval.resize(Nconv);// Nstop? | ||||
|       evec.resize(Nconv,grid);// Nstop? | ||||
|       basisSortInPlace(evec,eval,reverse); | ||||
|        | ||||
|     } | ||||
|   | ||||
| @@ -44,7 +44,7 @@ public: | ||||
|   ConfigurationBase() {} | ||||
|   virtual ~ConfigurationBase() {} | ||||
|   virtual void set_Field(Field& U) =0; | ||||
|   virtual void smeared_force(Field&) = 0; | ||||
|   virtual void smeared_force(Field&) const = 0; | ||||
|   virtual Field& get_SmearedU() =0; | ||||
|   virtual Field &get_U(bool smeared = false) = 0; | ||||
| }; | ||||
|   | ||||
| @@ -124,11 +124,6 @@ public: | ||||
|   RealD                _b; | ||||
|   RealD                _c; | ||||
|  | ||||
|   // possible boost | ||||
|   std::vector<ComplexD> qmu; | ||||
|   void set_qmu(std::vector<ComplexD> _qmu) { qmu=_qmu; assert(qmu.size()==Nd);}; | ||||
|   void addQmu(const FermionField &in, FermionField &out, int dag); | ||||
|    | ||||
|   // Cayley form Moebius (tanh and zolotarev) | ||||
|   Vector<Coeff_t> omega; | ||||
|   Vector<Coeff_t> bs;    // S dependent coeffs | ||||
|   | ||||
| @@ -60,50 +60,6 @@ public: | ||||
|   //      virtual void   Instantiatable(void)=0; | ||||
|   virtual void   Instantiatable(void) =0; | ||||
|  | ||||
|   void FreePropagator(const FermionField &in,FermionField &out,RealD mass,std::vector<Complex> boundary, std::vector<double> twist) | ||||
|   { | ||||
|     std::cout << "Free Propagator for PartialFraction"<<std::endl; | ||||
|     FermionField in_k(in.Grid()); | ||||
|     FermionField prop_k(in.Grid()); | ||||
|      | ||||
|     FFT theFFT((GridCartesian *) in.Grid()); | ||||
|  | ||||
|     //phase for boundary condition | ||||
|     ComplexField coor(in.Grid()); | ||||
|     ComplexField ph(in.Grid());  ph = Zero(); | ||||
|     FermionField in_buf(in.Grid()); in_buf = Zero(); | ||||
|     typedef typename Simd::scalar_type Scalar; | ||||
|     Scalar ci(0.0,1.0); | ||||
|     assert(twist.size() == Nd);//check that twist is Nd | ||||
|     assert(boundary.size() == Nd);//check that boundary conditions is Nd | ||||
|     int shift = 0; | ||||
|     for(unsigned int nu = 0; nu < Nd; nu++) | ||||
|       { | ||||
| 	// Shift coordinate lattice index by 1 to account for 5th dimension. | ||||
| 	LatticeCoordinate(coor, nu + shift); | ||||
| 	double boundary_phase = ::acos(real(boundary[nu])); | ||||
| 	ph = ph + boundary_phase*coor*((1./(in.Grid()->_fdimensions[nu+shift]))); | ||||
| 	//momenta for propagator shifted by twist+boundary | ||||
| 	twist[nu] = twist[nu] + boundary_phase/((2.0*M_PI)); | ||||
|       } | ||||
|     in_buf = exp(ci*ph*(-1.0))*in; | ||||
|  | ||||
|     theFFT.FFT_all_dim(in_k,in,FFT::forward); | ||||
|     this->MomentumSpacePropagatorHw(prop_k,in_k,mass,twist); | ||||
|     theFFT.FFT_all_dim(out,prop_k,FFT::backward); | ||||
|      | ||||
|     //phase for boundary condition | ||||
|     out = out * exp(ci*ph); | ||||
|   }; | ||||
|  | ||||
|   virtual void FreePropagator(const FermionField &in,FermionField &out,RealD mass) { | ||||
|     std::vector<double> twist(Nd,0.0); //default: periodic boundarys in all directions | ||||
|     std::vector<Complex> boundary; | ||||
|     for(int i=0;i<Nd;i++) boundary.push_back(1);//default: periodic boundary conditions | ||||
|     FreePropagator(in,out,mass,boundary,twist); | ||||
|   }; | ||||
|  | ||||
|    | ||||
|   // Efficient support for multigrid coarsening | ||||
|   virtual void  Mdir (const FermionField &in, FermionField &out,int dir,int disp); | ||||
|   virtual void  MdirAll(const FermionField &in, std::vector<FermionField> &out); | ||||
|   | ||||
| @@ -39,7 +39,7 @@ class PartialFractionFermion5D : public WilsonFermion5D<Impl> | ||||
| public: | ||||
|   INHERIT_IMPL_TYPES(Impl); | ||||
|  | ||||
|   const int part_frac_chroma_convention=0; | ||||
|   const int part_frac_chroma_convention=1; | ||||
|  | ||||
|   void   Meooe_internal(const FermionField &in, FermionField &out,int dag); | ||||
|   void   Mooee_internal(const FermionField &in, FermionField &out,int dag); | ||||
| @@ -83,63 +83,12 @@ public: | ||||
| 			   GridRedBlackCartesian &FourDimRedBlackGrid, | ||||
| 			   RealD _mass,RealD M5,const ImplParams &p= ImplParams()); | ||||
|  | ||||
|   PartialFractionFermion5D(GaugeField &_Umu, | ||||
| 			   GridCartesian         &FiveDimGrid, | ||||
| 			   GridRedBlackCartesian &FiveDimRedBlackGrid, | ||||
| 			   GridCartesian         &FourDimGrid, | ||||
| 			   GridRedBlackCartesian &FourDimRedBlackGrid, | ||||
| 			   RealD _mass,RealD M5,std::vector<RealD> &_qmu,const ImplParams &p= ImplParams()); | ||||
|  | ||||
|   void FreePropagator(const FermionField &in,FermionField &out,RealD mass,std::vector<Complex> boundary, std::vector<double> twist) | ||||
|   { | ||||
|     std::cout << "Free Propagator for PartialFraction"<<std::endl; | ||||
|     FermionField in_k(in.Grid()); | ||||
|     FermionField prop_k(in.Grid()); | ||||
|      | ||||
|     FFT theFFT((GridCartesian *) in.Grid()); | ||||
|  | ||||
|     //phase for boundary condition | ||||
|     ComplexField coor(in.Grid()); | ||||
|     ComplexField ph(in.Grid());  ph = Zero(); | ||||
|     FermionField in_buf(in.Grid()); in_buf = Zero(); | ||||
|     typedef typename Simd::scalar_type Scalar; | ||||
|     Scalar ci(0.0,1.0); | ||||
|     assert(twist.size() == Nd);//check that twist is Nd | ||||
|     assert(boundary.size() == Nd);//check that boundary conditions is Nd | ||||
|     int shift = 0; | ||||
|     for(unsigned int nu = 0; nu < Nd; nu++) | ||||
|       { | ||||
| 	// Shift coordinate lattice index by 1 to account for 5th dimension. | ||||
| 	LatticeCoordinate(coor, nu + shift); | ||||
| 	double boundary_phase = ::acos(real(boundary[nu])); | ||||
| 	ph = ph + boundary_phase*coor*((1./(in.Grid()->_fdimensions[nu+shift]))); | ||||
| 	//momenta for propagator shifted by twist+boundary | ||||
| 	twist[nu] = twist[nu] + boundary_phase/((2.0*M_PI)); | ||||
|       } | ||||
|     in_buf = exp(ci*ph*(-1.0))*in; | ||||
|  | ||||
|     theFFT.FFT_all_dim(in_k,in,FFT::forward); | ||||
|     this->MomentumSpacePropagatorHw(prop_k,in_k,mass,twist); | ||||
|     theFFT.FFT_all_dim(out,prop_k,FFT::backward); | ||||
|      | ||||
|     //phase for boundary condition | ||||
|     out = out * exp(ci*ph); | ||||
|   }; | ||||
|  | ||||
|   virtual void FreePropagator(const FermionField &in,FermionField &out,RealD mass) { | ||||
|     std::vector<double> twist(Nd,0.0); //default: periodic boundarys in all directions | ||||
|     std::vector<Complex> boundary; | ||||
|     for(int i=0;i<Nd;i++) boundary.push_back(1);//default: periodic boundary conditions | ||||
|     FreePropagator(in,out,mass,boundary,twist); | ||||
|   }; | ||||
|    | ||||
| protected: | ||||
|  | ||||
|   virtual void SetCoefficientsTanh(Approx::zolotarev_data *zdata,RealD scale); | ||||
|   virtual void SetCoefficientsZolotarev(RealD zolo_hi,Approx::zolotarev_data *zdata); | ||||
|  | ||||
|   // Part frac | ||||
|   std::vector<RealD> qmu; | ||||
|   RealD mass; | ||||
|   RealD dw_diag; | ||||
|   RealD R; | ||||
|   | ||||
| @@ -48,8 +48,7 @@ CayleyFermion5D<Impl>::CayleyFermion5D(GaugeField &_Umu, | ||||
| 			FourDimGrid, | ||||
| 			FourDimRedBlackGrid,_M5,p), | ||||
|   mass_plus(_mass), mass_minus(_mass) | ||||
| { | ||||
|   // qmu defaults to zero size; | ||||
| {  | ||||
| } | ||||
|  | ||||
| /////////////////////////////////////////////////////////////// | ||||
| @@ -271,34 +270,6 @@ void CayleyFermion5D<Impl>::MeooeDag5D    (const FermionField &psi, FermionField | ||||
|   M5Ddag(psi,psi,Din,lower,diag,upper); | ||||
| } | ||||
|  | ||||
| template<class Impl> | ||||
| void CayleyFermion5D<Impl>::addQmu(const FermionField &psi,FermionField &chi, int dag) | ||||
| { | ||||
|   if ( qmu.size() ) { | ||||
|  | ||||
|     Gamma::Algebra Gmu [] = { | ||||
|       Gamma::Algebra::GammaX, | ||||
|       Gamma::Algebra::GammaY, | ||||
|       Gamma::Algebra::GammaZ, | ||||
|       Gamma::Algebra::GammaT | ||||
|     }; | ||||
|     std::vector<ComplexD> coeff(Nd); | ||||
|     ComplexD ci(0,1); | ||||
|  | ||||
|     assert(qmu.size()==Nd); | ||||
|  | ||||
|     for(int mu=0;mu<Nd;mu++){ | ||||
|        coeff[mu] = ci*qmu[mu]; | ||||
|        if ( dag ) coeff[mu] = conjugate(coeff[mu]); | ||||
|     } | ||||
|  | ||||
|     chi = chi + Gamma(Gmu[0])*psi*coeff[0]; | ||||
|     for(int mu=1;mu<Nd;mu++){ | ||||
|       chi = chi + Gamma(Gmu[mu])*psi*coeff[mu]; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| template<class Impl> | ||||
| void CayleyFermion5D<Impl>::M    (const FermionField &psi, FermionField &chi) | ||||
| { | ||||
| @@ -306,12 +277,8 @@ void CayleyFermion5D<Impl>::M    (const FermionField &psi, FermionField &chi) | ||||
|    | ||||
|   // Assemble Din | ||||
|   Meooe5D(psi,Din); | ||||
|  | ||||
|   this->DW(Din,chi,DaggerNo); | ||||
|  | ||||
|   // add i q_mu gamma_mu here | ||||
|   addQmu(Din,chi,DaggerNo); | ||||
|    | ||||
|   this->DW(Din,chi,DaggerNo); | ||||
|   // ((b D_W + D_w hop terms +1) on s-diag | ||||
|   axpby(chi,1.0,1.0,chi,psi);  | ||||
|    | ||||
| @@ -328,9 +295,6 @@ void CayleyFermion5D<Impl>::Mdag (const FermionField &psi, FermionField &chi) | ||||
|   FermionField Din(psi.Grid()); | ||||
|   // Apply Dw | ||||
|   this->DW(psi,Din,DaggerYes);  | ||||
|  | ||||
|   // add -i conj(q_mu) gamma_mu here ... if qmu is real, gammm_5 hermitian, otherwise not. | ||||
|   addQmu(psi,Din,DaggerYes); | ||||
|    | ||||
|   MeooeDag5D(Din,chi); | ||||
|    | ||||
|   | ||||
| @@ -42,13 +42,13 @@ template<class Impl> | ||||
| void ContinuedFractionFermion5D<Impl>::SetCoefficientsZolotarev(RealD zolo_hi,Approx::zolotarev_data *zdata) | ||||
| { | ||||
|   // How to check Ls matches?? | ||||
|   std::cout<<GridLogMessage << zdata->n  << " - n"<<std::endl; | ||||
|   std::cout<<GridLogMessage << zdata->da << " -da "<<std::endl; | ||||
|   std::cout<<GridLogMessage << zdata->db << " -db"<<std::endl; | ||||
|   std::cout<<GridLogMessage << zdata->dn << " -dn"<<std::endl; | ||||
|   std::cout<<GridLogMessage << zdata->dd << " -dd"<<std::endl; | ||||
|   //      std::cout<<GridLogMessage << Ls << " Ls"<<std::endl; | ||||
|   //      std::cout<<GridLogMessage << zdata->n  << " - n"<<std::endl; | ||||
|   //      std::cout<<GridLogMessage << zdata->da << " -da "<<std::endl; | ||||
|   //      std::cout<<GridLogMessage << zdata->db << " -db"<<std::endl; | ||||
|   //      std::cout<<GridLogMessage << zdata->dn << " -dn"<<std::endl; | ||||
|   //      std::cout<<GridLogMessage << zdata->dd << " -dd"<<std::endl; | ||||
|   int Ls = this->Ls; | ||||
|   std::cout<<GridLogMessage << Ls << " Ls"<<std::endl; | ||||
|   assert(zdata->db==Ls);// Beta has Ls coeffs | ||||
|  | ||||
|   R=(1+this->mass)/(1-this->mass); | ||||
| @@ -320,7 +320,7 @@ ContinuedFractionFermion5D<Impl>::ContinuedFractionFermion5D( | ||||
|       int Ls = this->Ls; | ||||
|       conformable(solution5d.Grid(),this->FermionGrid()); | ||||
|       conformable(exported4d.Grid(),this->GaugeGrid()); | ||||
|       ExtractSlice(exported4d, solution5d, Ls-1, 0); | ||||
|       ExtractSlice(exported4d, solution5d, Ls-1, Ls-1); | ||||
|     } | ||||
|     template<class Impl> | ||||
|     void ContinuedFractionFermion5D<Impl>::ImportPhysicalFermionSource(const FermionField &input4d,FermionField &imported5d) | ||||
| @@ -330,7 +330,7 @@ ContinuedFractionFermion5D<Impl>::ContinuedFractionFermion5D( | ||||
|       conformable(input4d.Grid()   ,this->GaugeGrid()); | ||||
|       FermionField tmp(this->FermionGrid()); | ||||
|       tmp=Zero(); | ||||
|       InsertSlice(input4d, tmp, Ls-1, 0); | ||||
|       InsertSlice(input4d, tmp, Ls-1, Ls-1); | ||||
|       tmp=Gamma(Gamma::Algebra::Gamma5)*tmp; | ||||
|       this->Dminus(tmp,imported5d); | ||||
|     } | ||||
|   | ||||
| @@ -255,76 +255,15 @@ void   PartialFractionFermion5D<Impl>::M_internal(const FermionField &psi, Fermi | ||||
|   } | ||||
| 	 | ||||
|   { | ||||
|     // The 'conventional' Cayley overlap operator is | ||||
|     // | ||||
|     // Dov = (1+m)/2 + (1-m)/2 g5 sgn Hw | ||||
|     // | ||||
|     // | ||||
|     // With massless limit 1/2(1+g5 sgnHw) | ||||
|     // | ||||
|     // Luscher shows quite neatly that 1+g5 sgn Hw has tree level propagator i qslash +O(a^2) | ||||
|     // | ||||
|     // However, the conventional normalisation has both a leading order factor of 2 in Zq | ||||
|     // at tree level AND a mass dependent (1-m) that are convenient to absorb. | ||||
|     // | ||||
|     // In WilsonFermion5DImplementation.h, the tree level propagator for Hw is | ||||
|     // | ||||
|     // num = -i sin kmu gmu | ||||
|     // | ||||
|     // denom ( sqrt(sk^2 + (2shk^2 - 1)^2 | ||||
|     //    b_k = sk2 - M5; | ||||
|     //      | ||||
|     //    w_k = sqrt(sk + b_k*b_k); | ||||
|     // | ||||
|     //    denom= ( w_k + b_k + mass*mass) ; | ||||
|     // | ||||
|     //    denom= one/denom; | ||||
|     //    out = num*denom; | ||||
|     // | ||||
|     // Chroma, and Grid define partial fraction via 4d operator | ||||
|     // | ||||
|     //   Dpf = 2/(1-m) x Dov = (1+m)/(1-m) + g5 sgn Hw | ||||
|     // | ||||
|     // Now since: | ||||
|     // | ||||
|     //      (1+m)/(1-m) = (1-m)/(1-m) + 2m/(1-m) = 1 + 2m/(1-m) | ||||
|     // | ||||
|     // This corresponds to a modified mass parameter | ||||
|     // | ||||
|     // It has an annoying  | ||||
|     // | ||||
|     //  | ||||
|     double R=(1+this->mass)/(1-this->mass); | ||||
|     //R g5 psi[Ls] + p[0] H | ||||
|     ag5xpbg5y_ssp(chi,R*scale,psi,p[nblock]*scale/amax,D,Ls-1,Ls-1); | ||||
|      | ||||
| 	 | ||||
|     for(int b=0;b<nblock;b++){ | ||||
|       int s = 2*b+1; | ||||
|       double pp = p[nblock-1-b]; | ||||
|       axpby_ssp(chi,1.0,chi,-sqrt(amax*pp)*scale*sign,psi,Ls-1,s); | ||||
|     } | ||||
|  | ||||
|     if ( qmu.size() ) { | ||||
|  | ||||
|       FermionField qslash_psi(psi.Grid()); | ||||
|        | ||||
|       Gamma::Algebra Gmu [] = { | ||||
| 			 Gamma::Algebra::GammaX, | ||||
| 			 Gamma::Algebra::GammaY, | ||||
| 			 Gamma::Algebra::GammaZ, | ||||
| 			 Gamma::Algebra::GammaT | ||||
|       }; | ||||
|       ComplexD ci(0,1); | ||||
|       assert(qmu.size()==Nd); | ||||
|       qslash_psi = Gamma(Gmu[0])*psi; | ||||
|       for(int mu=1;mu<Nd;mu++){ | ||||
| 	qslash_psi = Gamma(Gmu[mu])*psi; | ||||
|       } | ||||
|       //      RealD coeff = 1.0; | ||||
|       qslash_psi = Gamma(Gamma::Algebra::Gamma5)*qslash_psi*ci ; // i g5 qslash -- 1-m factor??? | ||||
|       axpby_ssp(chi,1.0,chi,1.0, qslash_psi,Ls-1,Ls-1); | ||||
|     } | ||||
|      | ||||
|   } | ||||
|  | ||||
| } | ||||
| @@ -472,7 +411,7 @@ void  PartialFractionFermion5D<Impl>::SetCoefficientsZolotarev(RealD zolo_hi,App | ||||
|       int Ls = this->Ls; | ||||
|       conformable(solution5d.Grid(),this->FermionGrid()); | ||||
|       conformable(exported4d.Grid(),this->GaugeGrid()); | ||||
|       ExtractSlice(exported4d, solution5d, Ls-1, 0); | ||||
|       ExtractSlice(exported4d, solution5d, Ls-1, Ls-1); | ||||
|     } | ||||
|     template<class Impl> | ||||
|     void PartialFractionFermion5D<Impl>::ImportPhysicalFermionSource(const FermionField &input4d,FermionField &imported5d) | ||||
| @@ -482,8 +421,7 @@ void  PartialFractionFermion5D<Impl>::SetCoefficientsZolotarev(RealD zolo_hi,App | ||||
|       conformable(input4d.Grid()   ,this->GaugeGrid()); | ||||
|       FermionField tmp(this->FermionGrid()); | ||||
|       tmp=Zero(); | ||||
|       std::cout << " importing to slice " << Ls-1 <<std::endl; | ||||
|       InsertSlice(input4d, tmp, Ls-1, 0); | ||||
|       InsertSlice(input4d, tmp, Ls-1, Ls-1); | ||||
|       tmp=Gamma(Gamma::Algebra::Gamma5)*tmp; | ||||
|       this->Dminus(tmp,imported5d); | ||||
|     } | ||||
| @@ -504,7 +442,7 @@ PartialFractionFermion5D<Impl>::PartialFractionFermion5D(GaugeField &_Umu, | ||||
|  | ||||
| { | ||||
|   int Ls = this->Ls; | ||||
|   qmu.resize(0); | ||||
|  | ||||
|   assert((Ls&0x1)==1); // Odd Ls required | ||||
|   int nrational=Ls-1; | ||||
|  | ||||
| @@ -522,22 +460,6 @@ PartialFractionFermion5D<Impl>::PartialFractionFermion5D(GaugeField &_Umu, | ||||
|   Approx::zolotarev_free(zdata); | ||||
|  | ||||
| } | ||||
| template<class Impl> | ||||
| PartialFractionFermion5D<Impl>::PartialFractionFermion5D(GaugeField &_Umu, | ||||
| 							 GridCartesian         &FiveDimGrid, | ||||
| 							 GridRedBlackCartesian &FiveDimRedBlackGrid, | ||||
| 							 GridCartesian         &FourDimGrid, | ||||
| 							 GridRedBlackCartesian &FourDimRedBlackGrid, | ||||
| 							 RealD _mass,RealD M5, | ||||
| 							 std::vector<RealD> &_qmu, | ||||
| 							 const ImplParams &p) | ||||
|   : PartialFractionFermion5D<Impl>(_Umu, | ||||
| 			     FiveDimGrid,FiveDimRedBlackGrid, | ||||
| 			     FourDimGrid,FourDimRedBlackGrid, | ||||
| 			     _mass,M5,p) | ||||
| { | ||||
|   qmu=_qmu; | ||||
| } | ||||
|  | ||||
| NAMESPACE_END(Grid); | ||||
|  | ||||
|   | ||||
| @@ -423,6 +423,7 @@ void WilsonKernels<Impl>::DhopDirKernel( StencilImpl &st, DoubledGaugeField &U,S | ||||
| #define KERNEL_CALL(A) KERNEL_CALLNB(A); accelerator_barrier(); | ||||
|  | ||||
| #define KERNEL_CALL_EXT(A)						\ | ||||
|   const uint64_t    NN = Nsite*Ls;					\ | ||||
|   const uint64_t    sz = st.surface_list.size();			\ | ||||
|   auto ptr = &st.surface_list[0];					\ | ||||
|   accelerator_forNB( ss, sz, Simd::Nsimd(), {				\ | ||||
|   | ||||
| @@ -86,8 +86,13 @@ public: | ||||
|     assert(ForceE.Checkerboard()==Even); | ||||
|     assert(ForceO.Checkerboard()==Odd); | ||||
|  | ||||
| #if defined(GRID_CUDA) || defined(GRID_HIP)  || defined(GRID_SYCL) | ||||
|     acceleratorSetCheckerboard(Force,ForceE); | ||||
|     acceleratorSetCheckerboard(Force,ForceO); | ||||
| #else | ||||
|     setCheckerboard(Force,ForceE);  | ||||
|     setCheckerboard(Force,ForceO); | ||||
| #endif | ||||
|     Force=-Force; | ||||
|  | ||||
|     delete forcecb; | ||||
| @@ -130,8 +135,13 @@ public: | ||||
|     assert(ForceE.Checkerboard()==Even); | ||||
|     assert(ForceO.Checkerboard()==Odd); | ||||
|  | ||||
| #if defined(GRID_CUDA) || defined(GRID_HIP)  || defined(GRID_SYCL) | ||||
|     acceleratorSetCheckerboard(Force,ForceE); | ||||
|     acceleratorSetCheckerboard(Force,ForceO); | ||||
| #else | ||||
|     setCheckerboard(Force,ForceE);  | ||||
|     setCheckerboard(Force,ForceO); | ||||
| #endif | ||||
|     Force=-Force; | ||||
|  | ||||
|     delete forcecb; | ||||
|   | ||||
| @@ -283,13 +283,12 @@ public: | ||||
|       std::cout << GridLogHMC << "Total time for trajectory (s): " << (t1-t0)/1e6 << std::endl; | ||||
|  | ||||
|       TheIntegrator.print_timer(); | ||||
|        | ||||
|       TheIntegrator.Smearer.set_Field(Ucur); | ||||
|  | ||||
|       for (int obs = 0; obs < Observables.size(); obs++) { | ||||
|       	std::cout << GridLogDebug << "Observables # " << obs << std::endl; | ||||
|       	std::cout << GridLogDebug << "Observables total " << Observables.size() << std::endl; | ||||
|       	std::cout << GridLogDebug << "Observables pointer " << Observables[obs] << std::endl; | ||||
|         Observables[obs]->TrajectoryComplete(traj + 1, TheIntegrator.Smearer, sRNG, pRNG); | ||||
|         Observables[obs]->TrajectoryComplete(traj + 1, Ucur, sRNG, pRNG); | ||||
|       } | ||||
|       std::cout << GridLogHMC << ":::::::::::::::::::::::::::::::::::::::::::" << std::endl; | ||||
|     } | ||||
|   | ||||
| @@ -35,16 +35,13 @@ class CheckpointerParameters : Serializable { | ||||
| public: | ||||
|   GRID_SERIALIZABLE_CLASS_MEMBERS(CheckpointerParameters,  | ||||
| 				  std::string, config_prefix,  | ||||
| 				  std::string, smeared_prefix,  | ||||
| 				  std::string, rng_prefix,  | ||||
| 				  int, saveInterval,  | ||||
| 				  bool, saveSmeared,  | ||||
| 				  std::string, format, ); | ||||
|  | ||||
|   CheckpointerParameters(std::string cf = "cfg", std::string sf="cfg_smr" , std::string rn = "rng", | ||||
|   CheckpointerParameters(std::string cf = "cfg", std::string rn = "rng", | ||||
| 			 int savemodulo = 1, const std::string &f = "IEEE64BIG") | ||||
|     : config_prefix(cf), | ||||
|       smeared_prefix(sf), | ||||
|       rng_prefix(rn), | ||||
|       saveInterval(savemodulo), | ||||
|       format(f){}; | ||||
| @@ -64,21 +61,13 @@ template <class Impl> | ||||
| class BaseHmcCheckpointer : public HmcObservable<typename Impl::Field> { | ||||
| public: | ||||
|   void build_filenames(int traj, CheckpointerParameters &Params, | ||||
|                        std::string &conf_file, | ||||
|                        std::string &smear_file, | ||||
| 		       std::string &rng_file) { | ||||
|                        std::string &conf_file, std::string &rng_file) { | ||||
|     { | ||||
|       std::ostringstream os; | ||||
|       os << Params.rng_prefix << "." << traj; | ||||
|       rng_file = os.str(); | ||||
|     } | ||||
|  | ||||
|     { | ||||
|       std::ostringstream os; | ||||
|       os << Params.smeared_prefix << "." << traj; | ||||
|       smear_file = os.str(); | ||||
|     } | ||||
|  | ||||
|     { | ||||
|       std::ostringstream os; | ||||
|       os << Params.config_prefix << "." << traj; | ||||
| @@ -95,11 +84,6 @@ public: | ||||
|   } | ||||
|   virtual void initialize(const CheckpointerParameters &Params) = 0; | ||||
|  | ||||
|   virtual void TrajectoryComplete(int traj, | ||||
|                                   typename Impl::Field &U, | ||||
|                                   GridSerialRNG &sRNG, | ||||
|                                   GridParallelRNG &pRNG) { assert(0); } ; // HMC should pass the smart config with smeared and unsmeared | ||||
|    | ||||
|   virtual void CheckpointRestore(int traj, typename Impl::Field &U, | ||||
|                                  GridSerialRNG &sRNG, | ||||
|                                  GridParallelRNG &pRNG) = 0; | ||||
|   | ||||
| @@ -61,14 +61,11 @@ public: | ||||
|     fout.close(); | ||||
|   } | ||||
|  | ||||
|   void TrajectoryComplete(int traj, | ||||
| 			  ConfigurationBase<Field> &SmartConfig, | ||||
| 			  GridSerialRNG &sRNG, GridParallelRNG &pRNG) | ||||
|   { | ||||
|   void TrajectoryComplete(int traj, Field &U, GridSerialRNG &sRNG, GridParallelRNG &pRNG) { | ||||
|  | ||||
|     if ((traj % Params.saveInterval) == 0) { | ||||
|       std::string config, rng, smr; | ||||
|       this->build_filenames(traj, Params, config, smr, rng); | ||||
|       std::string config, rng; | ||||
|       this->build_filenames(traj, Params, config, rng); | ||||
|  | ||||
|       uint32_t nersc_csum; | ||||
|       uint32_t scidac_csuma; | ||||
| @@ -77,15 +74,9 @@ public: | ||||
|       BinarySimpleUnmunger<sobj_double, sobj> munge; | ||||
|       truncate(rng); | ||||
|       BinaryIO::writeRNG(sRNG, pRNG, rng, 0,nersc_csum,scidac_csuma,scidac_csumb); | ||||
|       std::cout << GridLogMessage << "Written Binary RNG " << rng | ||||
|                 << " checksum " << std::hex  | ||||
| 		<< nersc_csum   <<"/" | ||||
| 		<< scidac_csuma   <<"/" | ||||
| 		<< scidac_csumb  | ||||
| 		<< std::dec << std::endl; | ||||
|  | ||||
|       truncate(config); | ||||
|       BinaryIO::writeLatticeObject<vobj, sobj_double>(SmartConfig.get_U(false), config, munge, 0, Params.format, | ||||
|  | ||||
|       BinaryIO::writeLatticeObject<vobj, sobj_double>(U, config, munge, 0, Params.format, | ||||
| 						      nersc_csum,scidac_csuma,scidac_csumb); | ||||
|  | ||||
|       std::cout << GridLogMessage << "Written Binary Configuration " << config | ||||
| @@ -94,18 +85,6 @@ public: | ||||
| 		<< scidac_csuma   <<"/" | ||||
| 		<< scidac_csumb  | ||||
| 		<< std::dec << std::endl; | ||||
|  | ||||
|       if ( Params.saveSmeared ) { | ||||
| 	truncate(smr); | ||||
| 	BinaryIO::writeLatticeObject<vobj, sobj_double>(SmartConfig.get_U(true), smr, munge, 0, Params.format, | ||||
| 							nersc_csum,scidac_csuma,scidac_csumb); | ||||
| 	std::cout << GridLogMessage << "Written Binary Smeared Configuration " << smr | ||||
|                 << " checksum " << std::hex  | ||||
| 		<< nersc_csum   <<"/" | ||||
| 		<< scidac_csuma   <<"/" | ||||
| 		<< scidac_csumb  | ||||
| 		<< std::dec << std::endl; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|   }; | ||||
|   | ||||
| @@ -69,27 +69,17 @@ public: | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   void TrajectoryComplete(int traj, | ||||
| 			  ConfigurationBase<GaugeField> &SmartConfig, | ||||
| 			  GridSerialRNG &sRNG, | ||||
|   void TrajectoryComplete(int traj, GaugeField &U, GridSerialRNG &sRNG, | ||||
|                           GridParallelRNG &pRNG) { | ||||
|     if ((traj % Params.saveInterval) == 0) { | ||||
|       std::string config, rng, smr; | ||||
|       std::string config, rng; | ||||
|       this->build_filenames(traj, Params, config, rng); | ||||
|       GridBase *grid = SmartConfig.get_U(false).Grid(); | ||||
|       GridBase *grid = U.Grid(); | ||||
|       uint32_t nersc_csum,scidac_csuma,scidac_csumb; | ||||
|       BinaryIO::writeRNG(sRNG, pRNG, rng, 0,nersc_csum,scidac_csuma,scidac_csumb); | ||||
|       std::cout << GridLogMessage << "Written BINARY RNG " << rng | ||||
|                 << " checksum " << std::hex  | ||||
| 		<< nersc_csum<<"/" | ||||
| 		<< scidac_csuma<<"/" | ||||
| 		<< scidac_csumb | ||||
| 		<< std::dec << std::endl; | ||||
|  | ||||
|        | ||||
|       IldgWriter _IldgWriter(grid->IsBoss()); | ||||
|       _IldgWriter.open(config); | ||||
|       _IldgWriter.writeConfiguration<GaugeStats>(SmartConfig.get_U(false), traj, config, config); | ||||
|       _IldgWriter.writeConfiguration<GaugeStats>(U, traj, config, config); | ||||
|       _IldgWriter.close(); | ||||
|  | ||||
|       std::cout << GridLogMessage << "Written ILDG Configuration on " << config | ||||
| @@ -98,21 +88,6 @@ public: | ||||
| 		<< scidac_csuma<<"/" | ||||
| 		<< scidac_csumb | ||||
| 		<< std::dec << std::endl; | ||||
|  | ||||
|       if ( Params.saveSmeared ) {  | ||||
| 	IldgWriter _IldgWriter(grid->IsBoss()); | ||||
| 	_IldgWriter.open(smr); | ||||
| 	_IldgWriter.writeConfiguration<GaugeStats>(SmartConfig.get_U(true), traj, config, config); | ||||
| 	_IldgWriter.close(); | ||||
|  | ||||
| 	std::cout << GridLogMessage << "Written ILDG Configuration on " << smr | ||||
|                 << " checksum " << std::hex  | ||||
| 		<< nersc_csum<<"/" | ||||
| 		<< scidac_csuma<<"/" | ||||
| 		<< scidac_csumb | ||||
| 		<< std::dec << std::endl; | ||||
|       } | ||||
|  | ||||
|     } | ||||
|   }; | ||||
|  | ||||
|   | ||||
| @@ -52,29 +52,23 @@ public: | ||||
|     Params.format = "IEEE64BIG";  // fixed, overwrite any other choice | ||||
|   } | ||||
|  | ||||
|   virtual void TrajectoryComplete(int traj, | ||||
|                                   ConfigurationBase<GaugeField> &SmartConfig, | ||||
|                                   GridSerialRNG &sRNG, | ||||
|                                   GridParallelRNG &pRNG) | ||||
|   { | ||||
|   void TrajectoryComplete(int traj, GaugeField &U, GridSerialRNG &sRNG, | ||||
|                           GridParallelRNG &pRNG) { | ||||
|     if ((traj % Params.saveInterval) == 0) { | ||||
|       std::string config, rng, smr; | ||||
|       this->build_filenames(traj, Params, config, smr, rng); | ||||
|        | ||||
|       std::string config, rng; | ||||
|       this->build_filenames(traj, Params, config, rng); | ||||
|  | ||||
|       int precision32 = 1; | ||||
|       int tworow = 0; | ||||
|       NerscIO::writeRNGState(sRNG, pRNG, rng); | ||||
|       NerscIO::writeConfiguration<GaugeStats>(SmartConfig.get_U(false), config, tworow, precision32); | ||||
|       if ( Params.saveSmeared ) { | ||||
| 	NerscIO::writeConfiguration<GaugeStats>(SmartConfig.get_U(true), smr, tworow, precision32); | ||||
|       } | ||||
|       NerscIO::writeConfiguration<GaugeStats>(U, config, tworow, precision32); | ||||
|     } | ||||
|   }; | ||||
|  | ||||
|   void CheckpointRestore(int traj, GaugeField &U, GridSerialRNG &sRNG, | ||||
|                          GridParallelRNG &pRNG) { | ||||
|     std::string config, rng, smr; | ||||
|     this->build_filenames(traj, Params, config, smr, rng ); | ||||
|     std::string config, rng; | ||||
|     this->build_filenames(traj, Params, config, rng); | ||||
|     this->check_filename(rng); | ||||
|     this->check_filename(config); | ||||
|  | ||||
|   | ||||
| @@ -70,37 +70,19 @@ class ScidacHmcCheckpointer : public BaseHmcCheckpointer<Implementation> { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   void TrajectoryComplete(int traj,  | ||||
| 			  ConfigurationBase<Field> &SmartConfig, | ||||
| 			  GridSerialRNG &sRNG, | ||||
|   void TrajectoryComplete(int traj, Field &U, GridSerialRNG &sRNG, | ||||
|                           GridParallelRNG &pRNG) { | ||||
|     if ((traj % Params.saveInterval) == 0) { | ||||
|       std::string config, rng,smr; | ||||
|       this->build_filenames(traj, Params, config, smr, rng); | ||||
|       GridBase *grid = SmartConfig.get_U(false).Grid(); | ||||
|       std::string config, rng; | ||||
|       this->build_filenames(traj, Params, config, rng); | ||||
|       GridBase *grid = U.Grid(); | ||||
|       uint32_t nersc_csum,scidac_csuma,scidac_csumb; | ||||
|       BinaryIO::writeRNG(sRNG, pRNG, rng, 0,nersc_csum,scidac_csuma,scidac_csumb); | ||||
|       std::cout << GridLogMessage << "Written Binary RNG " << rng | ||||
|                 << " checksum " << std::hex  | ||||
| 		<< nersc_csum   <<"/" | ||||
| 		<< scidac_csuma   <<"/" | ||||
| 		<< scidac_csumb  | ||||
| 		<< std::dec << std::endl; | ||||
|       ScidacWriter _ScidacWriter(grid->IsBoss()); | ||||
|       _ScidacWriter.open(config); | ||||
|       _ScidacWriter.writeScidacFieldRecord(U, MData); | ||||
|       _ScidacWriter.close(); | ||||
|  | ||||
|  | ||||
|       { | ||||
| 	ScidacWriter _ScidacWriter(grid->IsBoss()); | ||||
| 	_ScidacWriter.open(config); | ||||
| 	_ScidacWriter.writeScidacFieldRecord(SmartConfig.get_U(false), MData); | ||||
| 	_ScidacWriter.close(); | ||||
|       } | ||||
|        | ||||
|       if ( Params.saveSmeared ) { | ||||
| 	ScidacWriter _ScidacWriter(grid->IsBoss()); | ||||
| 	_ScidacWriter.open(smr); | ||||
| 	_ScidacWriter.writeScidacFieldRecord(SmartConfig.get_U(true), MData); | ||||
| 	_ScidacWriter.close(); | ||||
|       } | ||||
|       std::cout << GridLogMessage << "Written Scidac Configuration on " << config << std::endl; | ||||
|     } | ||||
|   }; | ||||
|   | ||||
| @@ -66,7 +66,6 @@ public: | ||||
| template <class FieldImplementation_, class SmearingPolicy, class RepresentationPolicy> | ||||
| class Integrator { | ||||
| protected: | ||||
| public: | ||||
|   typedef FieldImplementation_ FieldImplementation; | ||||
|   typedef typename FieldImplementation::Field MomentaField;  //for readability | ||||
|   typedef typename FieldImplementation::Field Field; | ||||
| @@ -97,6 +96,7 @@ public: | ||||
|   { | ||||
|     t_P[level] += ep; | ||||
|     update_P(P, U, level, ep); | ||||
|  | ||||
|     std::cout << GridLogIntegrator << "[" << level << "] P " << " dt " << ep << " : t_P " << t_P[level] << std::endl; | ||||
|   } | ||||
|  | ||||
| @@ -130,20 +130,28 @@ public: | ||||
|       Field force(U.Grid()); | ||||
|       conformable(U.Grid(), Mom.Grid()); | ||||
|  | ||||
|       Field& Us = Smearer.get_U(as[level].actions.at(a)->is_smeared); | ||||
|       double start_force = usecond(); | ||||
|  | ||||
|       std::cout << GridLogMessage << "AuditForce["<<level<<"]["<<a<<"] before"<<std::endl; | ||||
|        | ||||
|       as[level].actions.at(a)->deriv_timer_start(); | ||||
|       as[level].actions.at(a)->deriv(Smearer, force);  // deriv should NOT include Ta | ||||
|       as[level].actions.at(a)->deriv(Us, force);  // deriv should NOT include Ta | ||||
|       as[level].actions.at(a)->deriv_timer_stop(); | ||||
|  | ||||
|       std::cout << GridLogMessage << "AuditForce["<<level<<"]["<<a<<"] after"<<std::endl; | ||||
|  | ||||
|       std::cout << GridLogIntegrator << "Smearing (on/off): " << as[level].actions.at(a)->is_smeared << std::endl; | ||||
|       auto name = as[level].actions.at(a)->action_name(); | ||||
|       if (as[level].actions.at(a)->is_smeared) Smearer.smeared_force(force); | ||||
|  | ||||
|       force = FieldImplementation::projectForce(force); // Ta for gauge fields | ||||
|       double end_force = usecond(); | ||||
|        | ||||
|       MomFilter->applyFilter(force); | ||||
|  | ||||
|       //      DumpSliceNorm("force ",force,Nd-1); | ||||
|       MomFilter->applyFilter(force); | ||||
|       std::cout << GridLogIntegrator << " update_P : Level [" << level <<"]["<<a <<"] "<<name<<" dt "<<ep<<  std::endl; | ||||
|       DumpSliceNorm("force filtered ",force,Nd-1); | ||||
|        | ||||
|       Real force_abs   = std::sqrt(norm2(force)/U.Grid()->gSites()); //average per-site norm.  nb. norm2(latt) = \sum_x norm2(latt[x])  | ||||
|       Real impulse_abs = force_abs * ep * HMC_MOMENTUM_DENOMINATOR;     | ||||
| @@ -369,9 +377,14 @@ public: | ||||
| 	auto name = as[level].actions.at(actionID)->action_name(); | ||||
|         std::cout << GridLogMessage << "refresh [" << level << "][" << actionID << "] "<<name << std::endl; | ||||
|  | ||||
|         Field& Us = Smearer.get_U(as[level].actions.at(actionID)->is_smeared); | ||||
|  | ||||
| 	std::cout << GridLogMessage << "AuditRefresh["<<level<<"]["<<actionID<<"] before"<<std::endl; | ||||
|  | ||||
| 	as[level].actions.at(actionID)->refresh_timer_start(); | ||||
|         as[level].actions.at(actionID)->refresh(Smearer, sRNG, pRNG); | ||||
|         as[level].actions.at(actionID)->refresh(Us, sRNG, pRNG); | ||||
| 	as[level].actions.at(actionID)->refresh_timer_stop(); | ||||
| 	std::cout << GridLogMessage << "AuditRefresh["<<level<<"]["<<actionID<<"] after"<<std::endl; | ||||
|  | ||||
|       } | ||||
|  | ||||
| @@ -412,9 +425,10 @@ public: | ||||
|  | ||||
|         // get gauge field from the SmearingPolicy and | ||||
|         // based on the boolean is_smeared in actionID | ||||
|         Field& Us = Smearer.get_U(as[level].actions.at(actionID)->is_smeared); | ||||
|         std::cout << GridLogMessage << "S [" << level << "][" << actionID << "] action eval " << std::endl; | ||||
| 	        as[level].actions.at(actionID)->S_timer_start(); | ||||
|         Hterm = as[level].actions.at(actionID)->S(Smearer); | ||||
|         Hterm = as[level].actions.at(actionID)->S(Us); | ||||
|    	        as[level].actions.at(actionID)->S_timer_stop(); | ||||
|         std::cout << GridLogMessage << "S [" << level << "][" << actionID << "] H = " << Hterm << std::endl; | ||||
|         H += Hterm; | ||||
| @@ -455,11 +469,12 @@ public: | ||||
|       for (int actionID = 0; actionID < as[level].actions.size(); ++actionID) { | ||||
|         // get gauge field from the SmearingPolicy and | ||||
|         // based on the boolean is_smeared in actionID | ||||
|         Field& Us = Smearer.get_U(as[level].actions.at(actionID)->is_smeared); | ||||
|         std::cout << GridLogMessage << "S [" << level << "][" << actionID << "] action eval " << std::endl; | ||||
| 	        as[level].actions.at(actionID)->S_timer_start(); | ||||
|  | ||||
| 	as[level].actions.at(actionID)->S_timer_start(); | ||||
|         Hterm = as[level].actions.at(actionID)->S(Smearer); | ||||
| 	as[level].actions.at(actionID)->S_timer_stop(); | ||||
|         Hterm = as[level].actions.at(actionID)->Sinitial(Us); | ||||
|    	        as[level].actions.at(actionID)->S_timer_stop(); | ||||
|  | ||||
|         std::cout << GridLogMessage << "S [" << level << "][" << actionID << "] H = " << Hterm << std::endl; | ||||
|         H += Hterm; | ||||
|   | ||||
| @@ -34,13 +34,6 @@ NAMESPACE_BEGIN(Grid); | ||||
| template <class Field> | ||||
| class HmcObservable { | ||||
|  public: | ||||
|   virtual void TrajectoryComplete(int traj, | ||||
|                                   ConfigurationBase<Field> &SmartConfig, | ||||
|                                   GridSerialRNG &sRNG, | ||||
|                                   GridParallelRNG &pRNG) | ||||
|   { | ||||
|     TrajectoryComplete(traj,SmartConfig.get_U(false),sRNG,pRNG); // Unsmeared observable | ||||
|   }; | ||||
|   virtual void TrajectoryComplete(int traj, | ||||
|                                   Field &U, | ||||
|                                   GridSerialRNG &sRNG, | ||||
|   | ||||
| @@ -42,18 +42,6 @@ public: | ||||
|   // necessary for HmcObservable compatibility | ||||
|   typedef typename Impl::Field Field; | ||||
|  | ||||
|   virtual void TrajectoryComplete(int traj, | ||||
|                                   ConfigurationBase<Field> &SmartConfig, | ||||
|                                   GridSerialRNG &sRNG, | ||||
|                                   GridParallelRNG &pRNG) | ||||
|   { | ||||
|     std::cout << GridLogMessage << "+++++++++++++++++++"<<std::endl; | ||||
|     std::cout << GridLogMessage << "Unsmeared plaquette"<<std::endl; | ||||
|     TrajectoryComplete(traj,SmartConfig.get_U(false),sRNG,pRNG); // Unsmeared observable | ||||
|     std::cout << GridLogMessage << "Smeared plaquette"<<std::endl; | ||||
|     TrajectoryComplete(traj,SmartConfig.get_U(true),sRNG,pRNG); // Unsmeared observable | ||||
|     std::cout << GridLogMessage << "+++++++++++++++++++"<<std::endl; | ||||
|   }; | ||||
|   void TrajectoryComplete(int traj, | ||||
|                           Field &U, | ||||
|                           GridSerialRNG &sRNG, | ||||
|   | ||||
| @@ -19,13 +19,13 @@ public: | ||||
|  | ||||
|   NoSmearing(): ThinLinks(NULL) {} | ||||
|  | ||||
|   virtual void set_Field(Field& U) { ThinLinks = &U; } | ||||
|   void set_Field(Field& U) { ThinLinks = &U; } | ||||
|  | ||||
|   virtual void smeared_force(Field&) {} | ||||
|   void smeared_force(Field&) const {} | ||||
|  | ||||
|   virtual Field& get_SmearedU() { return *ThinLinks; } | ||||
|   Field& get_SmearedU() { return *ThinLinks; } | ||||
|  | ||||
|   virtual Field &get_U(bool smeared = false) | ||||
|   Field &get_U(bool smeared = false) | ||||
|   { | ||||
|     return *ThinLinks; | ||||
|   } | ||||
| @@ -235,7 +235,7 @@ public: | ||||
|     : smearingLevels(0), StoutSmearing(nullptr), SmearedSet(), ThinLinks(NULL) {} | ||||
|  | ||||
|   // attach the smeared routines to the thin links U and fill the smeared set | ||||
|   virtual void set_Field(GaugeField &U) | ||||
|   void set_Field(GaugeField &U) | ||||
|   { | ||||
|     double start = usecond(); | ||||
|     fill_smearedSet(U); | ||||
| @@ -245,7 +245,7 @@ public: | ||||
|   } | ||||
|  | ||||
|   //==================================================================== | ||||
|   virtual void smeared_force(GaugeField &SigmaTilde)  | ||||
|   void smeared_force(GaugeField &SigmaTilde) const | ||||
|   { | ||||
|     if (smearingLevels > 0) | ||||
|     { | ||||
| @@ -272,16 +272,14 @@ public: | ||||
|       } | ||||
|       double end = usecond(); | ||||
|       double time = (end - start)/ 1e3; | ||||
|       std::cout << GridLogMessage << " GaugeConfiguration: Smeared Force chain rule took " << time << " ms" << std::endl; | ||||
|       std::cout << GridLogMessage << "Smearing force in " << time << " ms" << std::endl;   | ||||
|     }  // if smearingLevels = 0 do nothing | ||||
|     SigmaTilde=Gimpl::projectForce(SigmaTilde); // Ta | ||||
|        | ||||
|   } | ||||
|   //==================================================================== | ||||
|  | ||||
|   virtual GaugeField& get_SmearedU() { return SmearedSet[smearingLevels - 1]; } | ||||
|   GaugeField& get_SmearedU() { return SmearedSet[smearingLevels - 1]; } | ||||
|  | ||||
|   virtual GaugeField &get_U(bool smeared = false) | ||||
|   GaugeField &get_U(bool smeared = false) | ||||
|   { | ||||
|     // get the config, thin links by default | ||||
|     if (smeared) | ||||
|   | ||||
| @@ -131,7 +131,6 @@ public: | ||||
|     AdjMatrixField  X(grid); | ||||
|     Complex ci(0,1); | ||||
|  | ||||
|     RealD t0 = usecond(); | ||||
|     Ident = ComplexD(1.0); | ||||
|     for(int d=0;d<Nd;d++){ | ||||
|       Umu[d] = peekLorentz(U, d); | ||||
| @@ -162,8 +161,6 @@ public: | ||||
|     // Assemble the N matrix | ||||
|     ////////////////////////////////////////////////////////////////// | ||||
|     // Computes ALL the staples -- could compute one only and do it here | ||||
|     RealD time; | ||||
|     time=-usecond(); | ||||
|     this->StoutSmearing->BaseSmear(C, U); | ||||
|     Cmu = peekLorentz(C, mu); | ||||
|  | ||||
| @@ -172,10 +169,7 @@ public: | ||||
|     ////////////////////////////////////////////////////////////////// | ||||
|     // Ta so Z lives in Lie algabra | ||||
|     Zx  = Ta(Cmu * adj(Umu[mu])); | ||||
|     time+=usecond(); | ||||
|     std::cout << GridLogMessage << "Z took "<<time<< " us"<<std::endl; | ||||
|  | ||||
|     time=-usecond(); | ||||
|     // Move Z to the Adjoint Rep == make_adjoint_representation | ||||
|     ZxAd = Zero(); | ||||
|     for(int b=0;b<8;b++) { | ||||
| @@ -186,13 +180,10 @@ public: | ||||
|       cplx = 2.0*trace(ci*tb*Zx); // my convention 1/2 delta ba | ||||
|       ZxAd = ZxAd + cplx * TRb; // is this right? YES - Guido used Anti herm Ta's and with bloody wrong sign. | ||||
|     } | ||||
|     time+=usecond(); | ||||
|     std::cout << GridLogMessage << "ZxAd took "<<time<< " us"<<std::endl; | ||||
|  | ||||
|     ////////////////////////////////////// | ||||
|     // J(x) = 1 + Sum_k=1..N (-Zac)^k/(k+1)! | ||||
|     ////////////////////////////////////// | ||||
|     time=-usecond(); | ||||
|     X=1.0;  | ||||
|     JxAd = X; | ||||
|     mZxAd = (-1.0)*ZxAd;  | ||||
| @@ -202,13 +193,10 @@ public: | ||||
|       kpfac = kpfac /(k+1); | ||||
|       JxAd = JxAd + X * kpfac; | ||||
|     } | ||||
|     time+=usecond(); | ||||
|     std::cout << GridLogMessage << "Jx took "<<time<< " us"<<std::endl; | ||||
|  | ||||
|     ////////////////////////////////////// | ||||
|     // dJ(x)/dxe | ||||
|     ////////////////////////////////////// | ||||
|     time=-usecond(); | ||||
|     std::vector<AdjMatrixField>  dJdX;    dJdX.resize(8,grid); | ||||
|     AdjMatrixField tbXn(grid); | ||||
|     AdjMatrixField sumXtbX(grid); | ||||
| @@ -232,17 +220,12 @@ public: | ||||
|       } | ||||
|       dJdX[b] = -dt2;  | ||||
|     } | ||||
|     time+=usecond(); | ||||
|     std::cout << GridLogMessage << "dJx took "<<time<< " us"<<std::endl; | ||||
|     ///////////////////////////////////////////////////////////////// | ||||
|     // Mask Umu for this link | ||||
|     ///////////////////////////////////////////////////////////////// | ||||
|     time=-usecond(); | ||||
|     PlaqL = Ident; | ||||
|     PlaqR = Utmp*adj(Cmu); | ||||
|     ComputeNxy(PlaqL,PlaqR,NxxAd); | ||||
|     time+=usecond(); | ||||
|     std::cout << GridLogMessage << "ComputeNxy took "<<time<< " us"<<std::endl; | ||||
|      | ||||
|     //////////////////////////// | ||||
|     // Mab | ||||
| @@ -253,12 +236,8 @@ public: | ||||
|     ///////////////////////// | ||||
|     // invert the 8x8 | ||||
|     ///////////////////////// | ||||
|     time=-usecond(); | ||||
|     MpAdInv = Inverse(MpAd); | ||||
|     time+=usecond(); | ||||
|     std::cout << GridLogMessage << "MpAdInv took "<<time<< " us"<<std::endl; | ||||
|      | ||||
|     RealD t3a = usecond(); | ||||
|     ///////////////////////////////////////////////////////////////// | ||||
|     // Nxx Mp^-1 | ||||
|     ///////////////////////////////////////////////////////////////// | ||||
| @@ -304,7 +283,6 @@ public: | ||||
|     GaugeField Fdet2(grid); | ||||
|     GaugeLinkField Fdet_pol(grid); // one polarisation | ||||
|  | ||||
|     RealD t4 = usecond(); | ||||
|     for(int nu=0;nu<Nd;nu++){ | ||||
|  | ||||
|       if (nu!=mu) { | ||||
| @@ -313,29 +291,20 @@ public: | ||||
| 	//    |  | | ||||
| 	//    x==    // nu polarisation -- clockwise | ||||
|  | ||||
| 	time=-usecond(); | ||||
| 	PlaqL=Ident; | ||||
|  | ||||
| 	PlaqR=(-rho)*Gimpl::CovShiftForward(Umu[nu], nu, | ||||
|  	       Gimpl::CovShiftForward(Umu[mu], mu, | ||||
| 	         Gimpl::CovShiftBackward(Umu[nu], nu, | ||||
| 		   Gimpl::CovShiftIdentityBackward(Utmp, mu)))); | ||||
| 	time+=usecond(); | ||||
| 	std::cout << GridLogMessage << "PlaqLR took "<<time<< " us"<<std::endl; | ||||
|  | ||||
| 	time=-usecond(); | ||||
| 	dJdXe_nMpInv_y =   dJdXe_nMpInv; | ||||
| 	ComputeNxy(PlaqL,PlaqR,Nxy); | ||||
| 	Fdet1_nu = transpose(Nxy)*dJdXe_nMpInv_y; | ||||
| 	time+=usecond(); | ||||
| 	std::cout << GridLogMessage << "ComputeNxy (occurs 6x) took "<<time<< " us"<<std::endl; | ||||
|  | ||||
| 	time=-usecond(); | ||||
| 	PlaqR=(-1.0)*PlaqR; | ||||
| 	Compute_MpInvJx_dNxxdSy(PlaqL,PlaqR,MpInvJx,FdetV); | ||||
| 	Fdet2_nu = FdetV; | ||||
| 	time+=usecond(); | ||||
| 	std::cout << GridLogMessage << "Compute_MpInvJx_dNxxSy (occurs 6x) took "<<time<< " us"<<std::endl; | ||||
| 	 | ||||
| 	//    x== | ||||
| 	//    |  | | ||||
| @@ -447,7 +416,6 @@ public: | ||||
| 	 | ||||
|       } | ||||
|     } | ||||
|     RealD t5 = usecond(); | ||||
|  | ||||
|     Fdet1_mu = Fdet1_mu + transpose(NxxAd)*dJdXe_nMpInv; | ||||
|  | ||||
| @@ -455,13 +423,6 @@ public: | ||||
|     InsertForce(Fdet2,Fdet2_mu,mu); | ||||
|  | ||||
|     force= (-0.5)*( Fdet1 + Fdet2); | ||||
|     RealD t1 = usecond(); | ||||
|     std::cout << GridLogMessage << " logDetJacobianForce level took "<<t1-t0<<" us "<<std::endl; | ||||
|     std::cout << GridLogMessage << " logDetJacobianForce t3-t0 "<<t3a-t0<<" us "<<std::endl; | ||||
|     std::cout << GridLogMessage << " logDetJacobianForce t4-t3 dJdXe_nMpInv "<<t4-t3a<<" us "<<std::endl; | ||||
|     std::cout << GridLogMessage << " logDetJacobianForce t5-t4 mu nu loop "<<t5-t4<<" us "<<std::endl; | ||||
|     std::cout << GridLogMessage << " logDetJacobianForce t1-t5 "<<t1-t5<<" us "<<std::endl; | ||||
|     std::cout << GridLogMessage << " logDetJacobianForce level took "<<t1-t0<<" us "<<std::endl; | ||||
|   } | ||||
|   RealD logDetJacobianLevel(const GaugeField &U,int smr) | ||||
|   { | ||||
| @@ -735,10 +696,10 @@ private: | ||||
| public: | ||||
|  | ||||
|   /* Standard constructor */ | ||||
|   SmearedConfigurationMasked(GridCartesian* _UGrid, unsigned int Nsmear, Smear_Stout<Gimpl>& Stout) | ||||
|   SmearedConfigurationMasked(GridCartesian* _UGrid, unsigned int Nsmear, Smear_Stout<Gimpl>& Stout,bool domask=false) | ||||
|     : SmearedConfiguration<Gimpl>(_UGrid, Nsmear,Stout) | ||||
|   { | ||||
|     assert(Nsmear%(2*Nd)==0); // Or multiply by 8?? | ||||
|     if(domask) assert(Nsmear%(2*Nd)==0); // Or multiply by 8?? | ||||
|  | ||||
|     // was resized in base class | ||||
|     assert(this->SmearedSet.size()==Nsmear); | ||||
| @@ -751,20 +712,26 @@ public: | ||||
|     for (unsigned int i = 0; i < this->smearingLevels; ++i) { | ||||
|  | ||||
|       masks.push_back(*(new LatticeLorentzComplex(_UGrid))); | ||||
|       if (domask) { | ||||
|  | ||||
|       int mu= (i/2) %Nd; | ||||
|       int cb= (i%2); | ||||
|       LatticeComplex tmpcb(UrbGrid); | ||||
| 	int mu= (i/2) %Nd; | ||||
| 	int cb= (i%2); | ||||
| 	LatticeComplex tmpcb(UrbGrid); | ||||
| 	 | ||||
|       masks[i]=Zero(); | ||||
|       //////////////////// | ||||
|       // Setup the mask | ||||
|       //////////////////// | ||||
|       tmp = Zero(); | ||||
|       pickCheckerboard(cb,tmpcb,one); | ||||
|       setCheckerboard(tmp,tmpcb); | ||||
|       PokeIndex<LorentzIndex>(masks[i],tmp, mu); | ||||
| 	masks[i]=Zero(); | ||||
| 	//////////////////// | ||||
| 	// Setup the mask | ||||
| 	//////////////////// | ||||
| 	tmp = Zero(); | ||||
| 	pickCheckerboard(cb,tmpcb,one); | ||||
| 	setCheckerboard(tmp,tmpcb); | ||||
| 	PokeIndex<LorentzIndex>(masks[i],tmp, mu); | ||||
| 	 | ||||
|       } else { | ||||
| 	for(int mu=0;mu<Nd;mu++){ | ||||
| 	  PokeIndex<LorentzIndex>(masks[i],one, mu); | ||||
| 	} | ||||
|       } | ||||
|     } | ||||
|     delete UrbGrid; | ||||
|   } | ||||
| @@ -797,14 +764,10 @@ public: | ||||
|         tmp_mu = peekLorentz(*this->ThinLinks, mu) * peekLorentz(force, mu); | ||||
|         pokeLorentz(SigmaTilde, tmp_mu, mu); | ||||
|       } | ||||
|  | ||||
|  | ||||
|       double end = usecond(); | ||||
|       double time = (end - start)/ 1e3; | ||||
|       std::cout << GridLogMessage << " GaugeConfigurationMasked: Smeared Force chain rule took " << time << " ms" << std::endl; | ||||
|  | ||||
|       std::cout << GridLogMessage << " GaugeConfigurationMasked: Smeared Force chain rule took " << time << " ms" << std::endl;   | ||||
|     }  // if smearingLevels = 0 do nothing | ||||
|     SigmaTilde=Gimpl::projectForce(SigmaTilde); // Ta | ||||
|   } | ||||
|  | ||||
| }; | ||||
|   | ||||
| @@ -2,11 +2,15 @@ | ||||
|  | ||||
| Grid physics library, www.github.com/paboyle/Grid | ||||
|  | ||||
| Source file: ./lib/qcd/action/gauge/JacobianAction.h | ||||
| Source file: ./lib/qcd/action/gauge/WilsonGaugeAction.h | ||||
|  | ||||
| Copyright (C) 2015 | ||||
|  | ||||
| Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk> | ||||
| Author: Peter Boyle <paboyle@ph.ed.ac.uk> | ||||
| Author: neo <cossu@post.kek.jp> | ||||
| Author: paboyle <paboyle@ph.ed.ac.uk> | ||||
| Author: Guido Cossu <guido.cossu@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 | ||||
|   | ||||
| @@ -34,61 +34,6 @@ directory | ||||
|  | ||||
| NAMESPACE_BEGIN(Grid); | ||||
|  | ||||
| template<int N, class Vec> | ||||
| Lattice<iScalar<iScalar<iScalar<Vec> > > > Determinant(const Lattice<iScalar<iScalar<iMatrix<Vec, N> > > > &Umu) | ||||
| { | ||||
|   GridBase *grid=Umu.Grid(); | ||||
|   auto lvol = grid->lSites(); | ||||
|   Lattice<iScalar<iScalar<iScalar<Vec> > > > ret(grid); | ||||
|   typedef typename Vec::scalar_type scalar; | ||||
|   autoView(Umu_v,Umu,CpuRead); | ||||
|   autoView(ret_v,ret,CpuWrite); | ||||
|   thread_for(site,lvol,{ | ||||
|     Eigen::MatrixXcd EigenU = Eigen::MatrixXcd::Zero(N,N); | ||||
|     Coordinate lcoor; | ||||
|     grid->LocalIndexToLocalCoor(site, lcoor); | ||||
|     iScalar<iScalar<iMatrix<scalar, N> > > Us; | ||||
|     peekLocalSite(Us, Umu_v, lcoor); | ||||
|     for(int i=0;i<N;i++){ | ||||
|       for(int j=0;j<N;j++){ | ||||
| 	scalar tmp= Us()()(i,j); | ||||
| 	ComplexD ztmp(real(tmp),imag(tmp)); | ||||
| 	EigenU(i,j)=ztmp; | ||||
|       }} | ||||
|     ComplexD detD  = EigenU.determinant(); | ||||
|     typename Vec::scalar_type det(detD.real(),detD.imag()); | ||||
|     pokeLocalSite(det,ret_v,lcoor); | ||||
|   }); | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| template<int N, class Vec> | ||||
| static void ProjectSUn(Lattice<iScalar<iScalar<iMatrix<Vec, N> > > > &Umu) | ||||
| { | ||||
|   Umu      = ProjectOnGroup(Umu); | ||||
|   auto det = Determinant(Umu); | ||||
|  | ||||
|   det = conjugate(det); | ||||
|  | ||||
|   for(int i=0;i<N;i++){ | ||||
|     auto element = PeekIndex<ColourIndex>(Umu,N-1,i); | ||||
|     element = element * det; | ||||
|     PokeIndex<ColourIndex>(Umu,element,Nc-1,i); | ||||
|   } | ||||
| } | ||||
| template<int N,class Vec> | ||||
| static void ProjectSUn(Lattice<iVector<iScalar<iMatrix<Vec, N> >,Nd> > &U) | ||||
| { | ||||
|   GridBase *grid=U.Grid(); | ||||
|   // Reunitarise | ||||
|   for(int mu=0;mu<Nd;mu++){ | ||||
|     auto Umu = PeekIndex<LorentzIndex>(U,mu); | ||||
|     Umu      = ProjectOnGroup(Umu); | ||||
|     ProjectSUn(Umu); | ||||
|     PokeIndex<LorentzIndex>(U,Umu,mu); | ||||
|   } | ||||
| } | ||||
|  | ||||
| template <int ncolour> | ||||
| class SU { | ||||
| public: | ||||
| @@ -796,14 +741,8 @@ public: | ||||
|     typedef Lattice<vMatrixType> LatticeMatrixType; | ||||
|  | ||||
|     LatticeMatrixType Umu(out.Grid()); | ||||
|     LatticeMatrixType tmp(out.Grid()); | ||||
|     for (int mu = 0; mu < Nd; mu++) { | ||||
|       //      LieRandomize(pRNG, Umu, 1.0); | ||||
|       //      PokeIndex<LorentzIndex>(out, Umu, mu); | ||||
|       gaussian(pRNG,Umu); | ||||
|       tmp = Ta(Umu); | ||||
|       taExp(tmp,Umu); | ||||
|       ProjectSUn(Umu); | ||||
|       LieRandomize(pRNG, Umu, 1.0); | ||||
|       PokeIndex<LorentzIndex>(out, Umu, mu); | ||||
|     } | ||||
|   } | ||||
| @@ -859,6 +798,30 @@ public: | ||||
|   } | ||||
| }; | ||||
|  | ||||
| template<int N> | ||||
| LatticeComplexD Determinant(const Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) | ||||
| { | ||||
|   GridBase *grid=Umu.Grid(); | ||||
|   auto lvol = grid->lSites(); | ||||
|   LatticeComplexD ret(grid); | ||||
|  | ||||
|   autoView(Umu_v,Umu,CpuRead); | ||||
|   autoView(ret_v,ret,CpuWrite); | ||||
|   thread_for(site,lvol,{ | ||||
|     Eigen::MatrixXcd EigenU = Eigen::MatrixXcd::Zero(N,N); | ||||
|     Coordinate lcoor; | ||||
|     grid->LocalIndexToLocalCoor(site, lcoor); | ||||
|     iScalar<iScalar<iMatrix<ComplexD, N> > > Us; | ||||
|     peekLocalSite(Us, Umu_v, lcoor); | ||||
|     for(int i=0;i<N;i++){ | ||||
|       for(int j=0;j<N;j++){ | ||||
| 	EigenU(i,j) = Us()()(i,j); | ||||
|       }} | ||||
|     ComplexD det = EigenU.determinant(); | ||||
|     pokeLocalSite(det,ret_v,lcoor); | ||||
|   }); | ||||
|   return ret; | ||||
| } | ||||
| template<int N> | ||||
| Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > Inverse(const Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) | ||||
| { | ||||
| @@ -888,6 +851,32 @@ Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > Inverse(const Lattice<iScala | ||||
|   }); | ||||
|   return ret; | ||||
| } | ||||
| template<int N> | ||||
| static void ProjectSUn(Lattice<iScalar<iScalar<iMatrix<vComplexD, N> > > > &Umu) | ||||
| { | ||||
|   Umu      = ProjectOnGroup(Umu); | ||||
|   auto det = Determinant(Umu); | ||||
|  | ||||
|   det = conjugate(det); | ||||
|  | ||||
|   for(int i=0;i<N;i++){ | ||||
|     auto element = PeekIndex<ColourIndex>(Umu,N-1,i); | ||||
|     element = element * det; | ||||
|     PokeIndex<ColourIndex>(Umu,element,Nc-1,i); | ||||
|   } | ||||
| } | ||||
| template<int N> | ||||
| static void ProjectSUn(Lattice<iVector<iScalar<iMatrix<vComplexD, N> >,Nd> > &U) | ||||
| { | ||||
|   GridBase *grid=U.Grid(); | ||||
|   // Reunitarise | ||||
|   for(int mu=0;mu<Nd;mu++){ | ||||
|     auto Umu = PeekIndex<LorentzIndex>(U,mu); | ||||
|     Umu      = ProjectOnGroup(Umu); | ||||
|     ProjectSUn(Umu); | ||||
|     PokeIndex<LorentzIndex>(U,Umu,mu); | ||||
|   } | ||||
| } | ||||
| // Explicit specialisation for SU(3). | ||||
| // Explicit specialisation for SU(3). | ||||
| static void | ||||
|   | ||||
| @@ -705,7 +705,7 @@ public: | ||||
| 	} | ||||
|       } | ||||
|     } | ||||
|     std::cout << GridLogDebug << "BuildSurfaceList size is "<<surface_list.size()<<std::endl; | ||||
|     std::cout << "BuildSurfaceList size is "<<surface_list.size()<<std::endl; | ||||
|   } | ||||
|   /// Introduce a block structure and switch off comms on boundaries | ||||
|   void DirichletBlock(const Coordinate &dirichlet_block) | ||||
|   | ||||
| @@ -55,7 +55,7 @@ template<class vtype, int N> accelerator_inline iVector<vtype, N> Exponentiate(c | ||||
|  | ||||
|  | ||||
| // Specialisation: Cayley-Hamilton exponential for SU(3) | ||||
| #if 0 | ||||
| #ifndef GRID_ACCELERATED | ||||
| template<class vtype, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0>::type * =nullptr>  | ||||
| accelerator_inline iMatrix<vtype,3> Exponentiate(const iMatrix<vtype,3> &arg, RealD alpha  , Integer Nexp = DEFAULT_MAT_EXP ) | ||||
| { | ||||
|   | ||||
							
								
								
									
										224
									
								
								HMC/FTHMC2p1f.cc
									
									
									
									
									
								
							
							
						
						
									
										224
									
								
								HMC/FTHMC2p1f.cc
									
									
									
									
									
								
							| @@ -1,224 +0,0 @@ | ||||
| /************************************************************************************* | ||||
|  | ||||
| Grid physics library, www.github.com/paboyle/Grid | ||||
|  | ||||
| Copyright (C) 2023 | ||||
|  | ||||
| Author: Peter Boyle <pabobyle@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/Grid.h> | ||||
| #include <Grid/qcd/smearing/GaugeConfigurationMasked.h> | ||||
| #include <Grid/qcd/smearing/JacobianAction.h> | ||||
|  | ||||
| using namespace Grid; | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|   std::cout << std::setprecision(12); | ||||
|    | ||||
|   Grid_init(&argc, &argv); | ||||
|   int threads = GridThread::GetThreads(); | ||||
|   // here make a routine to print all the relevant information on the run | ||||
|   std::cout << GridLogMessage << "Grid is setup to use " << threads << " threads" << std::endl; | ||||
|  | ||||
|    // Typedefs to simplify notation | ||||
|   typedef WilsonImplR FermionImplPolicy; | ||||
|   typedef MobiusFermionD FermionAction; | ||||
|   typedef typename FermionAction::FermionField FermionField; | ||||
|  | ||||
|   typedef Grid::XmlReader       Serialiser; | ||||
|  | ||||
|   //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | ||||
|   IntegratorParameters MD; | ||||
|   //  typedef GenericHMCRunner<LeapFrog> HMCWrapper; | ||||
|   //  MD.name    = std::string("Leap Frog"); | ||||
|   //  typedef GenericHMCRunner<ForceGradient> HMCWrapper; | ||||
|   //  MD.name    = std::string("Force Gradient"); | ||||
|   typedef GenericHMCRunner<MinimumNorm2> HMCWrapper; | ||||
|   MD.name    = std::string("MinimumNorm2"); | ||||
|   MD.MDsteps = 12; | ||||
|   MD.trajL   = 1.0; | ||||
|  | ||||
|   HMCparameters HMCparams; | ||||
|   HMCparams.StartTrajectory  = 0; | ||||
|   HMCparams.Trajectories     = 200; | ||||
|   HMCparams.NoMetropolisUntil=  20; | ||||
|   // "[HotStart, ColdStart, TepidStart, CheckpointStart]\n"; | ||||
|   HMCparams.StartingType     =std::string("HotStart"); | ||||
|   HMCparams.MD = MD; | ||||
|   HMCWrapper TheHMC(HMCparams); | ||||
|  | ||||
|   // Grid from the command line arguments --grid and --mpi | ||||
|   TheHMC.Resources.AddFourDimGrid("gauge"); // use default simd lanes decomposition | ||||
|  | ||||
|   CheckpointerParameters CPparams; | ||||
|   CPparams.config_prefix = "ckpoint_EODWF_lat"; | ||||
|   CPparams.smeared_prefix = "ckpoint_EODWF_lat_smr"; | ||||
|   CPparams.rng_prefix    = "ckpoint_EODWF_rng"; | ||||
|   CPparams.saveInterval  = 1; | ||||
|   CPparams.saveSmeared   = true; | ||||
|   CPparams.format        = "IEEE64BIG"; | ||||
|   TheHMC.Resources.LoadNerscCheckpointer(CPparams); | ||||
|  | ||||
|   RNGModuleParameters RNGpar; | ||||
|   RNGpar.serial_seeds = "1 2 3 4 5"; | ||||
|   RNGpar.parallel_seeds = "6 7 8 9 10"; | ||||
|   TheHMC.Resources.SetRNGSeeds(RNGpar); | ||||
|  | ||||
|   // Construct observables | ||||
|   // here there is too much indirection | ||||
|   typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs; | ||||
|   TheHMC.Resources.AddObservable<PlaqObs>(); | ||||
|   ////////////////////////////////////////////// | ||||
|  | ||||
|   const int Ls      = 16; | ||||
|   Real beta         = 2.13; | ||||
|   Real light_mass   = 0.01; | ||||
|   Real strange_mass = 0.04; | ||||
|   Real pv_mass      = 1.0; | ||||
|   RealD M5  = 1.8; | ||||
|   RealD b   = 1.0; // Scale factor two | ||||
|   RealD c   = 0.0; | ||||
|  | ||||
|   OneFlavourRationalParams OFRp; | ||||
|   OFRp.lo       = 1.0e-2; | ||||
|   OFRp.hi       = 64; | ||||
|   OFRp.MaxIter  = 10000; | ||||
|   OFRp.tolerance= 1.0e-10; | ||||
|   OFRp.degree   = 14; | ||||
|   OFRp.precision= 40; | ||||
|  | ||||
|   std::vector<Real> hasenbusch({ 0.1 }); | ||||
|  | ||||
|   auto GridPtr   = TheHMC.Resources.GetCartesian(); | ||||
|   auto GridRBPtr = TheHMC.Resources.GetRBCartesian(); | ||||
|   auto FGrid     = SpaceTimeGrid::makeFiveDimGrid(Ls,GridPtr); | ||||
|   auto FrbGrid   = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,GridPtr); | ||||
|  | ||||
|   IwasakiGaugeActionR GaugeAction(beta); | ||||
|  | ||||
|   // temporarily need a gauge field | ||||
|   LatticeGaugeField U(GridPtr); | ||||
|   LatticeGaugeField Uhot(GridPtr); | ||||
|  | ||||
|   // These lines are unecessary if BC are all periodic | ||||
|   std::vector<Complex> boundary = {1,1,1,-1}; | ||||
|   FermionAction::ImplParams Params(boundary); | ||||
|  | ||||
|   double StoppingCondition = 1e-10; | ||||
|   double MaxCGIterations = 30000; | ||||
|   ConjugateGradient<FermionField>  CG(StoppingCondition,MaxCGIterations); | ||||
|  | ||||
|   bool ApplySmearing = true; | ||||
|    | ||||
|   //////////////////////////////////// | ||||
|   // Collect actions | ||||
|   //////////////////////////////////// | ||||
|   ActionLevel<HMCWrapper::Field> Level1(1); | ||||
|   ActionLevel<HMCWrapper::Field> Level2(2); | ||||
|   ActionLevel<HMCWrapper::Field> Level3(4); | ||||
|  | ||||
|   //////////////////////////////////// | ||||
|   // Strange action | ||||
|   //////////////////////////////////// | ||||
|  | ||||
|   MobiusEOFAFermionD Strange_Op_L (U , *FGrid , *FrbGrid , *GridPtr , *GridRBPtr , strange_mass, strange_mass, pv_mass, 0.0, -1, M5, b, c); | ||||
|   MobiusEOFAFermionD Strange_Op_R (U , *FGrid , *FrbGrid , *GridPtr , *GridRBPtr , pv_mass, strange_mass,      pv_mass, -1.0, 1, M5, b, c); | ||||
|   ExactOneFlavourRatioPseudoFermionAction<FermionImplPolicy>  | ||||
|     EOFA(Strange_Op_L, Strange_Op_R,  | ||||
| 	 CG, | ||||
| 	 CG, CG, | ||||
| 	 CG, CG,  | ||||
| 	 OFRp, false); | ||||
|  | ||||
|   EOFA.is_smeared = ApplySmearing; | ||||
|   Level1.push_back(&EOFA); | ||||
|  | ||||
|   //////////////////////////////////// | ||||
|   // up down action | ||||
|   //////////////////////////////////// | ||||
|   std::vector<Real> light_den; | ||||
|   std::vector<Real> light_num; | ||||
|  | ||||
|   int n_hasenbusch = hasenbusch.size(); | ||||
|   light_den.push_back(light_mass); | ||||
|   for(int h=0;h<n_hasenbusch;h++){ | ||||
|     light_den.push_back(hasenbusch[h]); | ||||
|     light_num.push_back(hasenbusch[h]); | ||||
|   } | ||||
|   light_num.push_back(pv_mass); | ||||
|  | ||||
|   std::vector<FermionAction *> Numerators; | ||||
|   std::vector<FermionAction *> Denominators; | ||||
|   std::vector<TwoFlavourEvenOddRatioPseudoFermionAction<FermionImplPolicy> *> Quotients; | ||||
|  | ||||
|   for(int h=0;h<n_hasenbusch+1;h++){ | ||||
|     std::cout << GridLogMessage << " 2f quotient Action  "<< light_num[h] << " / " << light_den[h]<< std::endl; | ||||
|     Numerators.push_back  (new FermionAction(U,*FGrid,*FrbGrid,*GridPtr,*GridRBPtr,light_num[h],M5,b,c, Params)); | ||||
|     Denominators.push_back(new FermionAction(U,*FGrid,*FrbGrid,*GridPtr,*GridRBPtr,light_den[h],M5,b,c, Params)); | ||||
|     Quotients.push_back   (new TwoFlavourEvenOddRatioPseudoFermionAction<FermionImplPolicy>(*Numerators[h],*Denominators[h],CG,CG)); | ||||
|   } | ||||
|  | ||||
|   for(int h=0;h<n_hasenbusch+1;h++){ | ||||
|     Quotients[h]->is_smeared = ApplySmearing; | ||||
|     Level1.push_back(Quotients[h]); | ||||
|   } | ||||
|  | ||||
|   ///////////////////////////////////////////////////////////// | ||||
|   // lnDetJacobianAction | ||||
|   ///////////////////////////////////////////////////////////// | ||||
|   double rho = 0.1;  // smearing parameter | ||||
|   int Nsmear = 1;    // number of smearing levels - must be multiple of 2Nd | ||||
|   int Nstep  = 8*Nsmear;    // number of smearing levels - must be multiple of 2Nd | ||||
|   Smear_Stout<HMCWrapper::ImplPolicy> Stout(rho); | ||||
|   SmearedConfigurationMasked<HMCWrapper::ImplPolicy> SmearingPolicy(GridPtr, Nstep, Stout); | ||||
|   JacobianAction<HMCWrapper::ImplPolicy> Jacobian(&SmearingPolicy); | ||||
|   if( ApplySmearing ) Level2.push_back(&Jacobian); | ||||
|   std::cout << GridLogMessage << " Built the Jacobian "<< std::endl; | ||||
|  | ||||
|  | ||||
|   ///////////////////////////////////////////////////////////// | ||||
|   // Gauge action | ||||
|   ///////////////////////////////////////////////////////////// | ||||
|   //  GaugeAction.is_smeared = ApplySmearing; | ||||
|   GaugeAction.is_smeared = true; | ||||
|   Level3.push_back(&GaugeAction); | ||||
|  | ||||
|   std::cout << GridLogMessage << " ************************************************"<< std::endl; | ||||
|   std::cout << GridLogMessage << " Action complete -- NO FERMIONS FOR NOW -- FIXME"<< std::endl; | ||||
|   std::cout << GridLogMessage << " ************************************************"<< std::endl; | ||||
|   std::cout << GridLogMessage <<  std::endl; | ||||
|   std::cout << GridLogMessage <<  std::endl; | ||||
|  | ||||
|  | ||||
|   std::cout << GridLogMessage << " Running the FT HMC "<< std::endl; | ||||
|  | ||||
|   TheHMC.TheAction.push_back(Level1); | ||||
|   TheHMC.TheAction.push_back(Level2); | ||||
|   TheHMC.TheAction.push_back(Level3); | ||||
|  | ||||
|   TheHMC.Run(SmearingPolicy); // for smearing | ||||
|  | ||||
|   Grid_finalize(); | ||||
| } // main | ||||
|  | ||||
|  | ||||
|  | ||||
| @@ -146,8 +146,6 @@ NAMESPACE_END(Grid); | ||||
| int main(int argc, char **argv) { | ||||
|   using namespace Grid; | ||||
|  | ||||
|   std::cout << " Grid Initialise "<<std::endl; | ||||
|    | ||||
|   Grid_init(&argc, &argv); | ||||
|  | ||||
|   CartesianCommunicator::BarrierWorld(); | ||||
| @@ -172,24 +170,24 @@ int main(int argc, char **argv) { | ||||
|   IntegratorParameters MD; | ||||
|   //  typedef GenericHMCRunner<LeapFrog> HMCWrapper; | ||||
|   //  MD.name    = std::string("Leap Frog"); | ||||
|   //  typedef GenericHMCRunner<ForceGradient> HMCWrapper; | ||||
|   //  MD.name    = std::string("Force Gradient"); | ||||
|   typedef GenericHMCRunner<MinimumNorm2> HMCWrapper; | ||||
|   MD.name    = std::string("MinimumNorm2"); | ||||
|   typedef GenericHMCRunner<ForceGradient> HMCWrapper; | ||||
|   MD.name    = std::string("Force Gradient"); | ||||
|   //typedef GenericHMCRunner<MinimumNorm2> HMCWrapper; | ||||
|   // MD.name    = std::string("MinimumNorm2"); | ||||
|   // TrajL = 2 | ||||
|   // 4/2 => 0.6 dH | ||||
|   // 3/3 => 0.8 dH .. depth 3, slower | ||||
|   //MD.MDsteps =  4; | ||||
|   MD.MDsteps =  14; | ||||
|   MD.MDsteps =  12; | ||||
|   MD.trajL   = 0.5; | ||||
|  | ||||
|   HMCparameters HMCparams; | ||||
|   HMCparams.StartTrajectory  = 1077; | ||||
|   HMCparams.Trajectories     = 20; | ||||
|   HMCparams.Trajectories     = 1; | ||||
|   HMCparams.NoMetropolisUntil=  0; | ||||
|   // "[HotStart, ColdStart, TepidStart, CheckpointStart]\n"; | ||||
|   HMCparams.StartingType     =std::string("ColdStart"); | ||||
|   //  HMCparams.StartingType     =std::string("CheckpointStart"); | ||||
|   //  HMCparams.StartingType     =std::string("ColdStart"); | ||||
|   HMCparams.StartingType     =std::string("CheckpointStart"); | ||||
|   HMCparams.MD = MD; | ||||
|   HMCWrapper TheHMC(HMCparams); | ||||
|  | ||||
| @@ -225,7 +223,7 @@ int main(int argc, char **argv) { | ||||
|   Real pv_mass      = 1.0; | ||||
|   //  std::vector<Real> hasenbusch({ 0.01, 0.045, 0.108, 0.25, 0.51 , pv_mass }); | ||||
|   //  std::vector<Real> hasenbusch({ light_mass, 0.01, 0.045, 0.108, 0.25, 0.51 , pv_mass }); | ||||
|   std::vector<Real> hasenbusch({ 0.005, 0.0145, 0.045, 0.108, 0.25, 0.51 }); // Updated | ||||
|   std::vector<Real> hasenbusch({ 0.005, 0.0145, 0.045, 0.108, 0.25, 0.51 , pv_mass }); // Updated | ||||
|   //  std::vector<Real> hasenbusch({ light_mass, 0.0145, 0.045, 0.108, 0.25, 0.51 , 0.75 , pv_mass }); | ||||
|  | ||||
|   auto GridPtr   = TheHMC.Resources.GetCartesian(); | ||||
| @@ -277,10 +275,10 @@ int main(int argc, char **argv) { | ||||
|  | ||||
|   //  double StoppingCondition = 1e-14; | ||||
|   //  double MDStoppingCondition = 1e-9; | ||||
|   double StoppingCondition = 1e-9; | ||||
|   double MDStoppingCondition = 1e-8; | ||||
|   double MDStoppingConditionLoose = 1e-8; | ||||
|   double MDStoppingConditionStrange = 1e-8; | ||||
|   double StoppingCondition = 1e-8; | ||||
|   double MDStoppingCondition = 1e-7; | ||||
|   double MDStoppingConditionLoose = 1e-7; | ||||
|   double MDStoppingConditionStrange = 1e-7; | ||||
|   double MaxCGIterations = 300000; | ||||
|   ConjugateGradient<FermionField>  CG(StoppingCondition,MaxCGIterations); | ||||
|   ConjugateGradient<FermionField>  MDCG(MDStoppingCondition,MaxCGIterations); | ||||
|   | ||||
| @@ -1,44 +0,0 @@ | ||||
| #!/bin/bash -l | ||||
| #SBATCH --job-name=bench_lehner | ||||
| #SBATCH --partition=small-g | ||||
| #SBATCH --nodes=2 | ||||
| #SBATCH --ntasks-per-node=8 | ||||
| #SBATCH --cpus-per-task=7 | ||||
| #SBATCH --gpus-per-node=8 | ||||
| #SBATCH --time=00:10:00 | ||||
| #SBATCH --account=project_465000546 | ||||
| #SBATCH --gpu-bind=none | ||||
| #SBATCH --exclusive | ||||
| #SBATCH --mem=0 | ||||
|  | ||||
| CPU_BIND="map_cpu:48,56,32,40,16,24,1,8" | ||||
| echo $CPU_BIND | ||||
|  | ||||
| cat << EOF > select_gpu | ||||
| #!/bin/bash | ||||
| export GPU_MAP=(0 1 2 3 4 5 6 7) | ||||
| export GPU=\${GPU_MAP[\$SLURM_LOCALID]} | ||||
| export HIP_VISIBLE_DEVICES=\$GPU | ||||
| unset ROCR_VISIBLE_DEVICES | ||||
| echo RANK \$SLURM_LOCALID using GPU \$GPU     | ||||
| exec \$* | ||||
| EOF | ||||
|  | ||||
| chmod +x ./select_gpu | ||||
|  | ||||
| root=/scratch/project_465000546/boylepet/Grid/systems/Lumi | ||||
| source ${root}/sourceme.sh | ||||
|  | ||||
| export OMP_NUM_THREADS=7 | ||||
| export MPICH_GPU_SUPPORT_ENABLED=1 | ||||
| export MPICH_SMP_SINGLE_COPY_MODE=XPMEM | ||||
|  | ||||
| for vol in 16.16.16.64 32.32.32.64  32.32.32.128 | ||||
| do | ||||
| srun --cpu-bind=${CPU_BIND} ./select_gpu ./Benchmark_dwf_fp32 --mpi 2.2.2.2 --accelerator-threads 8 --comms-overlap --shm 2048 --shm-mpi 0 --grid $vol  > log.shm0.ov.$vol | ||||
| #srun --cpu-bind=${CPU_BIND} ./select_gpu ./Benchmark_dwf_fp32 --mpi 2.2.2.2 --accelerator-threads 8 --comms-overlap --shm 2048 --shm-mpi 1 --grid $vol  > log.shm1.ov.$vol | ||||
|  | ||||
| srun --cpu-bind=${CPU_BIND} ./select_gpu ./Benchmark_dwf_fp32 --mpi 2.2.2.2 --accelerator-threads 8 --comms-sequential --shm 2048 --shm-mpi 0 --grid $vol  > log.shm0.seq.$vol | ||||
| #srun --cpu-bind=${CPU_BIND} ./select_gpu ./Benchmark_dwf_fp32 --mpi 2.2.2.2 --accelerator-threads 8 --comms-sequential --shm 2048 --shm-mpi 1 --grid $vol > log.shm1.seq.$vol | ||||
| done | ||||
|  | ||||
| @@ -3,28 +3,30 @@ spack load gmp | ||||
| spack load mpfr | ||||
| CLIME=`spack find --paths c-lime | grep c-lime| cut -c 15-` | ||||
| GMP=`spack find --paths gmp | grep gmp | cut -c 12-` | ||||
| MPFR=`spack find --paths mpfr | grep mpfr | cut -c 13-` | ||||
| echo clime X$CLIME | ||||
| echo gmp X$GMP | ||||
| echo mpfr X$MPFR | ||||
| MPFR=`spack find --paths mpfr | grep mpfr | cut -c 12-` | ||||
| echo clime $CLIME | ||||
| echo gmp $GMP | ||||
| echo mpfr $MPFR | ||||
|  | ||||
| ../../configure \ | ||||
| --enable-comms=mpi-auto \ | ||||
| ../../configure --enable-comms=mpi-auto \ | ||||
| --with-lime=$CLIME \ | ||||
| --enable-unified=no \ | ||||
| --enable-shm=nvlink \ | ||||
| --enable-tracing=timer \ | ||||
| --enable-accelerator=hip \ | ||||
| --enable-gen-simd-width=64 \ | ||||
| --enable-simd=GPU \ | ||||
| --enable-accelerator-cshift \ | ||||
| --with-gmp=$GMP \ | ||||
| --with-mpfr=$MPFR \ | ||||
| --disable-accelerator-cshift \ | ||||
| --with-gmp=$OLCF_GMP_ROOT \ | ||||
| --with-fftw=$FFTW_DIR/.. \ | ||||
| --with-mpfr=/opt/cray/pe/gcc/mpfr/3.1.4/ \ | ||||
| --disable-fermion-reps \ | ||||
| --disable-gparity \ | ||||
| CXX=hipcc MPICXX=mpicxx \ | ||||
|   CXXFLAGS="-fPIC --offload-arch=gfx90a -I/opt/rocm/include/ -std=c++14 -I/opt/cray/pe/mpich/8.1.23/ofi/gnu/9.1/include" \ | ||||
|   LDFLAGS="-L/opt/cray/pe/mpich/8.1.23/ofi/gnu/9.1/lib -lmpi -L/opt/cray/pe/mpich/8.1.23/gtl/lib -lmpi_gtl_hsa -lamdhip64 -fopenmp"  | ||||
| CXXFLAGS="-fPIC -I{$ROCM_PATH}/include/ -std=c++14 -I${MPICH_DIR}/include -L/lib64 --amdgpu-target=gfx90a" \ | ||||
|  LDFLAGS="-L/lib64 -L/opt/rocm-5.2.0/lib/ -L${MPICH_DIR}/lib -lmpi -L${CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa -lamdhip64 --amdgpu-target=gfx90a " | ||||
|  | ||||
|  | ||||
| #--enable-simd=GPU-RRII \ | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1 @@ | ||||
| source ~/spack/share/spack/setup-env.sh | ||||
| module load CrayEnv LUMI/22.12 partition/G  cray-fftw/3.3.10.1 rocm | ||||
| spack load c-lime | ||||
| spack load gmp | ||||
| spack load mpfr | ||||
| module load CrayEnv LUMI/22.12 partition/G  cray-fftw/3.3.10.1 | ||||
|   | ||||
| @@ -1,46 +0,0 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| #PBS -l select=1:system=sunspot,place=scatter | ||||
| #PBS -A LatticeQCD_aesp_CNDA | ||||
| #PBS -l walltime=01:00:00 | ||||
| #PBS -N dwf | ||||
| #PBS -k doe | ||||
|  | ||||
| HDIR=/home/paboyle/ | ||||
| module use /soft/testing/modulefiles/ | ||||
| module load intel-UMD23.05.25593.11/23.05.25593.11 | ||||
| module load tools/pti-gpu   | ||||
| export LD_LIBRARY_PATH=$HDIR/tools/lib64:$LD_LIBRARY_PATH | ||||
| export PATH=$HDIR/tools/bin:$PATH | ||||
|  | ||||
| export TZ='/usr/share/zoneinfo/US/Central' | ||||
| export OMP_PROC_BIND=spread | ||||
| export OMP_NUM_THREADS=3 | ||||
| unset OMP_PLACES | ||||
|  | ||||
| cd $PBS_O_WORKDIR | ||||
|  | ||||
| qsub jobscript.pbs | ||||
|  | ||||
| echo Jobid: $PBS_JOBID | ||||
| echo Running on host `hostname` | ||||
| echo Running on nodes `cat $PBS_NODEFILE` | ||||
|  | ||||
| echo NODES | ||||
| cat $PBS_NODEFILE | ||||
| NNODES=`wc -l < $PBS_NODEFILE` | ||||
| NRANKS=12         # Number of MPI ranks per node | ||||
| NDEPTH=4          # Number of hardware threads per rank, spacing between MPI ranks on a node | ||||
| NTHREADS=$OMP_NUM_THREADS # Number of OMP threads per rank, given to OMP_NUM_THREADS | ||||
|  | ||||
| NTOTRANKS=$(( NNODES * NRANKS )) | ||||
|  | ||||
| echo "NUM_NODES=${NNODES}  TOTAL_RANKS=${NTOTRANKS}  RANKS_PER_NODE=${NRANKS}  THREADS_PER_RANK=${OMP_NUM_THREADS}" | ||||
| echo "OMP_PROC_BIND=$OMP_PROC_BIND OMP_PLACES=$OMP_PLACES" | ||||
|  | ||||
|      | ||||
| CMD="mpiexec -np ${NTOTRANKS} -ppn ${NRANKS} -d ${NDEPTH} --cpu-bind=depth -envall \ | ||||
| 	     ./gpu_tile_compact.sh \ | ||||
| 	./Benchmark_dwf_fp32 --mpi 1.1.2.6 --grid 16.32.64.192 --comms-overlap \ | ||||
| 	--shm-mpi 0 --shm 2048 --device-mem 32000 --accelerator-threads 32" | ||||
|  | ||||
| @@ -1,52 +0,0 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| display_help() { | ||||
|   echo " Will map gpu tile to rank in compact and then round-robin fashion" | ||||
|   echo " Usage (only work for one node of ATS/PVC):" | ||||
|   echo "   mpiexec --np N gpu_tile_compact.sh ./a.out" | ||||
|   echo | ||||
|   echo " Example 3 GPU of 2 Tiles with 7 Ranks:" | ||||
|   echo "   0 Rank 0.0" | ||||
|   echo "   1 Rank 0.1" | ||||
|   echo "   2 Rank 1.0" | ||||
|   echo "   3 Rank 1.1" | ||||
|   echo "   4 Rank 2.0" | ||||
|   echo "   5 Rank 2.1" | ||||
|   echo "   6 Rank 0.0" | ||||
|   echo | ||||
|   echo " Hacked together by apl@anl.gov, please contact if bug found" | ||||
|   exit 1 | ||||
| } | ||||
|  | ||||
| #This give the exact GPU count i915 knows about and I use udev to only enumerate the devices with physical presence. | ||||
| #works? num_gpu=$(/usr/bin/udevadm info /sys/module/i915/drivers/pci\:i915/* |& grep -v Unknown | grep -c "P: /devices") | ||||
| num_gpu=6 | ||||
| num_tile=2 | ||||
|  | ||||
| if [ "$#" -eq 0 ] || [ "$1" == "--help" ] || [ "$1" == "-h" ] || [ "$num_gpu" = 0 ]; then | ||||
|   display_help | ||||
| fi | ||||
|  | ||||
| gpu_id=$(( (PALS_LOCAL_RANKID / num_tile ) % num_gpu )) | ||||
| tile_id=$((PALS_LOCAL_RANKID % num_tile)) | ||||
|  | ||||
| unset EnableWalkerPartition | ||||
| export EnableImplicitScaling=0 | ||||
| export ZE_ENABLE_PCI_ID_DEVICE_ORDER=1 | ||||
| export ZE_AFFINITY_MASK=$gpu_id.$tile_id | ||||
| export ONEAPI_DEVICE_FILTER=gpu,level_zero | ||||
| export SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=0 | ||||
| export SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 | ||||
| export SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE=0:2 | ||||
| export SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE_FOR_D2D_COPY=1 | ||||
| #export SYCL_PI_LEVEL_ZERO_USM_RESIDENT=1 | ||||
|  | ||||
| echo "rank $PALS_RANKID ; local rank $PALS_LOCAL_RANKID ; ZE_AFFINITY_MASK=$ZE_AFFINITY_MASK" | ||||
|  | ||||
| if [ $PALS_LOCAL_RANKID = 0 ] | ||||
| then | ||||
|     onetrace --chrome-device-timeline "$@" | ||||
| #    "$@" | ||||
| else | ||||
| "$@" | ||||
| fi | ||||
| @@ -1,16 +0,0 @@ | ||||
| TOOLS=$HOME/tools | ||||
| ../../configure \ | ||||
| 	--enable-simd=GPU \ | ||||
| 	--enable-gen-simd-width=64 \ | ||||
| 	--enable-comms=mpi-auto \ | ||||
| 	--enable-accelerator-cshift \ | ||||
| 	--disable-gparity \ | ||||
| 	--disable-fermion-reps \ | ||||
| 	--enable-shm=nvlink \ | ||||
| 	--enable-accelerator=sycl \ | ||||
| 	--enable-unified=no \ | ||||
| 	MPICXX=mpicxx \ | ||||
| 	CXX=icpx \ | ||||
| 	LDFLAGS="-fiopenmp -fsycl -fsycl-device-code-split=per_kernel -fsycl-device-lib=all -lze_loader -lapmidg -L$TOOLS/lib64/" \ | ||||
| 	CXXFLAGS="-fiopenmp -fsycl-unnamed-lambda -fsycl -I$INSTALL/include -Wno-tautological-compare -I$HOME/ -I$TOOLS/include" | ||||
|  | ||||
| @@ -1,4 +1,4 @@ | ||||
| BREW=/opt/local/ | ||||
| CXX=mpicxx-openmpi-mp ../../configure --enable-simd=GEN --enable-comms=mpi --enable-unified=yes --prefix $HOME/QCD/GridInstall --with-lime=/Users/peterboyle/QCD/SciDAC/install/ --with-openssl=$BREW --disable-fermion-reps --disable-gparity --disable-debug | ||||
| MPICXX=mpicxx CXX=c++-12 ../../configure --enable-simd=GEN --enable-comms=mpi-auto --enable-unified=yes --prefix $HOME/QCD/GridInstall --with-lime=/Users/peterboyle/QCD/SciDAC/install/ --with-openssl=$BREW --disable-fermion-reps --disable-gparity  | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,307 +0,0 @@ | ||||
|     /************************************************************************************* | ||||
|  | ||||
|     grid` physics library, www.github.com/paboyle/Grid  | ||||
|  | ||||
|     Source file: ./tests/Test_cshift.cc | ||||
|  | ||||
|     Copyright (C) 2015 | ||||
|  | ||||
| Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk> | ||||
| 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 */ | ||||
| #include <Grid/Grid.h> | ||||
|  | ||||
| using namespace Grid; | ||||
|  | ||||
| int main (int argc, char ** argv) | ||||
| { | ||||
|   Grid_init(&argc,&argv); | ||||
|  | ||||
|   int threads = GridThread::GetThreads(); | ||||
|   std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl; | ||||
|  | ||||
|   Coordinate latt_size   = GridDefaultLatt(); | ||||
|   Coordinate simd_layout( { vComplexD::Nsimd(),1,1,1}); | ||||
|   Coordinate mpi_layout  = GridDefaultMpi(); | ||||
|  | ||||
|   int vol = 1; | ||||
|   for(int d=0;d<latt_size.size();d++){ | ||||
|     vol = vol * latt_size[d]; | ||||
|   } | ||||
|   GridCartesian         GRID(latt_size,simd_layout,mpi_layout); | ||||
|   GridRedBlackCartesian RBGRID(&GRID); | ||||
|  | ||||
|   ComplexD ci(0.0,1.0); | ||||
|  | ||||
|   std::vector<int> seeds({1,2,3,4}); | ||||
|   GridSerialRNG          sRNG;  sRNG.SeedFixedIntegers(seeds); // naughty seeding | ||||
|   GridParallelRNG          pRNG(&GRID); | ||||
|   pRNG.SeedFixedIntegers(seeds); | ||||
|  | ||||
|   LatticeGaugeFieldD Umu(&GRID); | ||||
|  | ||||
|   SU<Nc>::ColdConfiguration(pRNG,Umu); // Unit gauge | ||||
|  | ||||
|   //////////////////////////////////////////////////// | ||||
|   // PF prop | ||||
|   //////////////////////////////////////////////////// | ||||
|   LatticeFermionD    src(&GRID); | ||||
|  | ||||
|   gaussian(pRNG,src); | ||||
| #if 1 | ||||
|     Coordinate point(4,0); | ||||
|     src=Zero(); | ||||
|     SpinColourVectorD ferm; gaussian(sRNG,ferm); | ||||
|     pokeSite(ferm,src,point); | ||||
| #endif | ||||
|    | ||||
|   { | ||||
|     std::cout<<"****************************************"<<std::endl; | ||||
|     std::cout << "Testing PartialFraction Hw kernel Mom space 4d propagator \n"; | ||||
|     std::cout<<"****************************************"<<std::endl; | ||||
|  | ||||
|     //    LatticeFermionD    src(&GRID); gaussian(pRNG,src); | ||||
|     LatticeFermionD    tmp(&GRID); | ||||
|     LatticeFermionD    ref(&GRID); | ||||
|     LatticeFermionD    diff(&GRID); | ||||
|  | ||||
|     const int Ls=48+1; | ||||
|     GridCartesian         * FGrid   = SpaceTimeGrid::makeFiveDimGrid(Ls,&GRID); | ||||
|     GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,&GRID); | ||||
|  | ||||
|     RealD mass=0.1; | ||||
|     RealD M5  =0.8; | ||||
|     OverlapWilsonPartialFractionZolotarevFermionD Dov(Umu,*FGrid,*FrbGrid,GRID,RBGRID,mass,M5,0.001,8.0); | ||||
|  | ||||
|     // Momentum space prop | ||||
|     std::cout << " Solving by FFT and Feynman rules" <<std::endl; | ||||
|     bool fiveD = false; //calculate 4d free propagator | ||||
|  | ||||
|     std::cout << " Free propagator " <<std::endl; | ||||
|     Dov.FreePropagator(src,ref,mass) ; | ||||
|     std::cout << " Free propagator norm "<< norm2(ref) <<std::endl; | ||||
|  | ||||
|     Gamma G5(Gamma::Algebra::Gamma5); | ||||
|  | ||||
|     LatticeFermionD    src5(FGrid); src5=Zero(); | ||||
|     LatticeFermionD    tmp5(FGrid);  | ||||
|     LatticeFermionD    result5(FGrid); result5=Zero(); | ||||
|     LatticeFermionD    result4(&GRID);  | ||||
|     const int sdir=0; | ||||
|  | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     // Import | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     std::cout << " Free propagator Import "<< norm2(src) <<std::endl; | ||||
|     Dov.ImportPhysicalFermionSource  (src,src5); | ||||
|     std::cout << " Free propagator Imported "<< norm2(src5) <<std::endl; | ||||
|      | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     // Conjugate gradient on normal equations system | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     std::cout << " Solving by Conjugate Gradient (CGNE)" <<std::endl; | ||||
|     Dov.Mdag(src5,tmp5); | ||||
|     src5=tmp5; | ||||
|     MdagMLinearOperator<OverlapWilsonPartialFractionZolotarevFermionD,LatticeFermionD> HermOp(Dov); | ||||
|     ConjugateGradient<LatticeFermionD> CG(1.0e-8,10000); | ||||
|     CG(HermOp,src5,result5); | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     // Domain wall physical field propagator | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     Dov.ExportPhysicalFermionSolution(result5,result4); | ||||
|  | ||||
|     // From DWF4d.pdf : | ||||
|     // | ||||
|     // Dov_pf = 2/(1-m) D_cayley_ovlap  [ Page 43 ] | ||||
|     // Dinv_cayley_ovlap = 2/(1-m) Dinv_pf  | ||||
|     // Dinv_cayley_surface =1/(1-m) ( Dinv_cayley_ovlap - 1 ) =>  2/(1-m)^2 Dinv_pf - 1/(1-m) * src   [ Eq.2.67 ] | ||||
|  | ||||
|     RealD scale = 2.0/(1.0-mass)/(1.0-mass); | ||||
|     result4 = result4 * scale; | ||||
|     result4 = result4 - src*(1.0/(1.0-mass)); // Subtract contact term | ||||
|     DumpSliceNorm("Src",src); | ||||
|     DumpSliceNorm("Grid",result4); | ||||
|     DumpSliceNorm("Fourier",ref); | ||||
|  | ||||
|     std::cout << "Dov result4 "<<norm2(result4)<<std::endl; | ||||
|     std::cout << "Dov ref     "<<norm2(ref)<<std::endl; | ||||
|  | ||||
|     diff = result4- ref; | ||||
|     DumpSliceNorm("diff ",diff); | ||||
|      | ||||
|   } | ||||
|    | ||||
|   //////////////////////////////////////////////////// | ||||
|   // Dwf prop | ||||
|   //////////////////////////////////////////////////// | ||||
|   { | ||||
|     std::cout<<"****************************************"<<std::endl; | ||||
|     std::cout << "Testing Dov(Hw) Mom space 4d propagator \n"; | ||||
|     std::cout<<"****************************************"<<std::endl; | ||||
|  | ||||
|     LatticeFermionD    tmp(&GRID); | ||||
|     LatticeFermionD    ref(&GRID); | ||||
|     LatticeFermionD    diff(&GRID); | ||||
|  | ||||
|     const int Ls=48; | ||||
|     GridCartesian         * FGrid   = SpaceTimeGrid::makeFiveDimGrid(Ls,&GRID); | ||||
|     GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,&GRID); | ||||
|  | ||||
|     RealD mass=0.1; | ||||
|     RealD M5  =0.8; | ||||
|  | ||||
|     OverlapWilsonCayleyTanhFermionD Dov(Umu,*FGrid,*FrbGrid,GRID,RBGRID,mass,M5,1.0); | ||||
|  | ||||
|     // Momentum space prop | ||||
|     std::cout << " Solving by FFT and Feynman rules" <<std::endl; | ||||
|     Dov.FreePropagator(src,ref,mass) ; | ||||
|  | ||||
|     Gamma G5(Gamma::Algebra::Gamma5); | ||||
|  | ||||
|     LatticeFermionD    src5(FGrid); src5=Zero(); | ||||
|     LatticeFermionD    tmp5(FGrid);  | ||||
|     LatticeFermionD    result5(FGrid); result5=Zero(); | ||||
|     LatticeFermionD    result4(&GRID);  | ||||
|     const int sdir=0; | ||||
|  | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     // Domain wall physical field source; need D_minus | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     /* | ||||
| 	chi_5[0]   = chiralProjectPlus(chi); | ||||
| 	chi_5[Ls-1]= chiralProjectMinus(chi); | ||||
|     */       | ||||
|     tmp =   (src + G5*src)*0.5;      InsertSlice(tmp,src5,   0,sdir); | ||||
|     tmp =   (src - G5*src)*0.5;      InsertSlice(tmp,src5,Ls-1,sdir); | ||||
|      | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     // Conjugate gradient on normal equations system | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     std::cout << " Solving by Conjugate Gradient (CGNE)" <<std::endl; | ||||
|     Dov.Dminus(src5,tmp5); | ||||
|     src5=tmp5; | ||||
|     Dov.Mdag(src5,tmp5); | ||||
|     src5=tmp5; | ||||
|     MdagMLinearOperator<OverlapWilsonCayleyTanhFermionD,LatticeFermionD> HermOp(Dov); | ||||
|     ConjugateGradient<LatticeFermionD> CG(1.0e-16,10000); | ||||
|     CG(HermOp,src5,result5); | ||||
|      | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     // Domain wall physical field propagator | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     /* | ||||
|       psi  = chiralProjectMinus(psi_5[0]); | ||||
|       psi += chiralProjectPlus(psi_5[Ls-1]); | ||||
|     */ | ||||
|     ExtractSlice(tmp,result5,0   ,sdir);   result4 =         (tmp-G5*tmp)*0.5; | ||||
|     ExtractSlice(tmp,result5,Ls-1,sdir);   result4 = result4+(tmp+G5*tmp)*0.5; | ||||
|      | ||||
|     std::cout << " Taking difference" <<std::endl; | ||||
|     std::cout << "Dov result4 "<<norm2(result4)<<std::endl; | ||||
|     std::cout << "Dov ref     "<<norm2(ref)<<std::endl; | ||||
|     DumpSliceNorm("Grid",result4); | ||||
|     DumpSliceNorm("Fourier",ref); | ||||
|     diff = ref - result4; | ||||
|     std::cout << "result - ref     "<<norm2(diff)<<std::endl; | ||||
|      | ||||
|     DumpSliceNorm("diff",diff); | ||||
|  | ||||
|   } | ||||
|  | ||||
|    | ||||
|   { | ||||
|     std::cout<<"****************************************"<<std::endl; | ||||
|     std::cout << "Testing PartialFraction Hw kernel Mom space 4d propagator with q\n"; | ||||
|     std::cout<<"****************************************"<<std::endl; | ||||
|  | ||||
|     //    LatticeFermionD    src(&GRID); gaussian(pRNG,src); | ||||
|     LatticeFermionD    tmp(&GRID); | ||||
|     LatticeFermionD    ref(&GRID); | ||||
|     LatticeFermionD    diff(&GRID); | ||||
|  | ||||
|     const int Ls=48+1; | ||||
|     GridCartesian         * FGrid   = SpaceTimeGrid::makeFiveDimGrid(Ls,&GRID); | ||||
|     GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,&GRID); | ||||
|  | ||||
|     RealD mass=0.1; | ||||
|     RealD M5  =0.8; | ||||
|     OverlapWilsonPartialFractionZolotarevFermionD Dov(Umu,*FGrid,*FrbGrid,GRID,RBGRID,mass,M5,0.001,8.0); | ||||
|  | ||||
|     // Momentum space prop | ||||
|     std::cout << " Solving by FFT and Feynman rules" <<std::endl; | ||||
|     bool fiveD = false; //calculate 4d free propagator | ||||
|  | ||||
|     std::cout << " Free propagator " <<std::endl; | ||||
|     Dov.FreePropagator(src,ref,mass) ; | ||||
|     std::cout << " Free propagator norm "<< norm2(ref) <<std::endl; | ||||
|  | ||||
|     Gamma G5(Gamma::Algebra::Gamma5); | ||||
|  | ||||
|     LatticeFermionD    src5(FGrid); src5=Zero(); | ||||
|     LatticeFermionD    tmp5(FGrid);  | ||||
|     LatticeFermionD    result5(FGrid); result5=Zero(); | ||||
|     LatticeFermionD    result4(&GRID);  | ||||
|     const int sdir=0; | ||||
|  | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     // Import | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     std::cout << " Free propagator Import "<< norm2(src) <<std::endl; | ||||
|     Dov.ImportPhysicalFermionSource  (src,src5); | ||||
|     std::cout << " Free propagator Imported "<< norm2(src5) <<std::endl; | ||||
|      | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     // Conjugate gradient on normal equations system | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     std::cout << " Solving by Conjugate Gradient (CGNE)" <<std::endl; | ||||
|     Dov.Mdag(src5,tmp5); | ||||
|     src5=tmp5; | ||||
|     MdagMLinearOperator<OverlapWilsonPartialFractionZolotarevFermionD,LatticeFermionD> HermOp(Dov); | ||||
|     ConjugateGradient<LatticeFermionD> CG(1.0e-8,10000); | ||||
|     CG(HermOp,src5,result5); | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     // Domain wall physical field propagator | ||||
|     //////////////////////////////////////////////////////////////////////// | ||||
|     Dov.ExportPhysicalFermionSolution(result5,result4); | ||||
|  | ||||
|     // From DWF4d.pdf : | ||||
|     // | ||||
|     // Dov_pf = 2/(1-m) D_cayley_ovlap  [ Page 43 ] | ||||
|     // Dinv_cayley_ovlap = 2/(1-m) Dinv_pf  | ||||
|     // Dinv_cayley_surface =1/(1-m) ( Dinv_cayley_ovlap - 1 ) =>  2/(1-m)^2 Dinv_pf - 1/(1-m) * src   [ Eq.2.67 ] | ||||
|  | ||||
|     RealD scale = 2.0/(1.0-mass)/(1.0-mass); | ||||
|     result4 = result4 * scale; | ||||
|     result4 = result4 - src*(1.0/(1.0-mass)); // Subtract contact term | ||||
|     DumpSliceNorm("Src",src); | ||||
|     DumpSliceNorm("Grid",result4); | ||||
|     DumpSliceNorm("Fourier",ref); | ||||
|  | ||||
|     std::cout << "Dov result4 "<<norm2(result4)<<std::endl; | ||||
|     std::cout << "Dov ref     "<<norm2(ref)<<std::endl; | ||||
|  | ||||
|     diff = result4- ref; | ||||
|     DumpSliceNorm("diff ",diff); | ||||
|      | ||||
|   } | ||||
|  | ||||
|    | ||||
|   Grid_finalize(); | ||||
| } | ||||
| @@ -32,12 +32,9 @@ Author: Peter Boyle <pboyle@bnl.gov> | ||||
| using namespace std; | ||||
| using namespace Grid; | ||||
|  | ||||
| typedef MobiusFermionD FermionAction; | ||||
| typedef WilsonImplD FimplD; | ||||
| typedef WilsonImplD FermionImplPolicy; | ||||
|  | ||||
| template<class Gimpl> | ||||
| void ForceTest(Action<LatticeGaugeField> &action,ConfigurationBase<LatticeGaugeField> & smU,MomentumFilterBase<LatticeGaugeField> &Filter) | ||||
| void ForceTest(Action<LatticeGaugeField> &action,SmearedConfigurationMasked<PeriodicGimplR> & smU,MomentumFilterBase<LatticeGaugeField> &Filter) | ||||
| { | ||||
|   LatticeGaugeField U = smU.get_U(false); // unsmeared config | ||||
|   GridBase *UGrid = U.Grid(); | ||||
| @@ -54,14 +51,14 @@ void ForceTest(Action<LatticeGaugeField> &action,ConfigurationBase<LatticeGaugeF | ||||
|   std::cout << GridLogMessage << " Force test for "<<action.action_name()<<std::endl; | ||||
|   std::cout << GridLogMessage << "*********************************************************"<<std::endl; | ||||
|    | ||||
|   RealD eps=0.01; | ||||
|   RealD eps=0.005; | ||||
|  | ||||
|   std::cout << GridLogMessage << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<std::endl; | ||||
|   std::cout << GridLogMessage << " Refresh "<<action.action_name()<<std::endl; | ||||
|   std::cout << GridLogMessage << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<std::endl; | ||||
|    | ||||
|   Gimpl::generate_momenta(P,sRNG,RNG4); | ||||
|   //  Filter.applyFilter(P); | ||||
|   Filter.applyFilter(P); | ||||
|  | ||||
|   action.refresh(smU,sRNG,RNG4); | ||||
|  | ||||
| @@ -79,7 +76,7 @@ void ForceTest(Action<LatticeGaugeField> &action,ConfigurationBase<LatticeGaugeF | ||||
|   std::cout << GridLogMessage << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<std::endl; | ||||
|   action.deriv(smU,UdSdU); | ||||
|   UdSdU = Ta(UdSdU); | ||||
|   //  Filter.applyFilter(UdSdU); | ||||
|   Filter.applyFilter(UdSdU); | ||||
|  | ||||
|   DumpSliceNorm("Force",UdSdU,Nd-1); | ||||
|    | ||||
| @@ -97,7 +94,7 @@ void ForceTest(Action<LatticeGaugeField> &action,ConfigurationBase<LatticeGaugeF | ||||
|   for(int mu=0;mu<Nd;mu++){ | ||||
|     auto UdSdUmu = PeekIndex<LorentzIndex>(UdSdU,mu); | ||||
|     Pmu= PeekIndex<LorentzIndex>(P,mu); | ||||
|     dS = dS - trace(Pmu*UdSdUmu)*eps*2.0*HMC_MOMENTUM_DENOMINATOR; | ||||
|     dS = dS - trace(Pmu*UdSdUmu)*eps*2.0*2.0; | ||||
|   } | ||||
|   ComplexD dSpred    = sum(dS); | ||||
|   RealD diff =  S2-S1-dSpred.real(); | ||||
| @@ -128,11 +125,8 @@ int main (int argc, char ** argv) | ||||
|   const int Ls=12; | ||||
|   const int Nt = latt_size[3]; | ||||
|   GridCartesian         * UGrid   = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); | ||||
|   GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); | ||||
|   GridCartesian         * FGrid   = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid); | ||||
|   GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid); | ||||
|  | ||||
|    | ||||
|   ///////////////////// Gauge Field and Gauge Forces //////////////////////////// | ||||
|   LatticeGaugeField U(UGrid); | ||||
|  | ||||
| @@ -147,40 +141,17 @@ int main (int argc, char ** argv) | ||||
| #endif | ||||
|  | ||||
|    | ||||
|   WilsonGaugeActionR  PlaqAction(6.0); | ||||
|   IwasakiGaugeActionR RectAction(2.13); | ||||
|   PlaqAction.is_smeared = true;   | ||||
|   RectAction.is_smeared = true;   | ||||
|   RealD beta=6.0; | ||||
|   WilsonGaugeActionR  PlaqAction(beta); | ||||
|   IwasakiGaugeActionR RectAction(beta); | ||||
|  | ||||
|   //////////////////////////////////// | ||||
|   // Fermion Action | ||||
|   //////////////////////////////////// | ||||
|   RealD mass=0.01;  | ||||
|   RealD pvmass=1.0;  | ||||
|   RealD M5=1.8;  | ||||
|   RealD b=1.5; | ||||
|   RealD c=0.5; | ||||
|    | ||||
|   // Double versions | ||||
|   std::vector<Complex> boundary = {1,1,1,-1}; | ||||
|   FermionAction::ImplParams Params(boundary); | ||||
|   FermionAction DdwfPeriodic(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,b,c,Params); | ||||
|   FermionAction PVPeriodic  (U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,pvmass,M5,b,c,Params); | ||||
|  | ||||
|   double StoppingCondition = 1.0e-8; | ||||
|   double MaxCGIterations = 50000; | ||||
|   ConjugateGradient<LatticeFermion>  CG(StoppingCondition,MaxCGIterations); | ||||
|  | ||||
|   TwoFlavourRatioPseudoFermionAction<FimplD> Nf2(PVPeriodic, DdwfPeriodic,CG,CG); | ||||
|   Nf2.is_smeared = true;   | ||||
|    | ||||
|   //////////////////////////////////////////////// | ||||
|   // Plaquette only FTHMC smearer | ||||
|   //////////////////////////////////////////////// | ||||
|   double rho = 0.1; | ||||
|   Smear_Stout<PeriodicGimplR> Smearer(rho); | ||||
|   SmearedConfigurationMasked<PeriodicGimplR> SmartConfig(UGrid,2*Nd,Smearer); | ||||
|   SmearedConfiguration<PeriodicGimplR> StoutConfig(UGrid,1,Smearer); | ||||
|   SmearedConfigurationMasked<PeriodicGimplR> SmartConfig(UGrid,2*Nd,Smearer,true); | ||||
|  | ||||
|   JacobianAction<PeriodicGimplR> Jacobian(&SmartConfig); | ||||
|    | ||||
| @@ -188,32 +159,12 @@ int main (int argc, char ** argv) | ||||
|   // Run some tests | ||||
|   //////////////////////////////////////////////// | ||||
|   MomentumFilterNone<LatticeGaugeField> FilterNone; | ||||
|  | ||||
|   std::cout << " *********  FIELD TRANSFORM SMEARING ***** "<<std::endl; | ||||
|  | ||||
|   SmartConfig.set_Field(U); | ||||
|   ForceTest<GimplTypesR>(PlaqAction,SmartConfig,FilterNone); | ||||
|  | ||||
|   SmartConfig.set_Field(U); | ||||
|   ForceTest<GimplTypesR>(RectAction,SmartConfig,FilterNone); | ||||
|  | ||||
|   SmartConfig.set_Field(U); | ||||
|   ForceTest<GimplTypesR>(Jacobian,SmartConfig,FilterNone); | ||||
|  | ||||
|   SmartConfig.set_Field(U); | ||||
|   ForceTest<GimplTypesR>(Nf2,SmartConfig,FilterNone); | ||||
|  | ||||
|   std::cout << " *********    STOUT SMEARING ***** "<<std::endl; | ||||
|  | ||||
|   StoutConfig.set_Field(U); | ||||
|   ForceTest<GimplTypesR>(PlaqAction,StoutConfig,FilterNone); | ||||
|  | ||||
|   StoutConfig.set_Field(U); | ||||
|   ForceTest<GimplTypesR>(RectAction,StoutConfig,FilterNone); | ||||
|    | ||||
|   StoutConfig.set_Field(U); | ||||
|   ForceTest<GimplTypesR>(Nf2,StoutConfig,FilterNone); | ||||
|    | ||||
|  | ||||
|   Grid_finalize(); | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
|     /************************************************************************************* | ||||
|  | ||||
|     Grid physics library, www.github.com/paboyle/Grid  | ||||
|  | ||||
|     Source file: ./tests/qdpxx/Test_qdpxx_munprec.cc | ||||
|  | ||||
|     Copyright (C) 2015 | ||||
| @@ -25,17 +26,13 @@ Author: paboyle <paboyle@ph.ed.ac.uk> | ||||
|     See the full license in the file "LICENSE" in the top level distribution directory | ||||
|     *************************************************************************************/ | ||||
|     /*  END LEGAL */ | ||||
| #include <chroma.h> | ||||
| #include <actions/ferm/invert/syssolver_linop_cg_array.h> | ||||
| #include <actions/ferm/invert/syssolver_linop_aggregate.h> | ||||
|  | ||||
| #include <Grid/Grid.h> | ||||
|  | ||||
| int    Ls=8; | ||||
| double M5=1.6; | ||||
| double mq=0.01; | ||||
| double zolo_lo = 0.01; | ||||
| double zolo_hi = 7.0; | ||||
| double zolo_lo = 0.1; | ||||
| double zolo_hi = 2.0; | ||||
| double mobius_scale=2.0; | ||||
|  | ||||
| enum ChromaAction { | ||||
| @@ -58,6 +55,11 @@ enum ChromaAction { | ||||
| void calc_grid      (ChromaAction action,Grid::LatticeGaugeField & lat, Grid::LatticeFermion &src, Grid::LatticeFermion &res,int dag); | ||||
| void calc_chroma    (ChromaAction action,Grid::LatticeGaugeField & lat, Grid::LatticeFermion &src, Grid::LatticeFermion &res,int dag); | ||||
|  | ||||
| #include <chroma.h> | ||||
| #include <actions/ferm/invert/syssolver_linop_cg_array.h> | ||||
| #include <actions/ferm/invert/syssolver_linop_aggregate.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| namespace Chroma {  | ||||
|  | ||||
| @@ -79,7 +81,7 @@ public: | ||||
|  | ||||
|     std::vector<int> x(4); | ||||
|     QDP::multi1d<int> cx(4); | ||||
|     Grid::Coordinate gd = gr.Grid()->GlobalDimensions(); | ||||
|     std::vector<int> gd= gr.Grid()->GlobalDimensions(); | ||||
|  | ||||
|     for (x[0]=0;x[0]<gd[0];x[0]++){ | ||||
|     for (x[1]=0;x[1]<gd[1];x[1]++){ | ||||
| @@ -122,7 +124,7 @@ public: | ||||
|  | ||||
|     std::vector<int> x(5); | ||||
|     QDP::multi1d<int> cx(4); | ||||
|     Grid::Coordinate gd= gr.Grid()->GlobalDimensions(); | ||||
|     std::vector<int> gd= gr.Grid()->GlobalDimensions(); | ||||
|  | ||||
|     for (x[0]=0;x[0]<gd[0];x[0]++){ | ||||
|     for (x[1]=0;x[1]<gd[1];x[1]++){ | ||||
| @@ -164,7 +166,7 @@ public: | ||||
|  | ||||
|     std::vector<int> x(5); | ||||
|     QDP::multi1d<int> cx(4); | ||||
|     Grid::Coordinate gd= gr.Grid()->GlobalDimensions(); | ||||
|     std::vector<int> gd= gr.Grid()->GlobalDimensions(); | ||||
|  | ||||
|     for (x[0]=0;x[0]<gd[0];x[0]++){ | ||||
|     for (x[1]=0;x[1]<gd[1];x[1]++){ | ||||
| @@ -302,30 +304,7 @@ public: | ||||
|      //     param.approximation_type=COEFF_TYPE_TANH_UNSCALED; | ||||
|      //     param.approximation_type=COEFF_TYPE_TANH; | ||||
|      param.tuning_strategy_xml= | ||||
| "<TuningStrategy><Name>OVEXT_CONSTANT_STRATEGY</Name><TuningConstant>1.0</TuningConstant></TuningStrategy>\n"; | ||||
|      UnprecOvExtFermActArray S_f(cfs,param); | ||||
|      Handle< FermState<T4,U,U> > fs( S_f.createState(u) ); | ||||
|      Handle< LinearOperatorArray<T4> > M(S_f.linOp(fs)); | ||||
|      return M; | ||||
|    } | ||||
|    if ( parms == HwPartFracTanh ) { | ||||
|      if ( Ls%2 == 0 ) {  | ||||
|        printf("Ls is not odd\n"); | ||||
|        exit(-1); | ||||
|      } | ||||
|      UnprecOvExtFermActArrayParams param; | ||||
|      param.OverMass=M5;  | ||||
|      param.Mass=_mq; | ||||
|      param.RatPolyDeg = Ls; | ||||
|      param.ApproxMin =eps_lo; | ||||
|      param.ApproxMax =eps_hi; | ||||
|      param.b5 =1.0; | ||||
|      param.c5 =1.0; | ||||
|      //     param.approximation_type=COEFF_TYPE_ZOLOTAREV; | ||||
|      param.approximation_type=COEFF_TYPE_TANH_UNSCALED; | ||||
|      //param.approximation_type=COEFF_TYPE_TANH; | ||||
|      param.tuning_strategy_xml= | ||||
|        "<TuningStrategy><Name>OVEXT_CONSTANT_STRATEGY</Name><TuningConstant>1.0</TuningConstant></TuningStrategy>\n"; | ||||
| "<TuningStrategy><Name>OVEXT_CONSTANT_STRATEGY</Name></TuningStrategy>\n"; | ||||
|      UnprecOvExtFermActArray S_f(cfs,param); | ||||
|      Handle< FermState<T4,U,U> > fs( S_f.createState(u) ); | ||||
|      Handle< LinearOperatorArray<T4> > M(S_f.linOp(fs)); | ||||
| @@ -337,35 +316,7 @@ public: | ||||
|      param.ApproxMin=eps_lo; | ||||
|      param.ApproxMax=eps_hi; | ||||
|      param.approximation_type=COEFF_TYPE_ZOLOTAREV; | ||||
|      param.RatPolyDeg=Ls-1; | ||||
|      // The following is why I think Chroma made some directional errors: | ||||
|      param.AuxFermAct= std::string( | ||||
| "<AuxFermAct>\n" | ||||
| "  <FermAct>UNPRECONDITIONED_WILSON</FermAct>\n" | ||||
| "  <Mass>-1.8</Mass>\n" | ||||
| "  <b5>1</b5>\n" | ||||
| "  <c5>0</c5>\n" | ||||
| "  <MaxCG>1000</MaxCG>\n" | ||||
| "  <RsdCG>1.0e-9</RsdCG>\n" | ||||
| "  <FermionBC>\n" | ||||
| "      <FermBC>SIMPLE_FERMBC</FermBC>\n" | ||||
| "      <boundary>1 1 1 1</boundary>\n" | ||||
| "   </FermionBC> \n" | ||||
| "</AuxFermAct>" | ||||
| ); | ||||
|      param.AuxFermActGrp= std::string(""); | ||||
|      UnprecOvlapContFrac5DFermActArray S_f(fbc,param); | ||||
|      Handle< FermState<T4,U,U> > fs( S_f.createState(u) ); | ||||
|      Handle< LinearOperatorArray<T4> > M(S_f.linOp(fs)); | ||||
|      return  M; | ||||
|    } | ||||
|    if ( parms == HwContFracTanh ) { | ||||
|      UnprecOvlapContFrac5DFermActParams param; | ||||
|      param.Mass=_mq; // How is M5 set? Wilson mass In AuxFermAct | ||||
|      param.ApproxMin=eps_lo; | ||||
|      param.ApproxMax=eps_hi; | ||||
|      param.approximation_type=COEFF_TYPE_TANH_UNSCALED; | ||||
|      param.RatPolyDeg=Ls-1; | ||||
|      param.RatPolyDeg=Ls; | ||||
|      // The following is why I think Chroma made some directional errors: | ||||
|      param.AuxFermAct= std::string( | ||||
| "<AuxFermAct>\n" | ||||
| @@ -427,14 +378,7 @@ int main (int argc,char **argv ) | ||||
|    * Setup QDP | ||||
|    *********************************************************/ | ||||
|   Chroma::initialize(&argc,&argv); | ||||
|   //  Chroma::WilsonTypeFermActs4DEnv::registerAll();  | ||||
|   Chroma::WilsonTypeFermActsEnv::registerAll();  | ||||
|   //bool linkageHack(void) | ||||
|   //{ | ||||
|   //  bool foo = true; | ||||
|   // Inline Measurements | ||||
|   //  InlineAggregateEnv::registerAll(); | ||||
|   //  GaugeInitEnv::registerAll(); | ||||
|   Chroma::WilsonTypeFermActs4DEnv::registerAll();  | ||||
|  | ||||
|   /******************************************************** | ||||
|    * Setup Grid | ||||
| @@ -444,34 +388,26 @@ int main (int argc,char **argv ) | ||||
|                                                                        Grid::GridDefaultSimd(Grid::Nd,Grid::vComplex::Nsimd()), | ||||
|                                                                        Grid::GridDefaultMpi()); | ||||
|    | ||||
|   Grid::Coordinate gd = UGrid->GlobalDimensions(); | ||||
|   std::vector<int> gd = UGrid->GlobalDimensions(); | ||||
|   QDP::multi1d<int> nrow(QDP::Nd); | ||||
|   for(int mu=0;mu<4;mu++) nrow[mu] = gd[mu]; | ||||
|  | ||||
|   QDP::Layout::setLattSize(nrow); | ||||
|   QDP::Layout::create(); | ||||
|  | ||||
|   Grid::GridCartesian         * FGrid   = Grid::SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid); | ||||
|   Grid::LatticeGaugeField lat(UGrid); | ||||
|   Grid::LatticeFermion    src(FGrid); | ||||
|   Grid::LatticeFermion    res_chroma(FGrid); | ||||
|   Grid::LatticeFermion    res_grid  (FGrid); | ||||
|    | ||||
|   std::vector<ChromaAction> ActionList({ | ||||
| 		 HtCayleyTanh, // Plain old DWF. | ||||
| 		 HmCayleyTanh, | ||||
| 		 HwCayleyTanh, | ||||
| 		 HtCayleyZolo, // Plain old DWF. | ||||
| 		 HmCayleyZolo, | ||||
| 		 HwCayleyZolo, | ||||
| 		 HwPartFracZolo, | ||||
| 		 HwContFracZolo, | ||||
| 		 HwContFracTanh | ||||
|   }); | ||||
|   std::vector<int> LsList({ | ||||
|       8,//HtCayleyTanh, // Plain old DWF. | ||||
|       8,//HmCayleyTanh, | ||||
|       8,//HwCayleyTanh, | ||||
|       8,//HtCayleyZolo, // Plain old DWF. | ||||
|       8,//HmCayleyZolo, | ||||
|       8,//HwCayleyZolo, | ||||
|       9,//HwPartFracZolo | ||||
|       9, //HwContFracZolo | ||||
|       9 //HwContFracTanh | ||||
| 		 HwCayleyZolo | ||||
|   }); | ||||
|   std::vector<std::string> ActionName({ | ||||
|         "HtCayleyTanh", | ||||
| @@ -479,19 +415,10 @@ int main (int argc,char **argv ) | ||||
| 	"HwCayleyTanh", | ||||
| 	"HtCayleyZolo", | ||||
| 	"HmCayleyZolo", | ||||
|         "HwCayleyZolo", | ||||
| 	"HwPartFracZolo", | ||||
| 	"HwContFracZolo", | ||||
| 	"HwContFracTanh" | ||||
|         "HwCayleyZolo" | ||||
|   }); | ||||
|  | ||||
|   for(int i=0;i<ActionList.size();i++) { | ||||
|     Ls = LsList[i]; | ||||
|     Grid::GridCartesian      * FGrid   = Grid::SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid); | ||||
|     Grid::LatticeGaugeField lat(UGrid); | ||||
|     Grid::LatticeFermion    src(FGrid); | ||||
|     Grid::LatticeFermion    res_chroma(FGrid); | ||||
|     Grid::LatticeFermion    res_grid  (FGrid); | ||||
|     std::cout << "*****************************"<<std::endl; | ||||
|     std::cout << "Action "<<ActionName[i]<<std::endl; | ||||
|     std::cout << "*****************************"<<std::endl; | ||||
| @@ -512,7 +439,6 @@ int main (int argc,char **argv ) | ||||
|        | ||||
|       std::cout << "Norm of difference "<<Grid::norm2(res_chroma)<<std::endl; | ||||
|     } | ||||
|     delete FGrid; | ||||
|   } | ||||
|  | ||||
|   std::cout << "Finished test "<<std::endl; | ||||
| @@ -576,7 +502,7 @@ void calc_grid(ChromaAction action,Grid::LatticeGaugeField & Umu, Grid::LatticeF | ||||
|   Grid::gaussian(RNG5,src); | ||||
|   Grid::gaussian(RNG5,res); | ||||
|  | ||||
|   Grid::SU<Grid::Nc>::HotConfiguration(RNG4,Umu); | ||||
|   Grid::SU<Nc>::HotConfiguration(RNG4,Umu); | ||||
|  | ||||
|   /* | ||||
|   Grid::LatticeColourMatrix U(UGrid); | ||||
| @@ -593,7 +519,7 @@ void calc_grid(ChromaAction action,Grid::LatticeGaugeField & Umu, Grid::LatticeF | ||||
|  | ||||
|   if ( action == HtCayleyTanh ) {  | ||||
|  | ||||
|     Grid::DomainWallFermionD Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5); | ||||
|     Grid::DomainWallFermionR Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5); | ||||
|  | ||||
|     std::cout << Grid::GridLogMessage <<" Calling domain wall multiply "<<std::endl; | ||||
|  | ||||
| @@ -609,7 +535,7 @@ void calc_grid(ChromaAction action,Grid::LatticeGaugeField & Umu, Grid::LatticeF | ||||
|  | ||||
|     Grid::Real _b = 0.5*(mobius_scale +1.0); | ||||
|     Grid::Real _c = 0.5*(mobius_scale -1.0); | ||||
|     Grid::MobiusZolotarevFermionD D(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,_b,_c,zolo_lo,zolo_hi); | ||||
|     Grid::MobiusZolotarevFermionR D(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,_b,_c,zolo_lo,zolo_hi); | ||||
|  | ||||
|     std::cout << Grid::GridLogMessage <<" Calling mobius zolo multiply "<<std::endl; | ||||
|  | ||||
| @@ -623,7 +549,7 @@ void calc_grid(ChromaAction action,Grid::LatticeGaugeField & Umu, Grid::LatticeF | ||||
|  | ||||
|   if ( action == HtCayleyZolo ) { | ||||
|  | ||||
|     Grid::ShamirZolotarevFermionD D(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,zolo_lo,zolo_hi); | ||||
|     Grid::ShamirZolotarevFermionR D(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,zolo_lo,zolo_hi); | ||||
|  | ||||
|     std::cout << Grid::GridLogMessage <<" Calling shamir zolo multiply "<<std::endl; | ||||
|  | ||||
| @@ -635,60 +561,6 @@ void calc_grid(ChromaAction action,Grid::LatticeGaugeField & Umu, Grid::LatticeF | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   if ( action == HwPartFracTanh ) { | ||||
|  | ||||
|     Grid::OverlapWilsonPartialFractionTanhFermionD Dov(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,1.0); | ||||
|  | ||||
|     std::cout << Grid::GridLogMessage <<" Calling part frac tanh multiply "<<std::endl; | ||||
|  | ||||
|     if ( dag )  | ||||
|       Dov.Mdag(src,res);   | ||||
|     else  | ||||
|       Dov.M(src,res);   | ||||
|  | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   if ( action == HwContFracTanh ) { | ||||
|  | ||||
|     Grid::OverlapWilsonContFracTanhFermionD Dov(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,1.0); | ||||
|  | ||||
|     std::cout << Grid::GridLogMessage <<" Calling cont frac tanh multiply "<<std::endl; | ||||
|  | ||||
|     if ( dag )  | ||||
|       Dov.Mdag(src,res);   | ||||
|     else  | ||||
|       Dov.M(src,res);   | ||||
|  | ||||
|     return; | ||||
|   } | ||||
|   if ( action == HwContFracZolo ) { | ||||
|  | ||||
|     Grid::OverlapWilsonContFracZolotarevFermionD Dov(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,zolo_lo,zolo_hi); | ||||
|  | ||||
|     std::cout << Grid::GridLogMessage <<" Calling cont frac zolo multiply "<<std::endl; | ||||
|  | ||||
|     if ( dag )  | ||||
|       Dov.Mdag(src,res);   | ||||
|     else  | ||||
|       Dov.M(src,res);   | ||||
|  | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   if ( action == HwPartFracZolo ) { | ||||
|  | ||||
|     Grid::OverlapWilsonPartialFractionZolotarevFermionD Dov(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,zolo_lo,zolo_hi); | ||||
|     std::cout << Grid::GridLogMessage <<" Calling part frac zolotarev multiply "<<std::endl; | ||||
|  | ||||
|     if ( dag )  | ||||
|       Dov.Mdag(src,res);   | ||||
|     else  | ||||
|       Dov.M(src,res);   | ||||
|  | ||||
|     return; | ||||
|   } | ||||
|    | ||||
|   /* | ||||
|   if ( action == HmCayleyTanh ) { | ||||
|     Grid::Real _b = 0.5*(mobius_scale +1.0); | ||||
| @@ -709,7 +581,7 @@ void calc_grid(ChromaAction action,Grid::LatticeGaugeField & Umu, Grid::LatticeF | ||||
|  | ||||
|   if ( action == HmCayleyTanh ) { | ||||
|  | ||||
|     Grid::ScaledShamirFermionD D(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,mobius_scale); | ||||
|     Grid::ScaledShamirFermionR D(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,mobius_scale); | ||||
|  | ||||
|     std::cout << Grid::GridLogMessage <<" Calling scaled shamir multiply "<<std::endl; | ||||
|  | ||||
| @@ -723,7 +595,7 @@ void calc_grid(ChromaAction action,Grid::LatticeGaugeField & Umu, Grid::LatticeF | ||||
|  | ||||
|   if ( action == HwCayleyTanh ) { | ||||
|  | ||||
|     Grid::OverlapWilsonCayleyTanhFermionD D(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,1.0); | ||||
|     Grid::OverlapWilsonCayleyTanhFermionR D(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,1.0); | ||||
|  | ||||
|     if ( dag )  | ||||
|       D.Mdag(src,res);   | ||||
| @@ -735,7 +607,7 @@ void calc_grid(ChromaAction action,Grid::LatticeGaugeField & Umu, Grid::LatticeF | ||||
|  | ||||
|   if ( action == HwCayleyZolo ) { | ||||
|  | ||||
|     Grid::OverlapWilsonCayleyZolotarevFermionD D(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,zolo_lo,zolo_hi); | ||||
|     Grid::OverlapWilsonCayleyZolotarevFermionR D(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,_mass,_M5,zolo_lo,zolo_hi); | ||||
|  | ||||
|     if ( dag )  | ||||
|       D.Mdag(src,res);   | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| ************************************************************************************* | ||||
| /************************************************************************************* | ||||
|  | ||||
| Grid physics library, www.github.com/paboyle/Grid | ||||
|  | ||||
| @@ -67,13 +67,7 @@ int main(int argc, char** argv) { | ||||
|   result = Zero(); | ||||
|   LatticeGaugeField Umu(UGrid); | ||||
|  | ||||
| #if 0 | ||||
|   FieldMetaData header; | ||||
|   std::string file("ckpoint_lat.4000"); | ||||
|   NerscIO::readConfiguration(Umu,header,file); | ||||
| #else   | ||||
|   SU<Nc>::HotConfiguration(RNG4, Umu); | ||||
| #endif | ||||
|  | ||||
|   std::cout << GridLogMessage << "Lattice dimensions: " << GridDefaultLatt() | ||||
|             << "   Ls: " << Ls << std::endl; | ||||
|   | ||||
| @@ -54,30 +54,15 @@ int main (int argc, char ** argv) | ||||
|   GridCartesian         * FGrid   = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid); | ||||
|   GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid); | ||||
|  | ||||
|   std::vector<ComplexD> qmu; | ||||
|   qmu.push_back(ComplexD(0.1,0.0)); | ||||
|   qmu.push_back(ComplexD(0.0,0.0)); | ||||
|   qmu.push_back(ComplexD(0.0,0.0)); | ||||
|   qmu.push_back(ComplexD(0.0,0.01)); | ||||
|    | ||||
|  | ||||
|   std::vector<int> seeds4({1,2,3,4}); | ||||
|   std::vector<int> seeds5({5,6,7,8}); | ||||
|   GridParallelRNG          RNG5(FGrid);  RNG5.SeedFixedIntegers(seeds5); | ||||
|   GridParallelRNG          RNG4(UGrid);  RNG4.SeedFixedIntegers(seeds4); | ||||
|  | ||||
|   LatticeFermion    tmp(FGrid); | ||||
|   LatticeFermion    src(FGrid); random(RNG5,src); | ||||
|   LatticeFermion result(FGrid); result=Zero(); | ||||
|   LatticeGaugeField Umu(UGrid);  | ||||
| #if 0 | ||||
|   FieldMetaData header; | ||||
|   std::string file("ckpoint_lat.4000"); | ||||
|   NerscIO::readConfiguration(Umu,header,file); | ||||
| #else   | ||||
|   SU<Nc>::HotConfiguration(RNG4,Umu); | ||||
| #endif | ||||
|    | ||||
|   LatticeGaugeField Umu(UGrid); SU<Nc>::HotConfiguration(RNG4,Umu); | ||||
|  | ||||
|   std::vector<LatticeColourMatrix> U(4,UGrid); | ||||
|   for(int mu=0;mu<Nd;mu++){ | ||||
|     U[mu] = PeekIndex<LorentzIndex>(Umu,mu); | ||||
| @@ -86,15 +71,8 @@ int main (int argc, char ** argv) | ||||
|   RealD mass=0.1; | ||||
|   RealD M5=1.8; | ||||
|   DomainWallFermionD Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5); | ||||
|   Ddwf.qmu = qmu; | ||||
|  | ||||
|   Ddwf.M(src,tmp); | ||||
|   std::cout << " |M src|^2 "<<norm2(tmp)<<std::endl; | ||||
|   MdagMLinearOperator<DomainWallFermionD,LatticeFermion> HermOp(Ddwf); | ||||
|   HermOp.HermOp(src,tmp); | ||||
|  | ||||
|   std::cout << " <src|MdagM| src> "<<innerProduct(src,tmp)<<std::endl; | ||||
|    | ||||
|   ConjugateGradient<LatticeFermion> CG(1.0e-6,10000); | ||||
|   CG(HermOp,src,result); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user