From bf62ec163d480f3c4a0508d3f6f6e7f0e8783221 Mon Sep 17 00:00:00 2001 From: Felix Erben Date: Thu, 26 Sep 2019 13:33:49 +0100 Subject: [PATCH] thread_for caused the problems - slow for loop for now --- Grid/qcd/utils/BaryonUtils.h | 11 ++----- Hadrons/Modules/MContraction/Baryon.hpp | 38 ++++++------------------- 2 files changed, 11 insertions(+), 38 deletions(-) diff --git a/Grid/qcd/utils/BaryonUtils.h b/Grid/qcd/utils/BaryonUtils.h index f34f2926..2a7fc9d0 100644 --- a/Grid/qcd/utils/BaryonUtils.h +++ b/Grid/qcd/utils/BaryonUtils.h @@ -96,10 +96,9 @@ void BaryonUtils::ContractBaryons(const PropagatorField &q1_src, auto v2 = q2_src.View(); auto v3 = q3_src.View(); - std::cout << "wick contract " << wick_contraction << std::endl; - int count=0; // accelerator_for(ss, grid->oSites(), grid->Nsimd(), { - thread_for(ss,grid->oSites(),{ + //thread_for(ss,grid->oSites(),{ + for(int ss=0; ss < grid->oSites(); ss++){ auto D1 = v1[ss]; auto D2 = v2[ss]; @@ -111,10 +110,6 @@ void BaryonUtils::ContractBaryons(const PropagatorField &q1_src, auto gD3 = GammaB * D3; vobj result=Zero(); - /* if (count<10){ - std::cout << "outside epsilon " << count << std::endl; - count++; - }*/ for (int ie_src=0; ie_src < 6 ; ie_src++){ int a_src = epsilon[ie_src][0]; //a @@ -182,6 +177,6 @@ void BaryonUtils::ContractBaryons(const PropagatorField &q1_src, } vbaryon_corr[ss] = result; - } );//end loop over lattice sites + } // );//end loop over lattice sites } NAMESPACE_END(Grid); diff --git a/Hadrons/Modules/MContraction/Baryon.hpp b/Hadrons/Modules/MContraction/Baryon.hpp index 8f831c9b..4a3a39e4 100644 --- a/Hadrons/Modules/MContraction/Baryon.hpp +++ b/Hadrons/Modules/MContraction/Baryon.hpp @@ -52,11 +52,10 @@ public: std::string, q3_src, std::string, GammaA, std::string, GammaB, - // char[], quarks_snk, - // char[], quarks_src, std::string, quarks_snk, std::string, quarks_src, int, parity, + std::string, sink, std::string, output); }; @@ -67,6 +66,8 @@ public: FERM_TYPE_ALIASES(FImpl1, 1); FERM_TYPE_ALIASES(FImpl2, 2); FERM_TYPE_ALIASES(FImpl3, 3); + BASIC_TYPE_ALIASES(ScalarImplCR, Scalar); + SINK_TYPE_ALIASES(Scalar); class Result: Serializable { public: @@ -105,7 +106,7 @@ TBaryon::TBaryon(const std::string name) template std::vector TBaryon::getInput(void) { - std::vector input = {par().q1_src, par().q2_src, par().q3_src}; + std::vector input = {par().q1_src, par().q2_src, par().q3_src, par().sink}; return input; } @@ -135,49 +136,26 @@ void TBaryon::execute(void) << " ) and parity " << par().parity << "." << std::endl; auto &q1_src = envGet(PropagatorField1, par().q1_src); - LOG(Message) << "1" << std::endl; auto &q2_src = envGet(PropagatorField2, par().q2_src); auto &q3_src = envGet(PropagatorField3, par().q3_src); envGetTmp(LatticeComplex, c); Result result; int nt = env().getDim(Tp); result.corr.resize(nt); - LOG(Message) << "2" << std::endl; std::vector ggA = strToVec(par().GammaA); - LOG(Message) << "3" << std::endl; Gamma GammaA(ggA[0]); - LOG(Message) << "4" << std::endl; std::vector ggB = strToVec(par().GammaB); Gamma GammaB(ggB[0]); std::vector buf; const int parity {par().parity}; - LOG(Message) << "5" << std::endl; const char * quarks_snk{par().quarks_snk.c_str()}; - LOG(Message) << "6" << std::endl; const char * quarks_src{par().quarks_src.c_str()}; - LOG(Message) << "quarks_snk " << quarks_snk[0] << quarks_snk[1] << quarks_snk[2] << std::endl; - LOG(Message) << "GammaA " << (GammaA.g) << std::endl; - LOG(Message) << "GammaB " << (GammaB.g) << std::endl; - GridCartesian *Ugrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(),GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); - LatticePropagator q(Ugrid); - GridParallelRNG RNG4(Ugrid); - gaussian(RNG4,q); - Gamma gA = Gamma(Gamma::Algebra::Identity); - Gamma gB = Gamma(Gamma::Algebra::Gamma5); - int p=1; - char * om = "sss"; - LatticeComplex c2(Ugrid); + BaryonUtils::ContractBaryons(q1_src,q2_src,q3_src,GammaA,GammaB,quarks_snk,quarks_src,parity,c); - //BaryonUtils::ContractBaryons(q1_src,q2_src,q3_src,GammaA,GammaB,quarks_snk,quarks_src,parity,c); - BaryonUtils::ContractBaryons(q,q,q,gA,gB,om,om,p,c); - std::vector GA={gA}; - std::vector GB={gB}; - //A2Autils::ContractFourQuarkColourMix(q,q,GA,GB,c,c2); - LOG(Message) << "survived ContractBaryons" << std::endl; - - sliceSum(c,buf,Tp); - LOG(Message) << "survived sliceSum" << std::endl; + //sliceSum(c,buf,Tp); + SinkFnScalar &sink = envGet(SinkFnScalar, par().sink); + buf = sink(c); for (unsigned int t = 0; t < buf.size(); ++t) {