mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Hadrons: code cleaning
This commit is contained in:
parent
0a4020eb4d
commit
ee5c0cc9b6
@ -279,7 +279,7 @@ T * Environment::getDerivedObject(const unsigned int address) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HADRONS_ERROR_REF(ObjectDefinition, "object with address " +
|
HADRONS_ERROR_REF(ObjectType, "object with address " +
|
||||||
std::to_string(address) +
|
std::to_string(address) +
|
||||||
" cannot be casted to '" + typeName(&typeid(T)) +
|
" cannot be casted to '" + typeName(&typeid(T)) +
|
||||||
"' (has type '" + typeName(&typeid(h->get())) + "')", address);
|
"' (has type '" + typeName(&typeid(h->get())) + "')", address);
|
||||||
|
@ -355,6 +355,7 @@ void TA2AMesonField<FImpl>::execute(void)
|
|||||||
int schurBlock = par().schurBlock;
|
int schurBlock = par().schurBlock;
|
||||||
int cacheBlock = par().cacheBlock;
|
int cacheBlock = par().cacheBlock;
|
||||||
int nmom = par().Nmom;
|
int nmom = par().Nmom;
|
||||||
|
std::vector<ComplexD> corr(nt,ComplexD(0.0));
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// Momentum setup
|
// Momentum setup
|
||||||
@ -427,17 +428,36 @@ void TA2AMesonField<FImpl>::execute(void)
|
|||||||
bytes += vol * (12.0 * sizeof(Complex) ) * N_iii*N_jjj
|
bytes += vol * (12.0 * sizeof(Complex) ) * N_iii*N_jjj
|
||||||
+ vol * ( 2.0 * sizeof(Complex) *nmom ) * N_iii*N_jjj* ngamma;
|
+ vol * ( 2.0 * sizeof(Complex) *nmom ) * N_iii*N_jjj* ngamma;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
// Test: Build the pion correlator (two end)
|
||||||
|
// < PI_ij(t0) PI_ji (t0+t) >
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
parallel_for_nest2(int iii=0;iii< N_iii;iii++)
|
||||||
|
for(int jjj=0;jjj< N_jjj;jjj++)
|
||||||
|
{
|
||||||
|
int m=0; // first momentum
|
||||||
|
int g=0; // first gamma in above ordering is gamma5 for pion
|
||||||
|
|
||||||
|
for(int t0=0;t0<nt;t0++)
|
||||||
|
for(int t=0;t<nt;t++)
|
||||||
|
{
|
||||||
|
int tt = (t0+t)%nt;
|
||||||
|
|
||||||
|
corr[t] += mesonFieldBlocked(m,g,t0,iii,jjj)*mesonFieldBlocked(m,g,tt,jjj,iii);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Copy back to full meson field tensor
|
// Copy back to full meson field tensor
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
parallel_for_nest2(int iii=0;iii< N_iii;iii++)
|
// parallel_for_nest2(int iii=0;iii< N_iii;iii++)
|
||||||
for(int jjj=0;jjj< N_jjj;jjj++)
|
// for(int jjj=0;jjj< N_jjj;jjj++)
|
||||||
for(int m =0;m< nmom;m++)
|
// for(int m =0;m< nmom;m++)
|
||||||
for(int g =0;g< ngamma;g++)
|
// for(int g =0;g< ngamma;g++)
|
||||||
for(int t =0;t< nt;t++)
|
// for(int t =0;t< nt;t++)
|
||||||
{
|
// {
|
||||||
mesonField(m,g,t,i+ii+iii,j+jj+jjj) = mesonFieldBlocked(m,g,t,iii,jjj);
|
// mesonField(m,g,t,i+ii+iii,j+jj+jjj) = mesonFieldBlocked(m,g,t,iii,jjj);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,26 +475,6 @@ void TA2AMesonField<FImpl>::execute(void)
|
|||||||
LOG(Message) << " Arith " << flops/(t_kernel)/1.0e3/nodes << " Gflop/s/ node " << std::endl;
|
LOG(Message) << " Arith " << flops/(t_kernel)/1.0e3/nodes << " Gflop/s/ node " << std::endl;
|
||||||
LOG(Message) << " Arith " << bytes/(t_kernel)/1.0e3/nodes << " GB/s/node " << std::endl;
|
LOG(Message) << " Arith " << bytes/(t_kernel)/1.0e3/nodes << " GB/s/node " << std::endl;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
|
||||||
// Test: Build the pion correlator (two end)
|
|
||||||
// < PI_ij(t0) PI_ji (t0+t) >
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
|
||||||
std::vector<ComplexD> corr(nt,ComplexD(0.0));
|
|
||||||
|
|
||||||
for(int i=0;i<N_i;i++)
|
|
||||||
for(int j=0;j<N_j;j++)
|
|
||||||
{
|
|
||||||
int m=0; // first momentum
|
|
||||||
int g=0; // first gamma in above ordering is gamma5 for pion
|
|
||||||
|
|
||||||
for(int t0=0;t0<nt;t0++)
|
|
||||||
for(int t=0;t<nt;t++)
|
|
||||||
{
|
|
||||||
int tt = (t0+t)%nt;
|
|
||||||
|
|
||||||
corr[t] += mesonField(m,g,t0,i,j)* mesonField(m,g,tt,j,i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(int t=0;t<nt;t++) corr[t] = corr[t]/ (double)nt;
|
for(int t=0;t<nt;t++) corr[t] = corr[t]/ (double)nt;
|
||||||
for(int t=0;t<nt;t++) LOG(Message) << " " << t << " " << corr[t]<<std::endl;
|
for(int t=0;t<nt;t++) LOG(Message) << " " << t << " " << corr[t]<<std::endl;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,6 @@ class A2AVectorsPar: Serializable
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GRID_SERIALIZABLE_CLASS_MEMBERS(A2AVectorsPar,
|
GRID_SERIALIZABLE_CLASS_MEMBERS(A2AVectorsPar,
|
||||||
bool, return_5d,
|
|
||||||
std::string, noise,
|
std::string, noise,
|
||||||
std::string, action,
|
std::string, action,
|
||||||
std::string, eigenPack,
|
std::string, eigenPack,
|
||||||
@ -131,21 +130,10 @@ void TA2AVectors<FImpl, Pack>::setup(void)
|
|||||||
auto &solver = envGet(Solver, par().solver + sub_string);
|
auto &solver = envGet(Solver, par().solver + sub_string);
|
||||||
int Ls = env().getObjectLs(par().action);
|
int Ls = env().getObjectLs(par().action);
|
||||||
|
|
||||||
LOG(Message) << "Creating all-to-all vectors ";
|
|
||||||
if (hasLowModes)
|
if (hasLowModes)
|
||||||
{
|
{
|
||||||
auto &epack = envGet(Pack, par().eigenPack);
|
auto &epack = envGet(Pack, par().eigenPack);
|
||||||
|
|
||||||
Nl_ = epack.evec.size();
|
Nl_ = epack.evec.size();
|
||||||
std::cout << " using eigenpack '" << par().eigenPack << "' ("
|
|
||||||
<< Nl_ << " low modes) and noise '"
|
|
||||||
<< par().noise << "' (" << noise.size()
|
|
||||||
<< " noise vectors)" << std::endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cout << " using noise '" << par().noise << "' (" << noise.size()
|
|
||||||
<< " noise vectors)" << std::endl;
|
|
||||||
}
|
}
|
||||||
envCreate(std::vector<FermionField>, getName() + "_v", 1,
|
envCreate(std::vector<FermionField>, getName() + "_v", 1,
|
||||||
Nl_ + noise.size(), FermionField(env().getGrid()));
|
Nl_ + noise.size(), FermionField(env().getGrid()));
|
||||||
@ -171,6 +159,24 @@ void TA2AVectors<FImpl, Pack>::execute(void)
|
|||||||
int Ls = env().getObjectLs(par().action);
|
int Ls = env().getObjectLs(par().action);
|
||||||
|
|
||||||
envGetTmp(A2A, a2a);
|
envGetTmp(A2A, a2a);
|
||||||
|
|
||||||
|
if (hasLowModes)
|
||||||
|
{
|
||||||
|
auto &epack = envGet(Pack, par().eigenPack);
|
||||||
|
|
||||||
|
Nl_ = epack.evec.size();
|
||||||
|
LOG(Message) << "Computing all-to-all vectors "
|
||||||
|
<< " using eigenpack '" << par().eigenPack << "' ("
|
||||||
|
<< Nl_ << " low modes) and noise '"
|
||||||
|
<< par().noise << "' (" << noise.size()
|
||||||
|
<< " noise vectors)" << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG(Message) << "Computing all-to-all vectors "
|
||||||
|
<< " using noise '" << par().noise << "' (" << noise.size()
|
||||||
|
<< " noise vectors)" << std::endl;
|
||||||
|
}
|
||||||
// Low modes
|
// Low modes
|
||||||
for (unsigned int il = 0; il < Nl_; il++)
|
for (unsigned int il = 0; il < Nl_; il++)
|
||||||
{
|
{
|
||||||
|
@ -159,7 +159,7 @@ void TRBPrecCG<FImpl, nBasis>::setup(void)
|
|||||||
guesser.reset(new CoarseGuesser(epack.evec, epack.evecCoarse,
|
guesser.reset(new CoarseGuesser(epack.evec, epack.evecCoarse,
|
||||||
epack.evalCoarse));
|
epack.evalCoarse));
|
||||||
}
|
}
|
||||||
catch (Exceptions::Definition &e)
|
catch (Exceptions::ObjectType &e)
|
||||||
{
|
{
|
||||||
auto &epack = envGet(EPack, par().eigenPack);
|
auto &epack = envGet(EPack, par().eigenPack);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user