diff --git a/extras/Hadrons/Application.cc b/extras/Hadrons/Application.cc index f409d8eb..0490c222 100644 --- a/extras/Hadrons/Application.cc +++ b/extras/Hadrons/Application.cc @@ -41,6 +41,9 @@ using namespace Hadrons; * Application implementation * ******************************************************************************/ // constructors //////////////////////////////////////////////////////////////// +#define MACOUT(macro) macro << " (" << #macro << ")" +#define MACOUTS(macro) HADRONS_STR(macro) << " (" << #macro << ")" + Application::Application(void) { initLogger(); @@ -51,9 +54,22 @@ Application::Application(void) loc[d] /= mpi[d]; locVol_ *= loc[d]; } - LOG(Message) << "Global lattice: " << dim << std::endl; - LOG(Message) << "MPI partition : " << mpi << std::endl; - LOG(Message) << "Local lattice : " << loc << std::endl; + LOG(Message) << "====== HADRONS APPLICATION STARTING ======" << std::endl; + LOG(Message) << "** Dimensions" << std::endl; + LOG(Message) << "Global lattice : " << dim << std::endl; + LOG(Message) << "MPI partition : " << mpi << std::endl; + LOG(Message) << "Local lattice : " << loc << std::endl; + LOG(Message) << std::endl; + LOG(Message) << "** Default parameters (and associated C macro)" << std::endl; + LOG(Message) << "ASCII output precision : " << MACOUT(DEFAULT_ASCII_PREC) << std::endl; + LOG(Message) << "Fermion implementation : " << MACOUTS(FIMPL) << std::endl; + LOG(Message) << "z-Fermion implementation: " << MACOUTS(ZFIMPL) << std::endl; + LOG(Message) << "Scalar implementation : " << MACOUTS(SIMPL) << std::endl; + LOG(Message) << "Gauge implementation : " << MACOUTS(GIMPL) << std::endl; + LOG(Message) << "Eigenvector base size : " + << MACOUT(HADRONS_DEFAULT_LANCZOS_NBASIS) << std::endl; + LOG(Message) << "Schur decomposition : " << MACOUTS(HADRONS_DEFAULT_SCHUR) << std::endl; + LOG(Message) << std::endl; } Application::Application(const Application::GlobalPar &par) diff --git a/extras/Hadrons/Global.hpp b/extras/Hadrons/Global.hpp index bae34a8d..fdacb799 100644 --- a/extras/Hadrons/Global.hpp +++ b/extras/Hadrons/Global.hpp @@ -43,6 +43,10 @@ See the full license in the file "LICENSE" in the top level distribution directo #define DEFAULT_ASCII_PREC 16 #endif +/* the 'using Grid::operator<<;' statement prevents a very nasty compilation + * error with GCC 5 (clang & GCC 6 compile fine without it). + */ + #define BEGIN_HADRONS_NAMESPACE \ namespace Grid {\ using namespace QCD;\ @@ -58,10 +62,6 @@ using Grid::operator>>; #define END_MODULE_NAMESPACE } -/* the 'using Grid::operator<<;' statement prevents a very nasty compilation - * error with GCC 5 (clang & GCC 6 compile fine without it). - */ - #ifndef FIMPL #define FIMPL WilsonImplR #endif @@ -207,6 +207,10 @@ void makeFileDir(const std::string filename, GridBase *g); #define HADRONS_SCHUR_SOLVE(conv) _HADRONS_SCHUR_SOLVE_(conv) #define HADRONS_DEFAULT_SCHUR_SOLVE HADRONS_SCHUR_SOLVE(HADRONS_DEFAULT_SCHUR) +// stringify macro +#define _HADRONS_STR(x) #x +#define HADRONS_STR(x) _HADRONS_STR(x) + END_HADRONS_NAMESPACE #include diff --git a/extras/Hadrons/Modules.hpp b/extras/Hadrons/Modules.hpp index e70291f3..3a98ec49 100644 --- a/extras/Hadrons/Modules.hpp +++ b/extras/Hadrons/Modules.hpp @@ -20,23 +20,25 @@ #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/extras/Hadrons/Modules/MAction/MobiusDWF.cc b/extras/Hadrons/Modules/MAction/MobiusDWF.cc new file mode 100644 index 00000000..8c138bca --- /dev/null +++ b/extras/Hadrons/Modules/MAction/MobiusDWF.cc @@ -0,0 +1,7 @@ +#include + +using namespace Grid; +using namespace Hadrons; +using namespace MAction; + +template class Grid::Hadrons::MAction::TMobiusDWF; diff --git a/extras/Hadrons/Modules/MAction/MobiusDWF.hpp b/extras/Hadrons/Modules/MAction/MobiusDWF.hpp new file mode 100644 index 00000000..a026a864 --- /dev/null +++ b/extras/Hadrons/Modules/MAction/MobiusDWF.hpp @@ -0,0 +1,109 @@ +#ifndef Hadrons_MAction_MobiusDWF_hpp_ +#define Hadrons_MAction_MobiusDWF_hpp_ + +#include +#include +#include + +BEGIN_HADRONS_NAMESPACE + +/****************************************************************************** + * Mobius domain-wall fermion action * + ******************************************************************************/ +BEGIN_MODULE_NAMESPACE(MAction) + +class MobiusDWFPar: Serializable +{ +public: + GRID_SERIALIZABLE_CLASS_MEMBERS(MobiusDWFPar, + std::string , gauge, + unsigned int, Ls, + double , mass, + double , M5, + double , b, + double , c, + std::string , boundary); +}; + +template +class TMobiusDWF: public Module +{ +public: + FG_TYPE_ALIASES(FImpl,); +public: + // constructor + TMobiusDWF(const std::string name); + // destructor + virtual ~TMobiusDWF(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(MobiusDWF, TMobiusDWF, MAction); + +/****************************************************************************** + * TMobiusDWF implementation * + ******************************************************************************/ +// constructor ///////////////////////////////////////////////////////////////// +template +TMobiusDWF::TMobiusDWF(const std::string name) +: Module(name) +{} + +// dependencies/products /////////////////////////////////////////////////////// +template +std::vector TMobiusDWF::getInput(void) +{ + std::vector in = {par().gauge}; + + return in; +} + +template +std::vector TMobiusDWF::getOutput(void) +{ + std::vector out = {getName()}; + + return out; +} + +// setup /////////////////////////////////////////////////////////////////////// +template +void TMobiusDWF::setup(void) +{ + LOG(Message) << "Setting up Mobius domain wall fermion matrix with m= " + << par().mass << ", M5= " << par().M5 << ", Ls= " << par().Ls + << ", b= " << par().b << ", c= " << par().c + << " using gauge field '" << par().gauge << "'" + << std::endl; + LOG(Message) << "Fermion boundary conditions: " << par().boundary + << std::endl; + + env().createGrid(par().Ls); + auto &U = envGet(LatticeGaugeField, par().gauge); + auto &g4 = *env().getGrid(); + auto &grb4 = *env().getRbGrid(); + auto &g5 = *env().getGrid(par().Ls); + auto &grb5 = *env().getRbGrid(par().Ls); + std::vector boundary = strToVec(par().boundary); + typename MobiusFermion::ImplParams implParams(boundary); + envCreateDerived(FMat, MobiusFermion, getName(), par().Ls, U, g5, + grb5, g4, grb4, par().mass, par().M5, par().b, par().c, + implParams); +} + +// execution /////////////////////////////////////////////////////////////////// +template +void TMobiusDWF::execute(void) +{} + +END_MODULE_NAMESPACE + +END_HADRONS_NAMESPACE + +#endif // Hadrons_MAction_MobiusDWF_hpp_ diff --git a/extras/Hadrons/Modules/MAction/ScaledDWF.cc b/extras/Hadrons/Modules/MAction/ScaledDWF.cc new file mode 100644 index 00000000..19e7cf4c --- /dev/null +++ b/extras/Hadrons/Modules/MAction/ScaledDWF.cc @@ -0,0 +1,7 @@ +#include + +using namespace Grid; +using namespace Hadrons; +using namespace MAction; + +template class Grid::Hadrons::MAction::TScaledDWF; diff --git a/extras/Hadrons/Modules/MAction/ScaledDWF.hpp b/extras/Hadrons/Modules/MAction/ScaledDWF.hpp new file mode 100644 index 00000000..78127f6f --- /dev/null +++ b/extras/Hadrons/Modules/MAction/ScaledDWF.hpp @@ -0,0 +1,108 @@ +#ifndef Hadrons_MAction_ScaledDWF_hpp_ +#define Hadrons_MAction_ScaledDWF_hpp_ + +#include +#include +#include + +BEGIN_HADRONS_NAMESPACE + +/****************************************************************************** + * Scaled domain wall fermion * + ******************************************************************************/ +BEGIN_MODULE_NAMESPACE(MAction) + +class ScaledDWFPar: Serializable +{ +public: + GRID_SERIALIZABLE_CLASS_MEMBERS(ScaledDWFPar, + std::string , gauge, + unsigned int, Ls, + double , mass, + double , M5, + double , scale, + std::string , boundary); +}; + +template +class TScaledDWF: public Module +{ +public: + FG_TYPE_ALIASES(FImpl,); +public: + // constructor + TScaledDWF(const std::string name); + // destructor + virtual ~TScaledDWF(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(ScaledDWF, TScaledDWF, MAction); + +/****************************************************************************** + * TScaledDWF implementation * + ******************************************************************************/ +// constructor ///////////////////////////////////////////////////////////////// +template +TScaledDWF::TScaledDWF(const std::string name) +: Module(name) +{} + +// dependencies/products /////////////////////////////////////////////////////// +template +std::vector TScaledDWF::getInput(void) +{ + std::vector in = {par().gauge}; + + return in; +} + +template +std::vector TScaledDWF::getOutput(void) +{ + std::vector out = {getName()}; + + return out; +} + +// setup /////////////////////////////////////////////////////////////////////// +template +void TScaledDWF::setup(void) +{ + LOG(Message) << "Setting up scaled domain wall fermion matrix with m= " + << par().mass << ", M5= " << par().M5 << ", Ls= " << par().Ls + << ", scale= " << par().scale + << " using gauge field '" << par().gauge << "'" + << std::endl; + LOG(Message) << "Fermion boundary conditions: " << par().boundary + << std::endl; + + env().createGrid(par().Ls); + auto &U = envGet(LatticeGaugeField, par().gauge); + auto &g4 = *env().getGrid(); + auto &grb4 = *env().getRbGrid(); + auto &g5 = *env().getGrid(par().Ls); + auto &grb5 = *env().getRbGrid(par().Ls); + std::vector boundary = strToVec(par().boundary); + typename MobiusFermion::ImplParams implParams(boundary); + envCreateDerived(FMat, ScaledShamirFermion, getName(), par().Ls, U, g5, + grb5, g4, grb4, par().mass, par().M5, par().scale, + implParams); +} + +// execution /////////////////////////////////////////////////////////////////// +template +void TScaledDWF::execute(void) +{} + +END_MODULE_NAMESPACE + +END_HADRONS_NAMESPACE + +#endif // Hadrons_MAction_ScaledDWF_hpp_ diff --git a/extras/Hadrons/Modules/MAction/ZMobiusDWF.hpp b/extras/Hadrons/Modules/MAction/ZMobiusDWF.hpp index 88e4e85c..4a275dd0 100644 --- a/extras/Hadrons/Modules/MAction/ZMobiusDWF.hpp +++ b/extras/Hadrons/Modules/MAction/ZMobiusDWF.hpp @@ -35,7 +35,7 @@ See the full license in the file "LICENSE" in the top level distribution directo BEGIN_HADRONS_NAMESPACE /****************************************************************************** - * ZMobiusDWF * + * z-Mobius domain-wall fermion action * ******************************************************************************/ BEGIN_MODULE_NAMESPACE(MAction) @@ -75,7 +75,7 @@ public: MODULE_REGISTER_TMP(ZMobiusDWF, TZMobiusDWF, MAction); /****************************************************************************** - * TZMobiusDWF implementation * + * TZMobiusDWF implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// template diff --git a/extras/Hadrons/modules.inc b/extras/Hadrons/modules.inc index 31c08804..a0adfbf4 100644 --- a/extras/Hadrons/modules.inc +++ b/extras/Hadrons/modules.inc @@ -29,13 +29,15 @@ modules_cc =\ Modules/MUtilities/TestSeqConserved.cc \ Modules/MLoop/NoiseLoop.cc \ Modules/MScalar/FreeProp.cc \ + Modules/MScalar/VPCounterTerms.cc \ Modules/MScalar/ChargedProp.cc \ Modules/MScalar/ScalarVP.cc \ - Modules/MScalar/VPCounterTerms.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/TimeMomProbe.cc \ @@ -76,23 +78,25 @@ modules_hpp =\ Modules/MSolver/A2AVectors.hpp \ Modules/MSolver/LocalCoherenceLanczos.hpp \ Modules/MSolver/RBPrecCG.hpp \ + Modules/MGauge/UnitEm.hpp \ + Modules/MGauge/Unit.hpp \ Modules/MGauge/Random.hpp \ Modules/MGauge/FundtoHirep.hpp \ Modules/MGauge/StochEm.hpp \ - Modules/MGauge/Unit.hpp \ - Modules/MGauge/UnitEm.hpp \ Modules/MUtilities/TestSeqGamma.hpp \ Modules/MUtilities/TestSeqConserved.hpp \ Modules/MLoop/NoiseLoop.hpp \ - Modules/MScalar/ChargedProp.hpp \ Modules/MScalar/FreeProp.hpp \ - Modules/MScalar/Scalar.hpp \ - Modules/MScalar/ScalarVP.hpp \ Modules/MScalar/VPCounterTerms.hpp \ + Modules/MScalar/ScalarVP.hpp \ + Modules/MScalar/Scalar.hpp \ + Modules/MScalar/ChargedProp.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/MScalarSUN/TwoPointNPR.hpp \ Modules/MScalarSUN/ShiftProbe.hpp \