From adcef36189a27c8554acd11ac1f39352db56884b Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 25 Jun 2018 15:58:35 +0100 Subject: [PATCH 1/4] =?UTF-8?q?Hadrons:=20M=C3=B6bius=20DWF=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extras/Hadrons/Modules.hpp | 9 +- extras/Hadrons/Modules/MAction/MobiusDWF.cc | 7 ++ extras/Hadrons/Modules/MAction/MobiusDWF.hpp | 109 ++++++++++++++++++ extras/Hadrons/Modules/MAction/ZMobiusDWF.hpp | 4 +- extras/Hadrons/modules.inc | 14 ++- 5 files changed, 131 insertions(+), 12 deletions(-) create mode 100644 extras/Hadrons/Modules/MAction/MobiusDWF.cc create mode 100644 extras/Hadrons/Modules/MAction/MobiusDWF.hpp diff --git a/extras/Hadrons/Modules.hpp b/extras/Hadrons/Modules.hpp index 502c14af..af4592ea 100644 --- a/extras/Hadrons/Modules.hpp +++ b/extras/Hadrons/Modules.hpp @@ -18,20 +18,21 @@ #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/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 0e44176b..ebf5c9cb 100644 --- a/extras/Hadrons/modules.inc +++ b/extras/Hadrons/modules.inc @@ -27,10 +27,11 @@ 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 \ @@ -72,20 +73,21 @@ modules_hpp =\ Modules/MSink/Point.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 \ From 2e1c66897f1be8de6bdea92b90d0c0630c3f5b9a Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 25 Jun 2018 19:08:22 +0100 Subject: [PATCH 2/4] Hadrons: introduction message --- extras/Hadrons/Application.cc | 24 +++++++++++++++++++++--- extras/Hadrons/Global.hpp | 12 ++++++++---- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/extras/Hadrons/Application.cc b/extras/Hadrons/Application.cc index f409d8eb..c746fa7e 100644 --- a/extras/Hadrons/Application.cc +++ b/extras/Hadrons/Application.cc @@ -51,9 +51,27 @@ 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 (associated C macro)" << std::endl; + LOG(Message) << "ASCII output precision (DEFAULT_ASCII_PREC) : " + << DEFAULT_ASCII_PREC << std::endl; + LOG(Message) << "Fermion implementation (FIMPL) : " + << HADRONS_STR(FIMPL) << std::endl; + LOG(Message) << "Fermion complex implementation (ZFIMPL) : " + << HADRONS_STR(ZFIMPL) << std::endl; + LOG(Message) << "Scalar implementation (SIMPL) : " + << HADRONS_STR(SIMPL) << std::endl; + LOG(Message) << "Gauge implementation (GIMPL) : " + << HADRONS_STR(GIMPL) << std::endl; + LOG(Message) << "Eigenvector base size (HADRONS_DEFAULT_LANCZOS_NBASIS): " + << HADRONS_DEFAULT_LANCZOS_NBASIS << std::endl; + LOG(Message) << "Schur decomposition (HADRONS_DEFAULT_SCHUR) : " + << HADRONS_STR(HADRONS_DEFAULT_SCHUR) << 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 From 049cc518f470fb409b151b7b9f0e293e954311b3 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 25 Jun 2018 19:08:39 +0100 Subject: [PATCH 3/4] Hadrons: introduction message 2 --- extras/Hadrons/Application.cc | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/extras/Hadrons/Application.cc b/extras/Hadrons/Application.cc index c746fa7e..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(); @@ -57,21 +60,16 @@ Application::Application(void) LOG(Message) << "MPI partition : " << mpi << std::endl; LOG(Message) << "Local lattice : " << loc << std::endl; LOG(Message) << std::endl; - LOG(Message) << "** Default parameters (associated C macro)" << std::endl; - LOG(Message) << "ASCII output precision (DEFAULT_ASCII_PREC) : " - << DEFAULT_ASCII_PREC << std::endl; - LOG(Message) << "Fermion implementation (FIMPL) : " - << HADRONS_STR(FIMPL) << std::endl; - LOG(Message) << "Fermion complex implementation (ZFIMPL) : " - << HADRONS_STR(ZFIMPL) << std::endl; - LOG(Message) << "Scalar implementation (SIMPL) : " - << HADRONS_STR(SIMPL) << std::endl; - LOG(Message) << "Gauge implementation (GIMPL) : " - << HADRONS_STR(GIMPL) << std::endl; - LOG(Message) << "Eigenvector base size (HADRONS_DEFAULT_LANCZOS_NBASIS): " - << HADRONS_DEFAULT_LANCZOS_NBASIS << std::endl; - LOG(Message) << "Schur decomposition (HADRONS_DEFAULT_SCHUR) : " - << HADRONS_STR(HADRONS_DEFAULT_SCHUR) << 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) From d2c42e6f4200f0f0efd524c448a9a6b2e515403c Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Tue, 26 Jun 2018 14:59:33 +0100 Subject: [PATCH 4/4] Hadrons: scaled DWF action --- extras/Hadrons/Modules.hpp | 1 + extras/Hadrons/Modules/MAction/ScaledDWF.cc | 7 ++ extras/Hadrons/Modules/MAction/ScaledDWF.hpp | 108 +++++++++++++++++++ extras/Hadrons/modules.inc | 2 + 4 files changed, 118 insertions(+) create mode 100644 extras/Hadrons/Modules/MAction/ScaledDWF.cc create mode 100644 extras/Hadrons/Modules/MAction/ScaledDWF.hpp diff --git a/extras/Hadrons/Modules.hpp b/extras/Hadrons/Modules.hpp index af4592ea..f882d86c 100644 --- a/extras/Hadrons/Modules.hpp +++ b/extras/Hadrons/Modules.hpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include 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.inc b/extras/Hadrons/modules.inc index ebf5c9cb..37477d79 100644 --- a/extras/Hadrons/modules.inc +++ b/extras/Hadrons/modules.inc @@ -35,6 +35,7 @@ modules_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 \ @@ -91,6 +92,7 @@ modules_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 \