From 413312f9a9a98634363f5c5206be19e97ec55fca Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Tue, 4 Oct 2022 11:12:59 -0700 Subject: [PATCH] Benchmark the halo construction. THe bye counts are out and should be doubled for SIMD directions --- benchmarks/Benchmark_halo.cc | 131 +++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 benchmarks/Benchmark_halo.cc diff --git a/benchmarks/Benchmark_halo.cc b/benchmarks/Benchmark_halo.cc new file mode 100644 index 00000000..43138e67 --- /dev/null +++ b/benchmarks/Benchmark_halo.cc @@ -0,0 +1,131 @@ + /************************************************************************************* + Grid physics library, www.github.com/paboyle/Grid + Source file: ./benchmarks/Benchmark_dwf.cc + Copyright (C) 2015 + + Author: Peter Boyle + Author: paboyle + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include +#ifdef GRID_CUDA +#define CUDA_PROFILE +#endif + +#ifdef CUDA_PROFILE +#include +#endif + +using namespace std; +using namespace Grid; + +template +struct scal { + d internal; +}; + + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT + }; + + +int main (int argc, char ** argv) +{ + Grid_init(&argc,&argv); + + Coordinate latt4= GridDefaultLatt(); + Coordinate mpi = GridDefaultMpi(); + Coordinate simd = GridDefaultSimd(Nd,vComplexF::Nsimd()); + + GridLogLayout(); + + int Ls=16; + for(int i=0;i> Ls; + } + + + GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(latt4,simd ,mpi); + GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid); + GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid); + + std::cout << GridLogMessage << "Making s innermost grids"< seeds4({1,2,3,4}); + std::vector seeds5({5,6,7,8}); + + std::cout << GridLogMessage << "Initialising 4d RNG" << std::endl; + GridParallelRNG RNG4(UGrid); RNG4.SeedUniqueString(std::string("The 4D RNG")); + std::cout << GridLogMessage << "Initialising 5d RNG" << std::endl; + GridParallelRNG RNG5(FGrid); RNG5.SeedUniqueString(std::string("The 5D RNG")); + std::cout << GridLogMessage << "Initialised RNGs" << std::endl; + + LatticeFermionF src (FGrid); random(RNG5,src); + RealD N2 = 1.0/::sqrt(norm2(src)); + src = src*N2; + + std::cout << GridLogMessage << "Drawing gauge field" << std::endl; + LatticeGaugeFieldF Umu(UGrid); + SU::HotConfiguration(RNG4,Umu); + std::cout << GridLogMessage << "Random gauge initialised " << std::endl; + + RealD mass=0.1; + RealD M5 =1.8; + + RealD NP = UGrid->_Nprocessors; + RealD NN = UGrid->NodeCount(); + + DomainWallFermionF Dw(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5); + + const int ncall = 500; + std::cout << GridLogMessage<< "*********************************************************" <Barrier(); + Dw.Stencil.HaloExchangeOptGather(src,compressor); + double t0=usecond(); + for(int i=0;iBarrier(); + + double bytes=0.0; + if(mpi[0]) bytes+=latt4[1]*latt4[2]*latt4[3]; + if(mpi[1]) bytes+=latt4[0]*latt4[2]*latt4[3]; + if(mpi[2]) bytes+=latt4[0]*latt4[1]*latt4[3]; + if(mpi[3]) bytes+=latt4[0]*latt4[1]*latt4[2]; + bytes = bytes * Ls * 8.* (24.+12.)* 2.0; + + std::cout<