1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-05 11:45:56 +01:00

thread_for caused the problems - slow for loop for now

This commit is contained in:
Felix Erben 2019-09-26 13:33:49 +01:00
parent 8415e23fc6
commit bf62ec163d
2 changed files with 11 additions and 38 deletions

View File

@ -96,10 +96,9 @@ void BaryonUtils<FImpl>::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<FImpl>::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<FImpl>::ContractBaryons(const PropagatorField &q1_src,
}
vbaryon_corr[ss] = result;
} );//end loop over lattice sites
} // );//end loop over lattice sites
}
NAMESPACE_END(Grid);

View File

@ -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<FImpl1, FImpl2, FImpl3>::TBaryon(const std::string name)
template <typename FImpl1, typename FImpl2, typename FImpl3>
std::vector<std::string> TBaryon<FImpl1, FImpl2, FImpl3>::getInput(void)
{
std::vector<std::string> input = {par().q1_src, par().q2_src, par().q3_src};
std::vector<std::string> input = {par().q1_src, par().q2_src, par().q3_src, par().sink};
return input;
}
@ -135,49 +136,26 @@ void TBaryon<FImpl1, FImpl2, FImpl3>::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<Gamma::Algebra> ggA = strToVec<Gamma::Algebra>(par().GammaA);
LOG(Message) << "3" << std::endl;
Gamma GammaA(ggA[0]);
LOG(Message) << "4" << std::endl;
std::vector<Gamma::Algebra> ggB = strToVec<Gamma::Algebra>(par().GammaB);
Gamma GammaB(ggB[0]);
std::vector<TComplex> 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<FIMPL>::ContractBaryons(q1_src,q2_src,q3_src,GammaA,GammaB,quarks_snk,quarks_src,parity,c);
//BaryonUtils<FIMPL>::ContractBaryons(q1_src,q2_src,q3_src,GammaA,GammaB,quarks_snk,quarks_src,parity,c);
BaryonUtils<FIMPL>::ContractBaryons(q,q,q,gA,gB,om,om,p,c);
std::vector<Gamma> GA={gA};
std::vector<Gamma> GB={gB};
//A2Autils<FIMPL>::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)
{