2017-05-01 13:44:00 +01:00
|
|
|
/*************************************************************************************
|
2020-05-15 08:15:50 +01:00
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
2016-01-02 14:51:32 +00:00
|
|
|
Source file: ./benchmarks/Benchmark_dwf.cc
|
|
|
|
Copyright (C) 2015
|
|
|
|
|
2017-05-01 13:44:00 +01:00
|
|
|
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|
|
|
Author: paboyle <paboyle@ph.ed.ac.uk>
|
2016-01-02 14:51:32 +00:00
|
|
|
|
|
|
|
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 */
|
2016-07-07 22:31:07 +01:00
|
|
|
#include <Grid/Grid.h>
|
2020-05-05 19:13:27 +01:00
|
|
|
#ifdef GRID_CUDA
|
2019-06-08 13:38:05 +01:00
|
|
|
#define CUDA_PROFILE
|
2019-06-08 17:11:38 +01:00
|
|
|
#endif
|
|
|
|
|
2019-06-08 13:38:05 +01:00
|
|
|
#ifdef CUDA_PROFILE
|
|
|
|
#include <cuda_profiler_api.h>
|
|
|
|
#endif
|
2015-05-31 15:09:02 +01:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Grid;
|
|
|
|
|
|
|
|
template<class d>
|
|
|
|
struct scal {
|
|
|
|
d internal;
|
|
|
|
};
|
|
|
|
|
2017-05-01 13:44:00 +01:00
|
|
|
Gamma::Algebra Gmu [] = {
|
|
|
|
Gamma::Algebra::GammaX,
|
|
|
|
Gamma::Algebra::GammaY,
|
|
|
|
Gamma::Algebra::GammaZ,
|
|
|
|
Gamma::Algebra::GammaT
|
|
|
|
};
|
2015-05-31 15:09:02 +01:00
|
|
|
|
2016-06-03 11:24:26 +01:00
|
|
|
|
2015-05-31 15:09:02 +01:00
|
|
|
int main (int argc, char ** argv)
|
|
|
|
{
|
|
|
|
Grid_init(&argc,&argv);
|
2017-05-01 13:44:00 +01:00
|
|
|
|
|
|
|
|
2015-05-31 15:09:02 +01:00
|
|
|
int threads = GridThread::GetThreads();
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2018-02-24 22:20:14 +00:00
|
|
|
Coordinate latt4 = GridDefaultLatt();
|
2018-09-09 14:25:06 +01:00
|
|
|
int Ls=8;
|
2017-08-28 14:53:56 +01:00
|
|
|
for(int i=0;i<argc;i++)
|
|
|
|
if(std::string(argv[i]) == "-Ls"){
|
|
|
|
std::stringstream ss(argv[i+1]); ss >> Ls;
|
|
|
|
}
|
|
|
|
|
2018-01-25 12:46:31 +00:00
|
|
|
GridLogLayout();
|
|
|
|
|
2018-12-13 05:11:34 +00:00
|
|
|
long unsigned int single_site_flops = 8*Nc*(7+16*Nc);
|
2018-01-25 12:46:31 +00:00
|
|
|
|
2017-08-28 14:53:56 +01:00
|
|
|
|
2015-07-01 22:45:15 +01:00
|
|
|
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
|
2015-06-02 16:57:12 +01:00
|
|
|
GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
|
|
|
GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid);
|
|
|
|
GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid);
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2016-06-06 15:05:51 +01:00
|
|
|
std::cout << GridLogMessage << "Making s innermost grids"<<std::endl;
|
2016-06-03 11:24:26 +01:00
|
|
|
GridCartesian * sUGrid = SpaceTimeGrid::makeFourDimDWFGrid(GridDefaultLatt(),GridDefaultMpi());
|
2016-07-14 23:44:02 +01:00
|
|
|
GridRedBlackCartesian * sUrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(sUGrid);
|
2016-06-03 11:24:26 +01:00
|
|
|
GridCartesian * sFGrid = SpaceTimeGrid::makeFiveDimDWFGrid(Ls,UGrid);
|
|
|
|
GridRedBlackCartesian * sFrbGrid = SpaceTimeGrid::makeFiveDimDWFRedBlackGrid(Ls,UGrid);
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2015-05-31 15:09:02 +01:00
|
|
|
std::vector<int> seeds4({1,2,3,4});
|
|
|
|
std::vector<int> seeds5({5,6,7,8});
|
2020-05-15 08:15:50 +01:00
|
|
|
|
2017-02-07 06:32:10 +00:00
|
|
|
std::cout << GridLogMessage << "Initialising 4d RNG" << std::endl;
|
2018-08-10 15:11:01 +01:00
|
|
|
GridParallelRNG RNG4(UGrid); RNG4.SeedUniqueString(std::string("The 4D RNG"));
|
2017-02-07 06:32:10 +00:00
|
|
|
std::cout << GridLogMessage << "Initialising 5d RNG" << std::endl;
|
2018-08-10 15:11:01 +01:00
|
|
|
GridParallelRNG RNG5(FGrid); RNG5.SeedUniqueString(std::string("The 5D RNG"));
|
2017-02-07 06:32:10 +00:00
|
|
|
std::cout << GridLogMessage << "Initialised RNGs" << std::endl;
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2015-06-02 16:57:12 +01:00
|
|
|
LatticeFermion src (FGrid); random(RNG5,src);
|
2017-02-07 06:32:10 +00:00
|
|
|
#if 0
|
2018-01-27 23:51:10 +00:00
|
|
|
src = Zero();
|
2017-02-07 06:32:10 +00:00
|
|
|
{
|
2018-02-24 22:20:14 +00:00
|
|
|
Coordinate origin({0,0,0,latt4[2]-1,0});
|
2017-02-07 06:32:10 +00:00
|
|
|
SpinColourVectorF tmp;
|
2018-01-27 23:51:10 +00:00
|
|
|
tmp=Zero();
|
2017-02-07 06:32:10 +00:00
|
|
|
tmp()(0)(0)=Complex(-2.0,0.0);
|
|
|
|
std::cout << " source site 0 " << tmp<<std::endl;
|
|
|
|
pokeSite(tmp,src,origin);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
RealD N2 = 1.0/::sqrt(norm2(src));
|
|
|
|
src = src*N2;
|
|
|
|
#endif
|
2017-05-01 13:44:00 +01:00
|
|
|
|
|
|
|
|
2018-01-27 23:51:10 +00:00
|
|
|
LatticeFermion result(FGrid); result=Zero();
|
|
|
|
LatticeFermion ref(FGrid); ref=Zero();
|
2015-06-02 16:57:12 +01:00
|
|
|
LatticeFermion tmp(FGrid);
|
|
|
|
LatticeFermion err(FGrid);
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2017-02-07 06:32:10 +00:00
|
|
|
std::cout << GridLogMessage << "Drawing gauge field" << std::endl;
|
2020-05-15 08:15:50 +01:00
|
|
|
LatticeGaugeField Umu(UGrid);
|
2020-10-07 18:07:00 +01:00
|
|
|
SU<Nc>::HotConfiguration(RNG4,Umu);
|
2017-02-07 06:32:10 +00:00
|
|
|
std::cout << GridLogMessage << "Random gauge initialised " << std::endl;
|
|
|
|
#if 0
|
|
|
|
Umu=1.0;
|
|
|
|
for(int mu=0;mu<Nd;mu++){
|
|
|
|
LatticeColourMatrix ttmp(UGrid);
|
|
|
|
ttmp = PeekIndex<LorentzIndex>(Umu,mu);
|
|
|
|
// if (mu !=2 ) ttmp = 0;
|
|
|
|
// ttmp = ttmp* pow(10.0,mu);
|
|
|
|
PokeIndex<LorentzIndex>(Umu,ttmp,mu);
|
|
|
|
}
|
|
|
|
std::cout << GridLogMessage << "Forced to diagonal " << std::endl;
|
|
|
|
#endif
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2017-02-07 06:32:10 +00:00
|
|
|
////////////////////////////////////
|
|
|
|
// Naive wilson implementation
|
|
|
|
////////////////////////////////////
|
2015-05-31 15:09:02 +01:00
|
|
|
// replicate across fifth dimension
|
2020-05-15 08:15:50 +01:00
|
|
|
LatticeGaugeField Umu5d(FGrid);
|
2017-02-07 06:32:10 +00:00
|
|
|
std::vector<LatticeColourMatrix> U(4,FGrid);
|
2018-03-04 16:39:29 +00:00
|
|
|
{
|
2020-06-05 23:52:35 +01:00
|
|
|
autoView( Umu5d_v, Umu5d, CpuWrite);
|
|
|
|
autoView( Umu_v , Umu , CpuRead);
|
2018-03-04 16:39:29 +00:00
|
|
|
for(int ss=0;ss<Umu.Grid()->oSites();ss++){
|
|
|
|
for(int s=0;s<Ls;s++){
|
|
|
|
Umu5d_v[Ls*ss+s] = Umu_v[ss];
|
|
|
|
}
|
2015-05-31 15:09:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
for(int mu=0;mu<Nd;mu++){
|
2015-06-30 15:01:44 +01:00
|
|
|
U[mu] = PeekIndex<LorentzIndex>(Umu5d,mu);
|
2015-05-31 15:09:02 +01:00
|
|
|
}
|
2017-02-07 06:32:10 +00:00
|
|
|
std::cout << GridLogMessage << "Setting up Cshift based reference " << std::endl;
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2015-05-31 15:09:02 +01:00
|
|
|
if (1)
|
2017-05-01 13:44:00 +01:00
|
|
|
{
|
2018-01-27 23:51:10 +00:00
|
|
|
ref = Zero();
|
2017-05-01 13:44:00 +01:00
|
|
|
for(int mu=0;mu<Nd;mu++){
|
|
|
|
|
|
|
|
tmp = U[mu]*Cshift(src,mu+1,1);
|
|
|
|
ref=ref + tmp - Gamma(Gmu[mu])*tmp;
|
|
|
|
|
|
|
|
tmp =adj(U[mu])*src;
|
|
|
|
tmp =Cshift(tmp,mu+1,-1);
|
|
|
|
ref=ref + tmp + Gamma(Gmu[mu])*tmp;
|
2015-05-31 15:09:02 +01:00
|
|
|
}
|
2017-05-01 13:44:00 +01:00
|
|
|
ref = -0.5*ref;
|
|
|
|
}
|
|
|
|
|
2015-05-31 15:09:02 +01:00
|
|
|
RealD mass=0.1;
|
2015-06-02 16:57:12 +01:00
|
|
|
RealD M5 =1.8;
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2016-01-11 14:34:22 +00:00
|
|
|
RealD NP = UGrid->_Nprocessors;
|
2017-05-03 20:43:36 +01:00
|
|
|
RealD NN = UGrid->NodeCount();
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2016-11-02 08:07:09 +00:00
|
|
|
std::cout << GridLogMessage<< "*****************************************************************" <<std::endl;
|
|
|
|
std::cout << GridLogMessage<< "* Kernel options --dslash-generic, --dslash-unroll, --dslash-asm" <<std::endl;
|
|
|
|
std::cout << GridLogMessage<< "*****************************************************************" <<std::endl;
|
|
|
|
std::cout << GridLogMessage<< "*****************************************************************" <<std::endl;
|
|
|
|
std::cout << GridLogMessage<< "* Benchmarking DomainWallFermionR::Dhop "<<std::endl;
|
|
|
|
std::cout << GridLogMessage<< "* Vectorising space-time by "<<vComplex::Nsimd()<<std::endl;
|
2018-07-23 11:08:39 +01:00
|
|
|
std::cout << GridLogMessage<< "* VComplex size is "<<sizeof(vComplex)<< " B"<<std::endl;
|
2016-11-02 08:07:09 +00:00
|
|
|
if ( sizeof(Real)==4 ) std::cout << GridLogMessage<< "* SINGLE precision "<<std::endl;
|
|
|
|
if ( sizeof(Real)==8 ) std::cout << GridLogMessage<< "* DOUBLE precision "<<std::endl;
|
2017-05-04 01:26:35 +01:00
|
|
|
#ifdef GRID_OMP
|
|
|
|
if ( WilsonKernelsStatic::Comms == WilsonKernelsStatic::CommsAndCompute ) std::cout << GridLogMessage<< "* Using Overlapped Comms/Compute" <<std::endl;
|
|
|
|
if ( WilsonKernelsStatic::Comms == WilsonKernelsStatic::CommsThenCompute) std::cout << GridLogMessage<< "* Using sequential comms compute" <<std::endl;
|
|
|
|
#endif
|
2016-11-02 08:07:09 +00:00
|
|
|
if ( WilsonKernelsStatic::Opt == WilsonKernelsStatic::OptGeneric ) std::cout << GridLogMessage<< "* Using GENERIC Nc WilsonKernels" <<std::endl;
|
|
|
|
if ( WilsonKernelsStatic::Opt == WilsonKernelsStatic::OptHandUnroll) std::cout << GridLogMessage<< "* Using Nc=3 WilsonKernels" <<std::endl;
|
|
|
|
if ( WilsonKernelsStatic::Opt == WilsonKernelsStatic::OptInlineAsm ) std::cout << GridLogMessage<< "* Using Asm Nc=3 WilsonKernels" <<std::endl;
|
|
|
|
std::cout << GridLogMessage<< "*****************************************************************" <<std::endl;
|
2016-06-03 11:24:26 +01:00
|
|
|
|
2017-04-20 11:20:26 +01:00
|
|
|
DomainWallFermionR Dw(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
|
2018-06-13 20:26:07 +01:00
|
|
|
int ncall =1000;
|
2019-06-08 13:38:05 +01:00
|
|
|
|
2016-06-06 15:05:51 +01:00
|
|
|
if (1) {
|
2016-11-09 12:11:03 +00:00
|
|
|
FGrid->Barrier();
|
2017-02-07 06:32:10 +00:00
|
|
|
Dw.Dhop(src,result,0);
|
2017-04-22 14:05:28 +01:00
|
|
|
std::cout<<GridLogMessage<<"Called warmup"<<std::endl;
|
2015-11-04 09:54:48 +00:00
|
|
|
double t0=usecond();
|
|
|
|
for(int i=0;i<ncall;i++){
|
|
|
|
Dw.Dhop(src,result,0);
|
|
|
|
}
|
|
|
|
double t1=usecond();
|
2016-11-09 12:11:03 +00:00
|
|
|
FGrid->Barrier();
|
2020-05-15 08:15:50 +01:00
|
|
|
|
2015-11-04 09:54:48 +00:00
|
|
|
double volume=Ls; for(int mu=0;mu<Nd;mu++) volume=volume*latt4[mu];
|
2018-01-25 12:46:31 +00:00
|
|
|
double flops=single_site_flops*volume*ncall;
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2020-05-29 21:15:59 +01:00
|
|
|
auto nsimd = vComplex::Nsimd();
|
|
|
|
auto simdwidth = sizeof(vComplex);
|
2020-05-15 08:15:50 +01:00
|
|
|
|
2020-05-30 09:55:17 +01:00
|
|
|
// RF: Nd Wilson * Ls, Nd gauge * Ls, Nc colors
|
|
|
|
double data_rf = volume * ((2*Nd+1)*Nd*Nc + 2*Nd*Nc*Nc) * simdwidth / nsimd * ncall / (1024.*1024.*1024.);
|
2020-05-29 21:15:59 +01:00
|
|
|
|
2020-05-30 09:55:17 +01:00
|
|
|
// mem: Nd Wilson * Ls, Nd gauge, Nc colors
|
|
|
|
double data_mem = (volume * (2*Nd+1)*Nd*Nc + (volume/Ls) *2*Nd*Nc*Nc) * simdwidth / nsimd * ncall / (1024.*1024.*1024.);
|
2020-04-19 00:25:40 +01:00
|
|
|
|
2015-11-06 11:27:13 +00:00
|
|
|
std::cout<<GridLogMessage << "Called Dw "<<ncall<<" times in "<<t1-t0<<" us"<<std::endl;
|
2017-02-07 06:32:10 +00:00
|
|
|
// std::cout<<GridLogMessage << "norm result "<< norm2(result)<<std::endl;
|
|
|
|
// std::cout<<GridLogMessage << "norm ref "<< norm2(ref)<<std::endl;
|
2015-11-04 09:54:48 +00:00
|
|
|
std::cout<<GridLogMessage << "mflop/s = "<< flops/(t1-t0)<<std::endl;
|
2016-10-22 18:14:27 +01:00
|
|
|
std::cout<<GridLogMessage << "mflop/s per rank = "<< flops/(t1-t0)/NP<<std::endl;
|
2017-05-03 20:43:36 +01:00
|
|
|
std::cout<<GridLogMessage << "mflop/s per node = "<< flops/(t1-t0)/NN<<std::endl;
|
2020-05-30 09:55:17 +01:00
|
|
|
std::cout<<GridLogMessage << "RF GiB/s (base 2) = "<< 1000000. * data_rf/((t1-t0))<<std::endl;
|
|
|
|
std::cout<<GridLogMessage << "mem GiB/s (base 2) = "<< 1000000. * data_mem/((t1-t0))<<std::endl;
|
2020-05-15 08:15:50 +01:00
|
|
|
err = ref-result;
|
2015-11-04 09:54:48 +00:00
|
|
|
std::cout<<GridLogMessage << "norm diff "<< norm2(err)<<std::endl;
|
2018-07-05 11:59:38 +01:00
|
|
|
//exit(0);
|
|
|
|
|
2020-05-15 08:15:50 +01:00
|
|
|
if(( norm2(err)>1.0e-4) ) {
|
|
|
|
/*
|
2017-02-07 06:32:10 +00:00
|
|
|
std::cout << "RESULT\n " << result<<std::endl;
|
|
|
|
std::cout << "REF \n " << ref <<std::endl;
|
|
|
|
std::cout << "ERR \n " << err <<std::endl;
|
2020-05-15 08:15:50 +01:00
|
|
|
*/
|
|
|
|
std::cout<<GridLogMessage << "WRONG RESULT" << std::endl;
|
2017-02-07 06:32:10 +00:00
|
|
|
FGrid->Barrier();
|
|
|
|
exit(-1);
|
2017-05-01 13:44:00 +01:00
|
|
|
}
|
2016-11-09 12:11:03 +00:00
|
|
|
assert (norm2(err)< 1.0e-4 );
|
2015-05-31 15:09:02 +01:00
|
|
|
}
|
|
|
|
|
2017-05-01 13:44:00 +01:00
|
|
|
if (1)
|
|
|
|
{ // Naive wilson dag implementation
|
2018-01-27 23:51:10 +00:00
|
|
|
ref = Zero();
|
2015-05-31 15:09:02 +01:00
|
|
|
for(int mu=0;mu<Nd;mu++){
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2017-01-24 03:13:43 +00:00
|
|
|
// ref = src - Gamma(Gamma::Algebra::GammaX)* src ; // 1+gamma_x
|
2015-05-31 15:09:02 +01:00
|
|
|
tmp = U[mu]*Cshift(src,mu+1,1);
|
2018-03-04 16:39:29 +00:00
|
|
|
{
|
2020-06-05 23:52:35 +01:00
|
|
|
autoView( ref_v, ref, CpuWrite);
|
|
|
|
autoView( tmp_v, tmp, CpuRead);
|
2018-03-04 16:39:29 +00:00
|
|
|
for(int i=0;i<ref_v.size();i++){
|
|
|
|
ref_v[i]+= tmp_v[i] + Gamma(Gmu[mu])*tmp_v[i]; ;
|
|
|
|
}
|
2015-05-31 15:09:02 +01:00
|
|
|
}
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2015-05-31 15:09:02 +01:00
|
|
|
tmp =adj(U[mu])*src;
|
|
|
|
tmp =Cshift(tmp,mu+1,-1);
|
2018-03-04 16:39:29 +00:00
|
|
|
{
|
2020-06-05 23:52:35 +01:00
|
|
|
autoView( ref_v, ref, CpuWrite);
|
|
|
|
autoView( tmp_v, tmp, CpuRead);
|
2018-03-04 16:39:29 +00:00
|
|
|
for(int i=0;i<ref_v.size();i++){
|
|
|
|
ref_v[i]+= tmp_v[i] - Gamma(Gmu[mu])*tmp_v[i]; ;
|
|
|
|
}
|
2015-05-31 15:09:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ref = -0.5*ref;
|
|
|
|
}
|
2017-05-01 13:44:00 +01:00
|
|
|
// dump=1;
|
2015-05-31 15:09:02 +01:00
|
|
|
Dw.Dhop(src,result,1);
|
2017-05-01 13:44:00 +01:00
|
|
|
std::cout << GridLogMessage << "Compare to naive wilson implementation Dag to verify correctness" << std::endl;
|
2015-07-23 17:31:13 +01:00
|
|
|
std::cout<<GridLogMessage << "Called DwDag"<<std::endl;
|
2017-02-07 06:32:10 +00:00
|
|
|
std::cout<<GridLogMessage << "norm dag result "<< norm2(result)<<std::endl;
|
|
|
|
std::cout<<GridLogMessage << "norm dag ref "<< norm2(ref)<<std::endl;
|
2020-05-15 08:15:50 +01:00
|
|
|
err = ref-result;
|
2017-02-07 06:32:10 +00:00
|
|
|
std::cout<<GridLogMessage << "norm dag diff "<< norm2(err)<<std::endl;
|
|
|
|
if((norm2(err)>1.0e-4)){
|
2020-05-15 08:15:50 +01:00
|
|
|
/*
|
2017-05-01 13:44:00 +01:00
|
|
|
std::cout<< "DAG RESULT\n " <<ref << std::endl;
|
|
|
|
std::cout<< "DAG sRESULT\n " <<result << std::endl;
|
|
|
|
std::cout<< "DAG ERR \n " << err <<std::endl;
|
2020-05-15 08:15:50 +01:00
|
|
|
*/
|
2017-02-07 06:32:10 +00:00
|
|
|
}
|
2015-06-02 16:57:12 +01:00
|
|
|
LatticeFermion src_e (FrbGrid);
|
|
|
|
LatticeFermion src_o (FrbGrid);
|
|
|
|
LatticeFermion r_e (FrbGrid);
|
|
|
|
LatticeFermion r_o (FrbGrid);
|
|
|
|
LatticeFermion r_eo (FGrid);
|
2017-05-01 13:44:00 +01:00
|
|
|
|
|
|
|
|
2017-02-07 06:32:10 +00:00
|
|
|
std::cout<<GridLogMessage << "Calling Deo and Doe and //assert Deo+Doe == Dunprec"<<std::endl;
|
2015-06-02 16:57:12 +01:00
|
|
|
pickCheckerboard(Even,src_e,src);
|
|
|
|
pickCheckerboard(Odd,src_o,src);
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2015-07-23 17:31:13 +01:00
|
|
|
std::cout<<GridLogMessage << "src_e"<<norm2(src_e)<<std::endl;
|
|
|
|
std::cout<<GridLogMessage << "src_o"<<norm2(src_o)<<std::endl;
|
2017-05-01 13:44:00 +01:00
|
|
|
|
|
|
|
|
2017-02-07 06:32:10 +00:00
|
|
|
// S-direction is INNERMOST and takes no part in the parity.
|
2016-11-02 08:07:09 +00:00
|
|
|
std::cout << GridLogMessage<< "*********************************************************" <<std::endl;
|
|
|
|
std::cout << GridLogMessage<< "* Benchmarking DomainWallFermionR::DhopEO "<<std::endl;
|
|
|
|
std::cout << GridLogMessage<< "* Vectorising space-time by "<<vComplex::Nsimd()<<std::endl;
|
|
|
|
if ( sizeof(Real)==4 ) std::cout << GridLogMessage<< "* SINGLE precision "<<std::endl;
|
|
|
|
if ( sizeof(Real)==8 ) std::cout << GridLogMessage<< "* DOUBLE precision "<<std::endl;
|
2017-05-04 01:26:35 +01:00
|
|
|
#ifdef GRID_OMP
|
|
|
|
if ( WilsonKernelsStatic::Comms == WilsonKernelsStatic::CommsAndCompute ) std::cout << GridLogMessage<< "* Using Overlapped Comms/Compute" <<std::endl;
|
|
|
|
if ( WilsonKernelsStatic::Comms == WilsonKernelsStatic::CommsThenCompute) std::cout << GridLogMessage<< "* Using sequential comms compute" <<std::endl;
|
|
|
|
#endif
|
2016-11-02 08:07:09 +00:00
|
|
|
if ( WilsonKernelsStatic::Opt == WilsonKernelsStatic::OptGeneric ) std::cout << GridLogMessage<< "* Using GENERIC Nc WilsonKernels" <<std::endl;
|
|
|
|
if ( WilsonKernelsStatic::Opt == WilsonKernelsStatic::OptHandUnroll) std::cout << GridLogMessage<< "* Using Nc=3 WilsonKernels" <<std::endl;
|
|
|
|
if ( WilsonKernelsStatic::Opt == WilsonKernelsStatic::OptInlineAsm ) std::cout << GridLogMessage<< "* Using Asm Nc=3 WilsonKernels" <<std::endl;
|
|
|
|
std::cout << GridLogMessage<< "*********************************************************" <<std::endl;
|
2015-11-04 09:54:48 +00:00
|
|
|
{
|
2016-11-09 12:11:03 +00:00
|
|
|
FGrid->Barrier();
|
2017-02-07 06:32:10 +00:00
|
|
|
Dw.DhopEO(src_o,r_e,DaggerNo);
|
2015-11-04 09:54:48 +00:00
|
|
|
double t0=usecond();
|
|
|
|
for(int i=0;i<ncall;i++){
|
2019-06-08 13:38:05 +01:00
|
|
|
#ifdef CUDA_PROFILE
|
|
|
|
if(i==10) cudaProfilerStart();
|
|
|
|
#endif
|
2015-11-04 09:54:48 +00:00
|
|
|
Dw.DhopEO(src_o,r_e,DaggerNo);
|
2019-06-08 13:38:05 +01:00
|
|
|
#ifdef CUDA_PROFILE
|
|
|
|
if(i==20) cudaProfilerStop();
|
|
|
|
#endif
|
2015-11-04 09:54:48 +00:00
|
|
|
}
|
|
|
|
double t1=usecond();
|
2016-11-09 12:11:03 +00:00
|
|
|
FGrid->Barrier();
|
2020-05-15 08:15:50 +01:00
|
|
|
|
2015-11-04 09:54:48 +00:00
|
|
|
double volume=Ls; for(int mu=0;mu<Nd;mu++) volume=volume*latt4[mu];
|
2018-01-25 12:46:31 +00:00
|
|
|
double flops=(single_site_flops*volume*ncall)/2.0;
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2015-11-04 09:54:48 +00:00
|
|
|
std::cout<<GridLogMessage << "Deo mflop/s = "<< flops/(t1-t0)<<std::endl;
|
2016-10-22 18:14:27 +01:00
|
|
|
std::cout<<GridLogMessage << "Deo mflop/s per rank "<< flops/(t1-t0)/NP<<std::endl;
|
2017-05-03 20:43:36 +01:00
|
|
|
std::cout<<GridLogMessage << "Deo mflop/s per node "<< flops/(t1-t0)/NN<<std::endl;
|
2015-11-04 09:54:48 +00:00
|
|
|
}
|
2015-06-02 16:57:12 +01:00
|
|
|
Dw.DhopEO(src_o,r_e,DaggerNo);
|
|
|
|
Dw.DhopOE(src_e,r_o,DaggerNo);
|
2015-07-23 17:31:13 +01:00
|
|
|
Dw.Dhop (src ,result,DaggerNo);
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2015-07-23 17:31:13 +01:00
|
|
|
std::cout<<GridLogMessage << "r_e"<<norm2(r_e)<<std::endl;
|
|
|
|
std::cout<<GridLogMessage << "r_o"<<norm2(r_o)<<std::endl;
|
|
|
|
std::cout<<GridLogMessage << "res"<<norm2(result)<<std::endl;
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2015-06-02 16:57:12 +01:00
|
|
|
setCheckerboard(r_eo,r_o);
|
|
|
|
setCheckerboard(r_eo,r_e);
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2020-05-15 08:15:50 +01:00
|
|
|
err = r_eo-result;
|
2015-07-23 17:31:13 +01:00
|
|
|
std::cout<<GridLogMessage << "norm diff "<< norm2(err)<<std::endl;
|
2017-02-07 06:32:10 +00:00
|
|
|
if((norm2(err)>1.0e-4)){
|
2020-05-15 08:15:50 +01:00
|
|
|
/*
|
2017-05-01 13:44:00 +01:00
|
|
|
std::cout<< "Deo RESULT\n " <<r_eo << std::endl;
|
|
|
|
std::cout<< "Deo REF\n " <<result << std::endl;
|
|
|
|
std::cout<< "Deo ERR \n " << err <<std::endl;
|
2020-05-15 08:15:50 +01:00
|
|
|
*/
|
2017-02-07 06:32:10 +00:00
|
|
|
}
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2015-06-02 16:57:12 +01:00
|
|
|
pickCheckerboard(Even,src_e,err);
|
|
|
|
pickCheckerboard(Odd,src_o,err);
|
2015-07-23 17:31:13 +01:00
|
|
|
std::cout<<GridLogMessage << "norm diff even "<< norm2(src_e)<<std::endl;
|
|
|
|
std::cout<<GridLogMessage << "norm diff odd "<< norm2(src_o)<<std::endl;
|
2017-05-01 13:44:00 +01:00
|
|
|
|
2017-08-20 02:53:12 +01:00
|
|
|
assert(norm2(src_e)<1.0e-4);
|
|
|
|
assert(norm2(src_o)<1.0e-4);
|
2015-05-31 15:09:02 +01:00
|
|
|
Grid_finalize();
|
2017-08-20 02:53:12 +01:00
|
|
|
exit(0);
|
2015-05-31 15:09:02 +01:00
|
|
|
}
|