mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-25 13:15:55 +01:00
Hadrons: MPI-safe serial IO
This commit is contained in:
parent
6e3ce7423e
commit
a1151fc734
@ -131,12 +131,14 @@ void Application::parseParameterFile(const std::string parameterFileName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Application::saveParameterFile(const std::string parameterFileName)
|
void Application::saveParameterFile(const std::string parameterFileName)
|
||||||
|
{
|
||||||
|
LOG(Message) << "Saving application to '" << parameterFileName << "'..." << std::endl;
|
||||||
|
if (env().getGrid()->IsBoss())
|
||||||
{
|
{
|
||||||
XmlWriter writer(parameterFileName);
|
XmlWriter writer(parameterFileName);
|
||||||
ObjectId id;
|
ObjectId id;
|
||||||
const unsigned int nMod = vm().getNModule();
|
const unsigned int nMod = vm().getNModule();
|
||||||
|
|
||||||
LOG(Message) << "Saving application to '" << parameterFileName << "'..." << std::endl;
|
|
||||||
write(writer, "parameters", getPar());
|
write(writer, "parameters", getPar());
|
||||||
push(writer, "modules");
|
push(writer, "modules");
|
||||||
for (unsigned int i = 0; i < nMod; ++i)
|
for (unsigned int i = 0; i < nMod; ++i)
|
||||||
@ -151,6 +153,7 @@ void Application::saveParameterFile(const std::string parameterFileName)
|
|||||||
pop(writer);
|
pop(writer);
|
||||||
pop(writer);
|
pop(writer);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// schedule computation ////////////////////////////////////////////////////////
|
// schedule computation ////////////////////////////////////////////////////////
|
||||||
void Application::schedule(void)
|
void Application::schedule(void)
|
||||||
@ -163,6 +166,10 @@ void Application::schedule(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Application::saveSchedule(const std::string filename)
|
void Application::saveSchedule(const std::string filename)
|
||||||
|
{
|
||||||
|
LOG(Message) << "Saving current schedule to '" << filename << "'..."
|
||||||
|
<< std::endl;
|
||||||
|
if (env().getGrid()->IsBoss())
|
||||||
{
|
{
|
||||||
TextWriter writer(filename);
|
TextWriter writer(filename);
|
||||||
std::vector<std::string> program;
|
std::vector<std::string> program;
|
||||||
@ -171,14 +178,14 @@ void Application::saveSchedule(const std::string filename)
|
|||||||
{
|
{
|
||||||
HADRON_ERROR(Definition, "Computation not scheduled");
|
HADRON_ERROR(Definition, "Computation not scheduled");
|
||||||
}
|
}
|
||||||
LOG(Message) << "Saving current schedule to '" << filename << "'..."
|
|
||||||
<< std::endl;
|
|
||||||
for (auto address: program_)
|
for (auto address: program_)
|
||||||
{
|
{
|
||||||
program.push_back(vm().getModuleName(address));
|
program.push_back(vm().getModuleName(address));
|
||||||
}
|
}
|
||||||
write(writer, "schedule", program);
|
write(writer, "schedule", program);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Application::loadSchedule(const std::string filename)
|
void Application::loadSchedule(const std::string filename)
|
||||||
{
|
{
|
||||||
|
@ -137,6 +137,13 @@ envTmp(type, name, Ls, env().getGrid(Ls))
|
|||||||
#define envTmpLat(...)\
|
#define envTmpLat(...)\
|
||||||
MACRO_REDIRECT(__VA_ARGS__, envTmpLat5, envTmpLat4)(__VA_ARGS__)
|
MACRO_REDIRECT(__VA_ARGS__, envTmpLat5, envTmpLat4)(__VA_ARGS__)
|
||||||
|
|
||||||
|
#define saveResult(ioStem, name, result)\
|
||||||
|
if (env().getGrid()->IsBoss())\
|
||||||
|
{\
|
||||||
|
ResultWriter _writer(RESULT_FILE_NAME(ioStem));\
|
||||||
|
write(_writer, name, result);\
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Module class *
|
* Module class *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
@ -122,7 +122,6 @@ void TBaryon<FImpl1, FImpl2, FImpl3>::execute(void)
|
|||||||
<< " quarks '" << par().q1 << "', '" << par().q2 << "', and '"
|
<< " quarks '" << par().q1 << "', '" << par().q2 << "', and '"
|
||||||
<< par().q3 << "'" << std::endl;
|
<< par().q3 << "'" << std::endl;
|
||||||
|
|
||||||
ResultWriter writer(RESULT_FILE_NAME(par().output));
|
|
||||||
auto &q1 = envGet(PropagatorField1, par().q1);
|
auto &q1 = envGet(PropagatorField1, par().q1);
|
||||||
auto &q2 = envGet(PropagatorField2, par().q2);
|
auto &q2 = envGet(PropagatorField2, par().q2);
|
||||||
auto &q3 = envGet(PropagatorField3, par().q2);
|
auto &q3 = envGet(PropagatorField3, par().q2);
|
||||||
@ -131,7 +130,7 @@ void TBaryon<FImpl1, FImpl2, FImpl3>::execute(void)
|
|||||||
|
|
||||||
// FIXME: do contractions
|
// FIXME: do contractions
|
||||||
|
|
||||||
// write(writer, "meson", result);
|
// saveResult(par().output, "meson", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
END_MODULE_NAMESPACE
|
END_MODULE_NAMESPACE
|
||||||
|
@ -119,7 +119,6 @@ void TDiscLoop<FImpl>::execute(void)
|
|||||||
<< "' using '" << par().q_loop << "' with " << par().gamma
|
<< "' using '" << par().q_loop << "' with " << par().gamma
|
||||||
<< " insertion." << std::endl;
|
<< " insertion." << std::endl;
|
||||||
|
|
||||||
ResultWriter writer(RESULT_FILE_NAME(par().output));
|
|
||||||
auto &q_loop = envGet(PropagatorField, par().q_loop);
|
auto &q_loop = envGet(PropagatorField, par().q_loop);
|
||||||
Gamma gamma(par().gamma);
|
Gamma gamma(par().gamma);
|
||||||
std::vector<TComplex> buf;
|
std::vector<TComplex> buf;
|
||||||
@ -128,15 +127,13 @@ void TDiscLoop<FImpl>::execute(void)
|
|||||||
envGetTmp(LatticeComplex, c);
|
envGetTmp(LatticeComplex, c);
|
||||||
c = trace(gamma*q_loop);
|
c = trace(gamma*q_loop);
|
||||||
sliceSum(c, buf, Tp);
|
sliceSum(c, buf, Tp);
|
||||||
|
|
||||||
result.gamma = par().gamma;
|
result.gamma = par().gamma;
|
||||||
result.corr.resize(buf.size());
|
result.corr.resize(buf.size());
|
||||||
for (unsigned int t = 0; t < buf.size(); ++t)
|
for (unsigned int t = 0; t < buf.size(); ++t)
|
||||||
{
|
{
|
||||||
result.corr[t] = TensorRemove(buf[t]);
|
result.corr[t] = TensorRemove(buf[t]);
|
||||||
}
|
}
|
||||||
|
saveResult(par().output, "disc", result);
|
||||||
write(writer, "disc", result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_MODULE_NAMESPACE
|
END_MODULE_NAMESPACE
|
||||||
|
@ -153,7 +153,6 @@ void TGamma3pt<FImpl1, FImpl2, FImpl3>::execute(void)
|
|||||||
|
|
||||||
// Initialise variables. q2 and q3 are normal propagators, q1 may be
|
// Initialise variables. q2 and q3 are normal propagators, q1 may be
|
||||||
// sink smeared.
|
// sink smeared.
|
||||||
ResultWriter writer(RESULT_FILE_NAME(par().output));
|
|
||||||
auto &q1 = envGet(SlicedPropagator1, par().q1);
|
auto &q1 = envGet(SlicedPropagator1, par().q1);
|
||||||
auto &q2 = envGet(PropagatorField2, par().q2);
|
auto &q2 = envGet(PropagatorField2, par().q2);
|
||||||
auto &q3 = envGet(PropagatorField2, par().q3);
|
auto &q3 = envGet(PropagatorField2, par().q3);
|
||||||
@ -175,8 +174,7 @@ void TGamma3pt<FImpl1, FImpl2, FImpl3>::execute(void)
|
|||||||
{
|
{
|
||||||
result.corr[t] = TensorRemove(buf[t]);
|
result.corr[t] = TensorRemove(buf[t]);
|
||||||
}
|
}
|
||||||
|
saveResult(par().output, "gamma3pt", result);
|
||||||
write(writer, "gamma3pt", result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_MODULE_NAMESPACE
|
END_MODULE_NAMESPACE
|
||||||
|
@ -172,7 +172,6 @@ void TMeson<FImpl1, FImpl2>::execute(void)
|
|||||||
<< " quarks '" << par().q1 << "' and '" << par().q2 << "'"
|
<< " quarks '" << par().q1 << "' and '" << par().q2 << "'"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
ResultWriter writer(RESULT_FILE_NAME(par().output));
|
|
||||||
std::vector<TComplex> buf;
|
std::vector<TComplex> buf;
|
||||||
std::vector<Result> result;
|
std::vector<Result> result;
|
||||||
Gamma g5(Gamma::Algebra::Gamma5);
|
Gamma g5(Gamma::Algebra::Gamma5);
|
||||||
@ -239,7 +238,7 @@ void TMeson<FImpl1, FImpl2>::execute(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
write(writer, "meson", result);
|
saveResult(par().output, "meson", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
END_MODULE_NAMESPACE
|
END_MODULE_NAMESPACE
|
||||||
|
@ -104,7 +104,6 @@ void TWeakHamiltonianEye::execute(void)
|
|||||||
<< par().q2 << ", '" << par().q3 << "' and '" << par().q4
|
<< par().q2 << ", '" << par().q3 << "' and '" << par().q4
|
||||||
<< "'." << std::endl;
|
<< "'." << std::endl;
|
||||||
|
|
||||||
ResultWriter writer(RESULT_FILE_NAME(par().output));
|
|
||||||
auto &q1 = envGet(SlicedPropagator, par().q1);
|
auto &q1 = envGet(SlicedPropagator, par().q1);
|
||||||
auto &q2 = envGet(PropagatorField, par().q2);
|
auto &q2 = envGet(PropagatorField, par().q2);
|
||||||
auto &q3 = envGet(PropagatorField, par().q3);
|
auto &q3 = envGet(PropagatorField, par().q3);
|
||||||
@ -147,5 +146,6 @@ void TWeakHamiltonianEye::execute(void)
|
|||||||
SUM_MU(expbuf, E_body[mu]*E_loop[mu])
|
SUM_MU(expbuf, E_body[mu]*E_loop[mu])
|
||||||
MAKE_DIAG(expbuf, corrbuf, result[E_diag], "HW_E")
|
MAKE_DIAG(expbuf, corrbuf, result[E_diag], "HW_E")
|
||||||
|
|
||||||
write(writer, "HW_Eye", result);
|
// IO
|
||||||
|
saveResult(par().output, "HW_Eye", result);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,6 @@ void TWeakHamiltonianNonEye::execute(void)
|
|||||||
<< par().q2 << ", '" << par().q3 << "' and '" << par().q4
|
<< par().q2 << ", '" << par().q3 << "' and '" << par().q4
|
||||||
<< "'." << std::endl;
|
<< "'." << std::endl;
|
||||||
|
|
||||||
ResultWriter writer(RESULT_FILE_NAME(par().output));
|
|
||||||
auto &q1 = envGet(PropagatorField, par().q1);
|
auto &q1 = envGet(PropagatorField, par().q1);
|
||||||
auto &q2 = envGet(PropagatorField, par().q2);
|
auto &q2 = envGet(PropagatorField, par().q2);
|
||||||
auto &q3 = envGet(PropagatorField, par().q3);
|
auto &q3 = envGet(PropagatorField, par().q3);
|
||||||
@ -144,5 +143,6 @@ void TWeakHamiltonianNonEye::execute(void)
|
|||||||
SUM_MU(expbuf, W_i_side_loop[mu]*W_f_side_loop[mu])
|
SUM_MU(expbuf, W_i_side_loop[mu]*W_f_side_loop[mu])
|
||||||
MAKE_DIAG(expbuf, corrbuf, result[W_diag], "HW_W")
|
MAKE_DIAG(expbuf, corrbuf, result[W_diag], "HW_W")
|
||||||
|
|
||||||
write(writer, "HW_NonEye", result);
|
// IO
|
||||||
|
saveResult(par().output, "HW_NonEye", result);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,6 @@ void TWeakNeutral4ptDisc::execute(void)
|
|||||||
<< par().q2 << ", '" << par().q3 << "' and '" << par().q4
|
<< par().q2 << ", '" << par().q3 << "' and '" << par().q4
|
||||||
<< "'." << std::endl;
|
<< "'." << std::endl;
|
||||||
|
|
||||||
ResultWriter writer(RESULT_FILE_NAME(par().output));
|
|
||||||
auto &q1 = envGet(PropagatorField, par().q1);
|
auto &q1 = envGet(PropagatorField, par().q1);
|
||||||
auto &q2 = envGet(PropagatorField, par().q2);
|
auto &q2 = envGet(PropagatorField, par().q2);
|
||||||
auto &q3 = envGet(PropagatorField, par().q3);
|
auto &q3 = envGet(PropagatorField, par().q3);
|
||||||
@ -138,5 +137,6 @@ void TWeakNeutral4ptDisc::execute(void)
|
|||||||
expbuf *= curr;
|
expbuf *= curr;
|
||||||
MAKE_DIAG(expbuf, corrbuf, result[neut_disc_2_diag], "HW_disc0_2")
|
MAKE_DIAG(expbuf, corrbuf, result[neut_disc_2_diag], "HW_disc0_2")
|
||||||
|
|
||||||
write(writer, "HW_disc0", result);
|
// IO
|
||||||
|
saveResult(par().output, "HW_disc0", result);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,6 @@ void TChargedProp::execute(void)
|
|||||||
LOG(Message) << "Saving zero-momentum projection to '"
|
LOG(Message) << "Saving zero-momentum projection to '"
|
||||||
<< filename << "'..." << std::endl;
|
<< filename << "'..." << std::endl;
|
||||||
|
|
||||||
ResultWriter writer(RESULT_FILE_NAME(par().output));
|
|
||||||
std::vector<TComplex> vecBuf;
|
std::vector<TComplex> vecBuf;
|
||||||
std::vector<Complex> result;
|
std::vector<Complex> result;
|
||||||
|
|
||||||
@ -143,8 +142,8 @@ void TChargedProp::execute(void)
|
|||||||
{
|
{
|
||||||
result[t] = TensorRemove(vecBuf[t]);
|
result[t] = TensorRemove(vecBuf[t]);
|
||||||
}
|
}
|
||||||
write(writer, "charge", q);
|
saveResult(par().output, "charge", q);
|
||||||
write(writer, "prop", result);
|
saveResult(par().output, "prop", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +83,6 @@ void TFreeProp::execute(void)
|
|||||||
|
|
||||||
if (!par().output.empty())
|
if (!par().output.empty())
|
||||||
{
|
{
|
||||||
TextWriter writer(par().output + "." +
|
|
||||||
std::to_string(vm().getTrajectory()));
|
|
||||||
std::vector<TComplex> buf;
|
std::vector<TComplex> buf;
|
||||||
std::vector<Complex> result;
|
std::vector<Complex> result;
|
||||||
|
|
||||||
@ -94,6 +92,6 @@ void TFreeProp::execute(void)
|
|||||||
{
|
{
|
||||||
result[t] = TensorRemove(buf[t]);
|
result[t] = TensorRemove(buf[t]);
|
||||||
}
|
}
|
||||||
write(writer, "prop", result);
|
saveResult(par().output, "freeprop", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,11 +151,10 @@ void TDiv<SImpl>::execute(void)
|
|||||||
if (!par().output.empty())
|
if (!par().output.empty())
|
||||||
{
|
{
|
||||||
Result r;
|
Result r;
|
||||||
ResultWriter writer(RESULT_FILE_NAME(par().output));
|
|
||||||
|
|
||||||
r.type = par().type;
|
r.type = par().type;
|
||||||
r.value = TensorRemove(sum(div));
|
r.value = TensorRemove(sum(div));
|
||||||
write(writer, "div", r);
|
saveResult(par().output, "div", r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,6 @@ void TTrMag<SImpl>::execute(void)
|
|||||||
<< "..." << std::endl;
|
<< "..." << std::endl;
|
||||||
|
|
||||||
std::vector<Result> result;
|
std::vector<Result> result;
|
||||||
ResultWriter writer(RESULT_FILE_NAME(par().output));
|
|
||||||
auto &phi = envGet(Field, par().field);
|
auto &phi = envGet(Field, par().field);
|
||||||
|
|
||||||
auto m2 = sum(phi), mn = m2;
|
auto m2 = sum(phi), mn = m2;
|
||||||
@ -136,7 +135,7 @@ void TTrMag<SImpl>::execute(void)
|
|||||||
r.value = TensorRemove(trace(mn)).real();
|
r.value = TensorRemove(trace(mn)).real();
|
||||||
result.push_back(r);
|
result.push_back(r);
|
||||||
}
|
}
|
||||||
write(writer, "trmag", result);
|
saveResult(par().output, "trmag", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
END_MODULE_NAMESPACE
|
END_MODULE_NAMESPACE
|
||||||
|
@ -162,9 +162,7 @@ void TTrPhi<SImpl>::execute(void)
|
|||||||
}
|
}
|
||||||
if (result.size() > 0)
|
if (result.size() > 0)
|
||||||
{
|
{
|
||||||
ResultWriter writer(RESULT_FILE_NAME(par().output));
|
saveResult(par().output, "trphi", result);
|
||||||
|
|
||||||
write(writer, "trphi", result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,6 @@ void TTwoPoint<SImpl>::execute(void)
|
|||||||
LOG(Message) << " '" << o << "'" << std::endl;
|
LOG(Message) << " '" << o << "'" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultWriter writer(RESULT_FILE_NAME(par().output));
|
|
||||||
const unsigned int nd = env().getDim().size();
|
const unsigned int nd = env().getDim().size();
|
||||||
std::vector<Result> result;
|
std::vector<Result> result;
|
||||||
|
|
||||||
@ -150,7 +149,7 @@ void TTwoPoint<SImpl>::execute(void)
|
|||||||
r.data = makeTwoPoint(slicedOp[i], slicedOp[j]);
|
r.data = makeTwoPoint(slicedOp[i], slicedOp[j]);
|
||||||
result.push_back(r);
|
result.push_back(r);
|
||||||
}
|
}
|
||||||
write(writer, "twopt", result);
|
saveResult(par().output, "twopt", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make 2-pt function //////////////////////////////////////////////////////////
|
// make 2-pt function //////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user