From ce29b18dc9971dac36e20ddfb4ef35ea748500a0 Mon Sep 17 00:00:00 2001 From: fionnoh Date: Thu, 27 Jun 2019 13:46:06 +0800 Subject: [PATCH] New modules for loading in MFs as diskvectors and producing propagaotrs from 4 quark contractions --- Hadrons/Modules.hpp | 120 ++++----- .../MContraction/A2AFourQuarkContraction.cc | 7 + .../MContraction/A2AFourQuarkContraction.hpp | 105 ++++++++ .../Modules/MIO/LoadA2AMatrixDiskVector.cc | 7 + .../Modules/MIO/LoadA2AMatrixDiskVector.hpp | 115 +++++++++ Hadrons/modules.inc | 232 +++++++++--------- 6 files changed, 413 insertions(+), 173 deletions(-) create mode 100644 Hadrons/Modules/MContraction/A2AFourQuarkContraction.cc create mode 100644 Hadrons/Modules/MContraction/A2AFourQuarkContraction.hpp create mode 100644 Hadrons/Modules/MIO/LoadA2AMatrixDiskVector.cc create mode 100644 Hadrons/Modules/MIO/LoadA2AMatrixDiskVector.hpp diff --git a/Hadrons/Modules.hpp b/Hadrons/Modules.hpp index 898cb532..4d5e9db4 100644 --- a/Hadrons/Modules.hpp +++ b/Hadrons/Modules.hpp @@ -1,69 +1,71 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include #include #include +#include #include #include -#include -#include -#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/Hadrons/Modules/MContraction/A2AFourQuarkContraction.cc b/Hadrons/Modules/MContraction/A2AFourQuarkContraction.cc new file mode 100644 index 00000000..9afe12ba --- /dev/null +++ b/Hadrons/Modules/MContraction/A2AFourQuarkContraction.cc @@ -0,0 +1,7 @@ +#include + +using namespace Grid; +using namespace Hadrons; +using namespace MContraction; + +template class Grid::Hadrons::MContraction::TA2AFourQuarkContraction; diff --git a/Hadrons/Modules/MContraction/A2AFourQuarkContraction.hpp b/Hadrons/Modules/MContraction/A2AFourQuarkContraction.hpp new file mode 100644 index 00000000..f977caab --- /dev/null +++ b/Hadrons/Modules/MContraction/A2AFourQuarkContraction.hpp @@ -0,0 +1,105 @@ +#ifndef Hadrons_MContraction_A2AFourQuarkContraction_hpp_ +#define Hadrons_MContraction_A2AFourQuarkContraction_hpp_ + +#include +#include +#include +#include + +BEGIN_HADRONS_NAMESPACE + +/****************************************************************************** + * A2AFourQuarkContraction * + ******************************************************************************/ +BEGIN_MODULE_NAMESPACE(MContraction) + +class A2AFourQuarkContractionPar: Serializable +{ +public: + GRID_SERIALIZABLE_CLASS_MEMBERS(A2AFourQuarkContractionPar, + std::string, v1, + std::string, v2, + std::string, mf12); +}; + +template +class TA2AFourQuarkContraction: public Module +{ + public: + FERM_TYPE_ALIASES(FImpl, ); + // constructor + TA2AFourQuarkContraction(const std::string name); + // destructor + virtual ~TA2AFourQuarkContraction(void) {}; + // dependency relation + virtual std::vector getInput(void); + virtual std::vector getOutput(void); + // setup + virtual void setup(void); + // execution + virtual void execute(void); +}; + +MODULE_REGISTER_TMP(A2AFourQuarkContraction, TA2AFourQuarkContraction, MContraction); + +/****************************************************************************** + * TA2AFourQuarkContraction implementation * + ******************************************************************************/ +// constructor ///////////////////////////////////////////////////////////////// +template +TA2AFourQuarkContraction::TA2AFourQuarkContraction(const std::string name) +: Module(name) +{} + +// dependencies/products /////////////////////////////////////////////////////// +template +std::vector TA2AFourQuarkContraction::getInput(void) +{ + std::vector in = {par().v1, par().v2, par().mf12}; + + return in; +} + +template +std::vector TA2AFourQuarkContraction::getOutput(void) +{ + std::vector out = {getName()}; + + return out; +} + +// setup /////////////////////////////////////////////////////////////////////// +template +void TA2AFourQuarkContraction::setup(void) +{ + int nt = env().getDim(Tp); + + envCreate(std::vector, getName(), 1, nt, envGetGrid(PropagatorField)); +} + +// execution /////////////////////////////////////////////////////////////////// +template +void TA2AFourQuarkContraction::execute(void) +{ + int nt = env().getDim(Tp); + + auto &v1 = envGet(std::vector, par().v1); + auto &v2 = envGet(std::vector, par().v2); + auto &mf12 = envGet(EigenDiskVector, par().mf12); + + auto &wwvv = envGet(std::vector, getName()); + + for (int t = 0; t < nt; t++) + { + wwvv[t] = zero; + } + + LOG(Message) << "Computing 4 quark contraction for: " << getName() << std::endl; + A2Autils::ContractWWVV(wwvv, mf12, &v1[0], &v2[0]); +} + +END_MODULE_NAMESPACE + +END_HADRONS_NAMESPACE + +#endif // Hadrons_MContraction_A2AFourQuarkContraction_hpp_ diff --git a/Hadrons/Modules/MIO/LoadA2AMatrixDiskVector.cc b/Hadrons/Modules/MIO/LoadA2AMatrixDiskVector.cc new file mode 100644 index 00000000..696e159c --- /dev/null +++ b/Hadrons/Modules/MIO/LoadA2AMatrixDiskVector.cc @@ -0,0 +1,7 @@ +#include + +using namespace Grid; +using namespace Hadrons; +using namespace MIO; + +template class Grid::Hadrons::MIO::TLoadA2AMatrixDiskVector; diff --git a/Hadrons/Modules/MIO/LoadA2AMatrixDiskVector.hpp b/Hadrons/Modules/MIO/LoadA2AMatrixDiskVector.hpp new file mode 100644 index 00000000..d7799a37 --- /dev/null +++ b/Hadrons/Modules/MIO/LoadA2AMatrixDiskVector.hpp @@ -0,0 +1,115 @@ +#ifndef Hadrons_MIO_LoadA2AMatrixDiskVector_hpp_ +#define Hadrons_MIO_LoadA2AMatrixDiskVector_hpp_ + +#include +#include +#include +#include +#include + +BEGIN_HADRONS_NAMESPACE + +/****************************************************************************** + * LoadA2AMatrixDiskVector * + ******************************************************************************/ +BEGIN_MODULE_NAMESPACE(MIO) + +class LoadA2AMatrixDiskVectorPar: Serializable +{ +public: + GRID_SERIALIZABLE_CLASS_MEMBERS(LoadA2AMatrixDiskVectorPar, + std::string, file, + std::string, dataset, + std::string, diskVectorDir, + int, cacheSize); +}; + +template +class TLoadA2AMatrixDiskVector: public Module +{ + public: + FERM_TYPE_ALIASES(FImpl, ); + // constructor + TLoadA2AMatrixDiskVector(const std::string name); + // destructor + virtual ~TLoadA2AMatrixDiskVector(void) {}; + // dependency relation + virtual std::vector getInput(void); + virtual std::vector getOutput(void); + // setup + virtual void setup(void); + // execution + virtual void execute(void); +}; + +MODULE_REGISTER_TMP(LoadA2AMatrixDiskVector, TLoadA2AMatrixDiskVector, MIO); + +/****************************************************************************** + * TLoadA2AMatrixDiskVector implementation * + ******************************************************************************/ +// constructor ///////////////////////////////////////////////////////////////// +template +TLoadA2AMatrixDiskVector::TLoadA2AMatrixDiskVector(const std::string name) +: Module(name) +{} + +// dependencies/products /////////////////////////////////////////////////////// +template +std::vector TLoadA2AMatrixDiskVector::getInput(void) +{ + std::vector in; + + return in; +} + +template +std::vector TLoadA2AMatrixDiskVector::getOutput(void) +{ + std::vector out = {getName()}; + + return out; +} + +// setup /////////////////////////////////////////////////////////////////////// +template +void TLoadA2AMatrixDiskVector::setup(void) +{ + int Ls = 1; + + std::string dvDir = par().diskVectorDir; + std::string dataset = par().dataset; + std::string dvFile = dvDir + "/" + getName() + "." + std::to_string(vm().getTrajectory()); + + int nt = env().getDim(Tp); + int cacheSize = par().cacheSize; + bool clean = true; + GridBase *grid = envGetGrid(FermionField); + + envCreate(EigenDiskVector, getName(), Ls, dvFile, nt, cacheSize, clean, grid); +} + +// execution /////////////////////////////////////////////////////////////////// +template +void TLoadA2AMatrixDiskVector::execute(void) +{ + int nt = env().getDim(Tp); + std::string file = par().file; + std::string dataset = par().dataset; + GridBase *grid = envGetGrid(FermionField); + + auto &mesonFieldDV = envGet(EigenDiskVector, getName()); + + int traj = vm().getTrajectory(); + tokenReplace(file, "traj", traj); + LOG(Message) << "-- Loading '" << file << "'-- " << std::endl; + double t; + A2AMatrixIo mfIO(file, dataset, nt); + mfIO.load(mesonFieldDV, &t, grid); + LOG(Message) << "Read " << mfIO.getSize() << " bytes in " << t << " usec, " << mfIO.getSize() / t * 1.0e6 / 1024 / 1024 << " MB/s" << std::endl; +} + +END_MODULE_NAMESPACE + +END_HADRONS_NAMESPACE + +#endif // Hadrons_MIO_LoadA2AMatrixDiskVector_hpp_ diff --git a/Hadrons/modules.inc b/Hadrons/modules.inc index 3b9e6563..d607c4bc 100644 --- a/Hadrons/modules.inc +++ b/Hadrons/modules.inc @@ -1,139 +1,143 @@ modules_cc =\ - Modules/MContraction/Baryon.cc \ - Modules/MContraction/Meson.cc \ - Modules/MContraction/WeakMesonDecayKl2.cc \ - Modules/MContraction/WeakEye3pt.cc \ - Modules/MContraction/A2ALoop.cc \ - Modules/MContraction/WeakNonEye3pt.cc \ - Modules/MContraction/A2AAslashField.cc \ - Modules/MContraction/A2AMesonField.cc \ - Modules/MContraction/DiscLoop.cc \ - Modules/MContraction/Gamma3pt.cc \ - Modules/MFermion/FreeProp.cc \ - Modules/MFermion/GaugeProp.cc \ - Modules/MFermion/EMLepton.cc \ - Modules/MSource/Momentum.cc \ - Modules/MSource/Point.cc \ - Modules/MSource/Wall.cc \ Modules/MSource/SeqConserved.cc \ Modules/MSource/SeqGamma.cc \ - Modules/MSource/SeqAslash.cc \ + Modules/MSource/Momentum.cc \ + Modules/MSource/Point.cc \ Modules/MSource/Z2.cc \ + Modules/MSource/SeqAslash.cc \ + Modules/MSource/Wall.cc \ Modules/MSink/Point.cc \ Modules/MSink/Smear.cc \ - Modules/MSolver/A2AVectors.cc \ - Modules/MSolver/A2AAslashVectors.cc \ - Modules/MSolver/RBPrecCG.cc \ - Modules/MSolver/MixedPrecisionRBPrecCG.cc \ - Modules/MSolver/LocalCoherenceLanczos.cc \ - Modules/MGauge/StoutSmearing.cc \ - Modules/MGauge/Unit.cc \ - Modules/MGauge/UnitEm.cc \ - Modules/MGauge/StochEm.cc \ - Modules/MGauge/Random.cc \ - Modules/MGauge/Electrify.cc \ - Modules/MGauge/FundtoHirep.cc \ - Modules/MGauge/GaugeFix.cc \ - Modules/MNoise/FullVolumeSpinColorDiagonal.cc \ + Modules/MIO/LoadA2AMatrixDiskVector.cc \ + Modules/MIO/LoadNersc.cc \ + Modules/MIO/LoadEigenPack.cc \ + Modules/MIO/LoadCosmHol.cc \ + Modules/MIO/LoadA2AVectors.cc \ + Modules/MIO/LoadCoarseEigenPack.cc \ + Modules/MIO/LoadBinary.cc \ + Modules/MScalarSUN/TwoPointNPR.cc \ + Modules/MScalarSUN/TrPhi.cc \ + Modules/MScalarSUN/StochFreeField.cc \ + Modules/MScalarSUN/TrMag.cc \ + Modules/MScalarSUN/Div.cc \ + Modules/MScalarSUN/Grad.cc \ + Modules/MScalarSUN/TwoPoint.cc \ + Modules/MScalarSUN/EMT.cc \ + Modules/MScalarSUN/TransProj.cc \ + Modules/MScalarSUN/TrKinetic.cc \ + Modules/MAction/DWF.cc \ + Modules/MAction/MobiusDWF.cc \ + Modules/MAction/ZMobiusDWF.cc \ + Modules/MAction/Wilson.cc \ + Modules/MAction/ScaledDWF.cc \ + Modules/MAction/WilsonClover.cc \ + Modules/MContraction/WeakEye3pt.cc \ + Modules/MContraction/DiscLoop.cc \ + Modules/MContraction/Baryon.cc \ + Modules/MContraction/A2AMesonField.cc \ + Modules/MContraction/Gamma3pt.cc \ + Modules/MContraction/A2ALoop.cc \ + Modules/MContraction/A2AAslashField.cc \ + Modules/MContraction/Meson.cc \ + Modules/MContraction/A2AFourQuarkContraction.cc \ + Modules/MContraction/WeakMesonDecayKl2.cc \ + Modules/MContraction/WeakNonEye3pt.cc \ + Modules/MScalar/ChargedProp.cc \ + Modules/MScalar/FreeProp.cc \ Modules/MNoise/TimeDilutedSpinColorDiagonal.cc \ + Modules/MNoise/FullVolumeSpinColorDiagonal.cc \ Modules/MUtilities/RandomVectors.cc \ Modules/MUtilities/PrecisionCast.cc \ - Modules/MScalar/FreeProp.cc \ - Modules/MScalar/ChargedProp.cc \ + Modules/MFermion/EMLepton.cc \ + Modules/MFermion/FreeProp.cc \ + Modules/MFermion/GaugeProp.cc \ + Modules/MSolver/RBPrecCG.cc \ + Modules/MSolver/LocalCoherenceLanczos.cc \ + Modules/MSolver/MixedPrecisionRBPrecCG.cc \ + Modules/MSolver/A2AVectors.cc \ + Modules/MSolver/A2AAslashVectors.cc \ Modules/MNPR/Amputate.cc \ Modules/MNPR/Bilinear.cc \ Modules/MNPR/FourQuark.cc \ - Modules/MAction/Wilson.cc \ - Modules/MAction/MobiusDWF.cc \ - Modules/MAction/ZMobiusDWF.cc \ - Modules/MAction/WilsonClover.cc \ - Modules/MAction/DWF.cc \ - Modules/MAction/ScaledDWF.cc \ - Modules/MScalarSUN/TrPhi.cc \ - Modules/MScalarSUN/Grad.cc \ - Modules/MScalarSUN/TrMag.cc \ - Modules/MScalarSUN/TrKinetic.cc \ - Modules/MScalarSUN/EMT.cc \ - Modules/MScalarSUN/TransProj.cc \ - Modules/MScalarSUN/StochFreeField.cc \ - Modules/MScalarSUN/TwoPoint.cc \ - Modules/MScalarSUN/TwoPointNPR.cc \ - Modules/MScalarSUN/Div.cc \ - Modules/MIO/LoadEigenPack.cc \ - Modules/MIO/LoadBinary.cc \ - Modules/MIO/LoadNersc.cc \ - Modules/MIO/LoadCoarseEigenPack.cc \ - Modules/MIO/LoadCosmHol.cc \ - Modules/MIO/LoadA2AVectors.cc + Modules/MGauge/Unit.cc \ + Modules/MGauge/Electrify.cc \ + Modules/MGauge/Random.cc \ + Modules/MGauge/GaugeFix.cc \ + Modules/MGauge/UnitEm.cc \ + Modules/MGauge/StochEm.cc \ + Modules/MGauge/FundtoHirep.cc \ + Modules/MGauge/StoutSmearing.cc modules_hpp =\ - Modules/MContraction/WeakEye3pt.hpp \ - Modules/MContraction/Baryon.hpp \ - Modules/MContraction/A2AAslashField.hpp \ - Modules/MContraction/A2ALoop.hpp \ - Modules/MContraction/A2AMesonField.hpp \ - Modules/MContraction/Meson.hpp \ - Modules/MContraction/DiscLoop.hpp \ - Modules/MContraction/Gamma3pt.hpp \ - Modules/MContraction/WeakMesonDecayKl2.hpp \ - Modules/MContraction/WeakNonEye3pt.hpp \ - Modules/MFermion/FreeProp.hpp \ - Modules/MFermion/GaugeProp.hpp \ - Modules/MFermion/EMLepton.hpp \ + Modules/MSource/Momentum.hpp \ + Modules/MSource/SeqConserved.hpp \ Modules/MSource/SeqGamma.hpp \ Modules/MSource/SeqAslash.hpp \ + Modules/MSource/Z2.hpp \ Modules/MSource/Point.hpp \ Modules/MSource/Wall.hpp \ - Modules/MSource/Z2.hpp \ - Modules/MSource/SeqConserved.hpp \ - Modules/MSource/Momentum.hpp \ Modules/MSink/Smear.hpp \ Modules/MSink/Point.hpp \ - Modules/MSolver/MixedPrecisionRBPrecCG.hpp \ - Modules/MSolver/LocalCoherenceLanczos.hpp \ - Modules/MSolver/A2AAslashVectors.hpp \ - Modules/MSolver/Guesser.hpp \ - Modules/MSolver/RBPrecCG.hpp \ - Modules/MSolver/A2AVectors.hpp \ - Modules/MGauge/UnitEm.hpp \ - Modules/MGauge/StoutSmearing.hpp \ - Modules/MGauge/Unit.hpp \ - Modules/MGauge/Random.hpp \ - Modules/MGauge/GaugeFix.hpp \ - Modules/MGauge/FundtoHirep.hpp \ - Modules/MGauge/StochEm.hpp \ - Modules/MGauge/Electrify.hpp \ - Modules/MNoise/TimeDilutedSpinColorDiagonal.hpp \ - Modules/MNoise/FullVolumeSpinColorDiagonal.hpp \ - Modules/MUtilities/PrecisionCast.hpp \ - Modules/MUtilities/RandomVectors.hpp \ - Modules/MScalar/FreeProp.hpp \ - Modules/MScalar/Scalar.hpp \ - Modules/MScalar/ChargedProp.hpp \ - Modules/MNPR/Bilinear.hpp \ - Modules/MNPR/Amputate.hpp \ - Modules/MNPR/FourQuark.hpp \ - Modules/MAction/DWF.hpp \ - Modules/MAction/MobiusDWF.hpp \ - Modules/MAction/Wilson.hpp \ - Modules/MAction/WilsonClover.hpp \ - Modules/MAction/ZMobiusDWF.hpp \ - Modules/MAction/ScaledDWF.hpp \ - Modules/MScalarSUN/StochFreeField.hpp \ + Modules/MIO/LoadCosmHol.hpp \ + Modules/MIO/LoadBinary.hpp \ + Modules/MIO/LoadA2AMatrixDiskVector.hpp \ + Modules/MIO/LoadEigenPack.hpp \ + Modules/MIO/LoadCoarseEigenPack.hpp \ + Modules/MIO/LoadA2AVectors.hpp \ + Modules/MIO/LoadNersc.hpp \ + Modules/MScalarSUN/Utils.hpp \ + Modules/MScalarSUN/Grad.hpp \ + Modules/MScalarSUN/TrPhi.hpp \ Modules/MScalarSUN/TwoPointNPR.hpp \ + Modules/MScalarSUN/TwoPoint.hpp \ + Modules/MScalarSUN/TransProj.hpp \ + Modules/MScalarSUN/TrKinetic.hpp \ + Modules/MScalarSUN/StochFreeField.hpp \ Modules/MScalarSUN/Div.hpp \ Modules/MScalarSUN/TrMag.hpp \ Modules/MScalarSUN/EMT.hpp \ - Modules/MScalarSUN/TwoPoint.hpp \ - Modules/MScalarSUN/TrPhi.hpp \ - Modules/MScalarSUN/Utils.hpp \ - Modules/MScalarSUN/TransProj.hpp \ - Modules/MScalarSUN/Grad.hpp \ - Modules/MScalarSUN/TrKinetic.hpp \ - Modules/MIO/LoadEigenPack.hpp \ - Modules/MIO/LoadNersc.hpp \ - Modules/MIO/LoadA2AVectors.hpp \ - Modules/MIO/LoadCosmHol.hpp \ - Modules/MIO/LoadCoarseEigenPack.hpp \ - Modules/MIO/LoadBinary.hpp + Modules/MAction/ZMobiusDWF.hpp \ + Modules/MAction/ScaledDWF.hpp \ + Modules/MAction/Wilson.hpp \ + Modules/MAction/WilsonClover.hpp \ + Modules/MAction/MobiusDWF.hpp \ + Modules/MAction/DWF.hpp \ + Modules/MContraction/DiscLoop.hpp \ + Modules/MContraction/WeakEye3pt.hpp \ + Modules/MContraction/Meson.hpp \ + Modules/MContraction/A2AMesonField.hpp \ + Modules/MContraction/Gamma3pt.hpp \ + Modules/MContraction/WeakNonEye3pt.hpp \ + Modules/MContraction/Baryon.hpp \ + Modules/MContraction/A2AFourQuarkContraction.hpp \ + Modules/MContraction/A2ALoop.hpp \ + Modules/MContraction/WeakMesonDecayKl2.hpp \ + Modules/MContraction/A2AAslashField.hpp \ + Modules/MScalar/Scalar.hpp \ + Modules/MScalar/FreeProp.hpp \ + Modules/MScalar/ChargedProp.hpp \ + Modules/MNoise/FullVolumeSpinColorDiagonal.hpp \ + Modules/MNoise/TimeDilutedSpinColorDiagonal.hpp \ + Modules/MUtilities/RandomVectors.hpp \ + Modules/MUtilities/PrecisionCast.hpp \ + Modules/MFermion/FreeProp.hpp \ + Modules/MFermion/EMLepton.hpp \ + Modules/MFermion/GaugeProp.hpp \ + Modules/MSolver/A2AAslashVectors.hpp \ + Modules/MSolver/Guesser.hpp \ + Modules/MSolver/A2AVectors.hpp \ + Modules/MSolver/RBPrecCG.hpp \ + Modules/MSolver/LocalCoherenceLanczos.hpp \ + Modules/MSolver/MixedPrecisionRBPrecCG.hpp \ + Modules/MNPR/FourQuark.hpp \ + Modules/MNPR/Bilinear.hpp \ + Modules/MNPR/Amputate.hpp \ + Modules/MGauge/StoutSmearing.hpp \ + Modules/MGauge/GaugeFix.hpp \ + Modules/MGauge/StochEm.hpp \ + Modules/MGauge/FundtoHirep.hpp \ + Modules/MGauge/Unit.hpp \ + Modules/MGauge/Random.hpp \ + Modules/MGauge/UnitEm.hpp \ + Modules/MGauge/Electrify.hpp