diff --git a/Grid/qcd/utils/A2Autils.h b/Grid/qcd/utils/A2Autils.h index 6aa4e888..c7c7d329 100644 --- a/Grid/qcd/utils/A2Autils.h +++ b/Grid/qcd/utils/A2Autils.h @@ -40,21 +40,12 @@ public: const std::vector &mom, int orthogdim); - - static void NucleonFieldMom(Eigen::Tensor &mat, - const std::vector &one, - const std::vector &two, - const std::vector &three, - const std::vector &mom, - int parity, - int orthogdim); - static void PionFieldXX(Eigen::Tensor &mat, const FermionField *wi, const FermionField *vj, int orthogdim, int g5); - + static void PionFieldWV(Eigen::Tensor &mat, const FermionField *wi, const FermionField *vj, @@ -127,404 +118,6 @@ private: const int Ns, const int ss); }; -template -void A2Autils::NucleonFieldMom(Eigen::Tensor &mat, - const std::vector &one, - const std::vector &two, - const std::vector &three, - const std::vector &mom, - int parity, - int orthogdim) -{ - assert(parity == 1 || parity == -1); - - typedef typename FImpl::SiteSpinor vobj; - - typedef typename vobj::scalar_object sobj; - typedef typename vobj::scalar_type scalar_type; - typedef typename vobj::vector_type vector_type; - - typedef iSpinVector SpinVector_v; - typedef iSpinVector SpinVector_s; - - int oneBlock = mat.dimension(2); - int twoBlock = mat.dimension(3); - int threeBlock = mat.dimension(4); - - GridBase *grid = one[0].Grid(); - - const int nd = grid->_ndimension; - const int Nsimd = grid->Nsimd(); - - int Nt = grid->GlobalDimensions()[orthogdim]; - int Nmom = mom.size(); - - int fd=grid->_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 - int MFrvol = rd*oneBlock*twoBlock*threeBlock*Nmom; - int MFlvol = ld*oneBlock*twoBlock*threeBlock*Nmom; - - Vector lvSum(MFrvol); - accelerator_for (r, MFrvol, Nsimd, { - lvSum[r] = 0; - } ); - - Vector lsSum(MFlvol); - accelerator_for (r, MFlvol, Nsimd, { - lsSum[r] = scalar_type(0.0); - } ); - - int e1= grid->_slice_nblock[orthogdim]; - int e2= grid->_slice_block [orthogdim]; - int stride=grid->_slice_stride[orthogdim]; - - accelerator_for(r, rd, Nsimd, { - int so=r*grid->_ostride[orthogdim]; // base offset for start of plane - - for(int n=0;n C gamma_5 = - i gamma_1 gamma_3 - //auto v2g = v2*Gamma(Gamma::Algebra::SigmaXZ); - //auto v2g=v2; - - for(int k=0;k extracted(Nsimd); - - for(int i=0;iiCoorFromIindex(icoor,idx); - - int ldx = rt+icoor[orthogdim]*rd; - - int ij_ldx = m+Nmom*i + Nmom*oneBlock * j + Nmom*oneBlock * twoBlock * k + Nmom*oneBlock * twoBlock *threeBlock * ldx; - - lsSum[ij_ldx]=lsSum[ij_ldx]+extracted[idx]; - - } - }}}} - } ); - - assert(mat.dimension(0) == Nmom); - assert(mat.dimension(1) == Nt); - - int pd = grid->_processors[orthogdim]; - int pc = grid->_processor_coor[orthogdim]; - accelerator_for(lt, ld, Nsimd, - { - for(int pt=0;ptGlobalSumVector(&mat(0,0,0,0,0,0),Nmom*Nt*oneBlock*twoBlock*threeBlock*4); -} - - - - - -/* -template -template -void A2Autils::BaryonField(TensorType &mat, - const FermionField *one, - const FermionField *two, - const FermionField *three, - std::vector gammaA, - std::vector gammaB, - const std::vector &mom, - int orthogdim, double *t_kernel, double *t_gsum) -{ - typedef typename FImpl::SiteSpinor vobj; - - typedef typename vobj::scalar_object sobj; - typedef typename vobj::scalar_type scalar_type; - typedef typename vobj::vector_type vector_type; - - typedef iSpinMatrix SpinMatrix_v; - typedef iSpinMatrix SpinMatrix_s; - - typedef iSpinColourMatrix SpinColourMatrix_v; - - int oneBlock = mat.dimension(3); - int twoBlock = mat.dimension(4); - int threeBlock = mat.dimension(5); - - GridBase *grid = one[0].Grid(); - - const int Nd = grid->_ndimension; - const int Nsimd = grid->Nsimd(); - - int Nt = grid->GlobalDimensions()[orthogdim]; - int Ngamma = gammaA.size(); - assert (Ngamma = gammaB.size()); // Only combinatin of two gammas gives correct operator! - int Nmom = mom.size(); - - int fd=grid->_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 - int MFrvol = rd*twoBlock*threeBlock*Nmom; - int MFlvol = ld*twoBlock*threeBlock*Nmom; - - Vector> lvSum(3); - for (int ic=0;ic<3;ic++){ - lvSum[ic].resize(MFrvol); - parallel_for (int r = 0; r < MFrvol; r++){ - lvSum[ic][r] = zero; - } - } - - Vector> lsSum(3); - for (int ic=0;ic<3;ic++){ - lsSum[ic].resize(MFlvol); - parallel_for (int r = 0; r < MFlvol; r++){ - lsSum[ic][r] = scalar_type(0.0); - } - } - - int e1= grid->_slice_nblock[orthogdim]; - int e2= grid->_slice_block [orthogdim]; - int stride=grid->_slice_stride[orthogdim]; - - // potentially wasting cores here if local time extent too small - if (t_kernel) *t_kernel = -usecond(); - parallel_for(int r=0;r_ostride[orthogdim]; // base offset for start of plane - - // first, the diquark two*gammaB*three - for(int n=0;n vv(3); - - for(int s1=0;s1 icoor(Nd); - std::vector extracted(Nsimd); - - for(int i=0;iiCoorFromIindex(icoor,idx); - - int ldx = rt+icoor[orthogdim]*rd; - - int ij_ldx = m+Nmom*i+Nmom*Lblock*j+Nmom*Lblock*Rblock*ldx; - - lsSum[ic][ij_ldx]=lsSum[ic][ij_ldx]+extracted[idx]; - - } - }}} - } - - - if (t_kernel) *t_kernel += usecond(); - assert(mat.dimension(0) == Nmom); - assert(mat.dimension(1) == Ngamma); - assert(mat.dimension(2) == Nt); - - TensorType diquark; // Need this instead of mat!!! - - // ld loop and local only?? - int pd = grid->_processors[orthogdim]; - int pc = grid->_processor_coor[orthogdim]; - parallel_for_nest2(int lt=0;ltGlobalSumVector(&mat(0,0,0,0,0),Nmom*Ngamma*Nt*Lblock*Rblock); - if (t_gsum) *t_gsum += usecond(); -} -*/ - template template void A2Autils::MesonField(TensorType &mat, @@ -667,7 +260,7 @@ void A2Autils::MesonField(TensorType &mat, int ij_dx = m+Nmom*i + Nmom*Lblock * j + Nmom*Lblock * Rblock * lt; for(int mu=0;mu