/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: ./benchmarks/Benchmark_wilson.cc Copyright (C) 2018 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 using namespace std; using namespace Grid; using namespace Grid::QCD; #include "Grid/util/Profiling.h" template void sliceInnerProductMesonField(std::vector< std::vector > &mat, const std::vector > &lhs, const std::vector > &rhs, int orthogdim) { typedef typename vobj::scalar_object sobj; typedef typename vobj::scalar_type scalar_type; typedef typename vobj::vector_type vector_type; int Lblock = lhs.size(); int Rblock = rhs.size(); GridBase *grid = lhs[0]._grid; const int Nd = grid->_ndimension; const int Nsimd = grid->Nsimd(); int Nt = grid->GlobalDimensions()[orthogdim]; assert(mat.size()==Lblock*Rblock); for(int t=0;t_fdimensions[orthogdim]; int ld=grid->_ldimensions[orthogdim]; int rd=grid->_rdimensions[orthogdim]; // will locally sum vectors first // sum across these down to scalars // splitting the SIMD std::vector > lvSum(rd*Lblock*Rblock); for (int r = 0; r < rd * Lblock * Rblock; r++){ lvSum[r] = zero; } std::vector lsSum(ld*Lblock*Rblock,scalar_type(0.0)); int e1= grid->_slice_nblock[orthogdim]; int e2= grid->_slice_block [orthogdim]; int stride=grid->_slice_stride[orthogdim]; std::cout << GridLogMessage << " Entering first parallel loop "<_ostride[orthogdim]; // base offset for start of plane for(int n=0;n icoor(Nd); for(int i=0;i temp; std::vector > extracted(Nsimd); temp._internal = lvSum[i+Lblock*j+Lblock*Rblock*rt]; extract(temp,extracted); for(int idx=0;idxiCoorFromIindex(icoor,idx); int ldx =rt+icoor[orthogdim]*rd; int ij_dx = i+Lblock*j+Lblock*Rblock*ldx; lsSum[ij_dx]=lsSum[ij_dx]+extracted[idx]._internal; } }} } std::cout << GridLogMessage << " Entering non parallel loop "<_processor_coor[orthogdim]){ int ij_dx = i + Lblock * j + Lblock * Rblock * lt; mat[i+j*Lblock][t] = lsSum[ij_dx]; } else{ mat[i+j*Lblock][t] = scalar_type(0.0); } }} } std::cout << GridLogMessage << " Done "<(std::vector< std::vector > &mat, const std::vector > &lhs, const std::vector > &rhs, int orthogdim) ; */ int main (int argc, char ** argv) { Grid_init(&argc,&argv); std::vector latt_size = GridDefaultLatt(); std::vector simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd()); std::vector mpi_layout = GridDefaultMpi(); GridCartesian Grid(latt_size,simd_layout,mpi_layout); int nt = latt_size[Tp]; uint64_t vol = 1; for(int d=0;d seeds({1,2,3,4}); GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds); const int Nm = 32; // number of all modes (high + low) std::vector v(Nm,&Grid); std::vector w(Nm,&Grid); for(int i=0;i ip(nt); std::vector > MesonFields (Nm*Nm); std::vector > MesonFieldsRef(Nm*Nm); for(int i=0;i