1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-11 22:50:45 +01:00

Hadrons: A2AAslashVector modul cleaning and renaming

This commit is contained in:
Antonin Portelli 2018-11-22 19:43:49 +00:00
parent 09451b5e48
commit e232257cb6
4 changed files with 59 additions and 54 deletions

View File

@ -24,7 +24,7 @@
#include <Hadrons/Modules/MSolver/Guesser.hpp> #include <Hadrons/Modules/MSolver/Guesser.hpp>
#include <Hadrons/Modules/MSolver/RBPrecCG.hpp> #include <Hadrons/Modules/MSolver/RBPrecCG.hpp>
#include <Hadrons/Modules/MSolver/A2AVectors.hpp> #include <Hadrons/Modules/MSolver/A2AVectors.hpp>
#include <Hadrons/Modules/MSolver/A2AAslashVector.hpp> #include <Hadrons/Modules/MSolver/A2AAslashVectors.hpp>
#include <Hadrons/Modules/MGauge/UnitEm.hpp> #include <Hadrons/Modules/MGauge/UnitEm.hpp>
#include <Hadrons/Modules/MGauge/StoutSmearing.hpp> #include <Hadrons/Modules/MGauge/StoutSmearing.hpp>
#include <Hadrons/Modules/MGauge/Unit.hpp> #include <Hadrons/Modules/MGauge/Unit.hpp>

View File

@ -2,7 +2,7 @@
Grid physics library, www.github.com/paboyle/Grid Grid physics library, www.github.com/paboyle/Grid
Source file: Hadrons/Modules/MSolver/A2AAslashVector.cc Source file: Hadrons/Modules/MSolver/A2AAslashVectors.cc
Copyright (C) 2015-2018 Copyright (C) 2015-2018
@ -25,11 +25,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
See the full license in the file "LICENSE" in the top level distribution directory See the full license in the file "LICENSE" in the top level distribution directory
*************************************************************************************/ *************************************************************************************/
/* END LEGAL */ /* END LEGAL */
#include <Hadrons/Modules/MSolver/A2AAslashVector.hpp> #include <Hadrons/Modules/MSolver/A2AAslashVectors.hpp>
using namespace Grid; using namespace Grid;
using namespace Hadrons; using namespace Hadrons;
using namespace MSolver; using namespace MSolver;
template class Grid::Hadrons::MSolver::TA2AAslashVector<FIMPL>; template class Grid::Hadrons::MSolver::TA2AAslashVectors<FIMPL>;
template class Grid::Hadrons::MSolver::TA2AAslashVector<ZFIMPL>; template class Grid::Hadrons::MSolver::TA2AAslashVectors<ZFIMPL>;

View File

@ -2,7 +2,7 @@
Grid physics library, www.github.com/paboyle/Grid Grid physics library, www.github.com/paboyle/Grid
Source file: Hadrons/Modules/MSolver/A2AAslashVector.hpp Source file: Hadrons/Modules/MSolver/A2AAslashVectors.hpp
Copyright (C) 2015-2018 Copyright (C) 2015-2018
@ -25,13 +25,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
See the full license in the file "LICENSE" in the top level distribution directory See the full license in the file "LICENSE" in the top level distribution directory
*************************************************************************************/ *************************************************************************************/
/* END LEGAL */ /* END LEGAL */
#ifndef Hadrons_MSolver_A2AAslashVector_hpp_ #ifndef Hadrons_MSolver_A2AAslashVectors_hpp_
#define Hadrons_MSolver_A2AAslashVector_hpp_ #define Hadrons_MSolver_A2AAslashVectors_hpp_
#include <Hadrons/Global.hpp> #include <Hadrons/Global.hpp>
#include <Hadrons/Module.hpp> #include <Hadrons/Module.hpp>
#include <Hadrons/ModuleFactory.hpp> #include <Hadrons/ModuleFactory.hpp>
#include <Hadrons/Solver.hpp> #include <Hadrons/Solver.hpp>
#include <Hadrons/A2AVectors.hpp>
BEGIN_HADRONS_NAMESPACE BEGIN_HADRONS_NAMESPACE
@ -54,29 +55,30 @@ BEGIN_MODULE_NAMESPACE(MSolver)
* *
*****************************************************************************/ *****************************************************************************/
class A2AAslashVectorsPar: Serializable
class A2AAslashVectorPar: Serializable
{ {
public: public:
GRID_SERIALIZABLE_CLASS_MEMBERS(A2AAslashVectorPar, GRID_SERIALIZABLE_CLASS_MEMBERS(A2AAslashVectorsPar,
std::string, vector, std::string, vector,
std::string, emField, std::string, emField,
std::string, solver); std::string, solver,
std::string, output,
bool, multiFile);
}; };
template <typename FImpl> template <typename FImpl>
class TA2AAslashVector : public Module<A2AAslashVectorPar> class TA2AAslashVectors : public Module<A2AAslashVectorsPar>
{ {
public: public:
FERM_TYPE_ALIASES(FImpl,); FERM_TYPE_ALIASES(FImpl,);
SOLVER_TYPE_ALIASES(FImpl,); SOLVER_TYPE_ALIASES(FImpl,);
public: public:
typedef PhotonR::GaugeField EmField; typedef PhotonR::GaugeField EmField;
public: public:
// constructor // constructor
TA2AAslashVector(const std::string name); TA2AAslashVectors(const std::string name);
// destructor // destructor
virtual ~TA2AAslashVector(void) {}; virtual ~TA2AAslashVectors(void) {};
// dependency relation // dependency relation
virtual std::vector<std::string> getInput(void); virtual std::vector<std::string> getInput(void);
virtual std::vector<std::string> getOutput(void); virtual std::vector<std::string> getOutput(void);
@ -88,21 +90,21 @@ private:
unsigned int Ls_; unsigned int Ls_;
}; };
MODULE_REGISTER_TMP(A2AAslashVector,TA2AAslashVector<FIMPL>, MSolver); MODULE_REGISTER_TMP(A2AAslashVectors, TA2AAslashVectors<FIMPL>, MSolver);
MODULE_REGISTER_TMP(ZA2AAslashVector,TA2AAslashVector<ZFIMPL>, MSolver); MODULE_REGISTER_TMP(ZA2AAslashVectors, TA2AAslashVectors<ZFIMPL>, MSolver);
/****************************************************************************** /******************************************************************************
* TA2AAslashVector implementation * * TA2AAslashVectors implementation *
******************************************************************************/ ******************************************************************************/
// constructor ///////////////////////////////////////////////////////////////// // constructor /////////////////////////////////////////////////////////////////
template <typename FImpl> template <typename FImpl>
TA2AAslashVector<FImpl>::TA2AAslashVector(const std::string name) TA2AAslashVectors<FImpl>::TA2AAslashVectors(const std::string name)
: Module<A2AAslashVectorPar>(name) : Module<A2AAslashVectorsPar>(name)
{} {}
// dependencies/products /////////////////////////////////////////////////////// // dependencies/products ///////////////////////////////////////////////////////
template <typename FImpl> template <typename FImpl>
std::vector<std::string> TA2AAslashVector<FImpl>::getInput(void) std::vector<std::string> TA2AAslashVectors<FImpl>::getInput(void)
{ {
std::vector<std::string> in = {par().vector, par().emField, par().solver}; std::vector<std::string> in = {par().vector, par().emField, par().solver};
@ -110,7 +112,7 @@ std::vector<std::string> TA2AAslashVector<FImpl>::getInput(void)
} }
template <typename FImpl> template <typename FImpl>
std::vector<std::string> TA2AAslashVector<FImpl>::getOutput(void) std::vector<std::string> TA2AAslashVectors<FImpl>::getOutput(void)
{ {
std::vector<std::string> out = {getName()}; std::vector<std::string> out = {getName()};
@ -119,7 +121,7 @@ std::vector<std::string> TA2AAslashVector<FImpl>::getOutput(void)
// setup /////////////////////////////////////////////////////////////////////// // setup ///////////////////////////////////////////////////////////////////////
template <typename FImpl> template <typename FImpl>
void TA2AAslashVector<FImpl>::setup(void) void TA2AAslashVectors<FImpl>::setup(void)
{ {
Ls_ = env().getObjectLs(par().solver); Ls_ = env().getObjectLs(par().solver);
auto &vvector = envGet(std::vector<FermionField>, par().vector); auto &vvector = envGet(std::vector<FermionField>, par().vector);
@ -134,7 +136,7 @@ void TA2AAslashVector<FImpl>::setup(void)
// execution /////////////////////////////////////////////////////////////////// // execution ///////////////////////////////////////////////////////////////////
template <typename FImpl> template <typename FImpl>
void TA2AAslashVector<FImpl>::execute(void) void TA2AAslashVectors<FImpl>::execute(void)
{ {
auto &solver = envGet(Solver, par().solver); auto &solver = envGet(Solver, par().solver);
auto &stoch_photon = envGet(EmField, par().emField); auto &stoch_photon = envGet(EmField, par().emField);
@ -148,42 +150,45 @@ void TA2AAslashVector<FImpl>::execute(void)
Complex ci(0.0,1.0); Complex ci(0.0,1.0);
startTimer("Seq Aslash"); startTimer("Seq Aslash");
LOG(Message) << "Calculate Sequential propagator on Aslash * v with the A2A vector "
LOG(Message) << "Calculate Sequential propagator on Aslash * v with the A2A vector " << par().vector << par().vector << " and the photon field " << par().emField << std::endl;
<< " and the photon field " << par().emField << std::endl;
for(unsigned int i=0; i<Nmodes; i++) for(unsigned int i=0; i<Nmodes; i++)
{ {
v4dtmp = zero; v4dtmp = zero;
startTimer("Multiply Aslash"); startTimer("Multiply Aslash");
for(unsigned int mu=0;mu<=3;mu++) for(unsigned int mu=0;mu<=3;mu++)
{ {
Gamma gmu(Gamma::gmu[mu]); Gamma gmu(Gamma::gmu[mu]);
v4dtmp += ci * PeekIndex<LorentzIndex>(stoch_photon, mu) * (gmu * vvector[i]); v4dtmp += ci * PeekIndex<LorentzIndex>(stoch_photon, mu) * (gmu * vvector[i]);
} }
stopTimer("Multiply Aslash"); stopTimer("Multiply Aslash");
if (Ls_ == 1) startTimer("Inversion");
{ if (Ls_ == 1)
solver(Aslashv[i], v4dtmp); {
} solver(Aslashv[i], v4dtmp);
else }
{ else
mat.ImportPhysicalFermionSource(v4dtmp, v5dtmp); {
solver(v5dtmp_sol, v5dtmp); mat.ImportPhysicalFermionSource(v4dtmp, v5dtmp);
mat.ExportPhysicalFermionSolution(v5dtmp_sol, v4dtmp); solver(v5dtmp_sol, v5dtmp);
Aslashv[i] = v4dtmp; mat.ExportPhysicalFermionSolution(v5dtmp_sol, v4dtmp);
} Aslashv[i] = v4dtmp;
}
stopTimer("Inversion");
} }
stopTimer("Seq Aslash"); stopTimer("Seq Aslash");
if (!par().output.empty())
{
startTimer("I/O");
A2AVectorsIo::write(par().output, Aslashv, par().multiFile, vm().getTrajectory());
stopTimer("I/O");
}
} }
END_MODULE_NAMESPACE END_MODULE_NAMESPACE
END_HADRONS_NAMESPACE END_HADRONS_NAMESPACE
#endif // Hadrons_MSolver_A2AAslashVector_hpp_ #endif // Hadrons_MSolver_A2AAslashVectors_hpp_

View File

@ -20,7 +20,7 @@ modules_cc =\
Modules/MSink/Point.cc \ Modules/MSink/Point.cc \
Modules/MSink/Smear.cc \ Modules/MSink/Smear.cc \
Modules/MSolver/A2AVectors.cc \ Modules/MSolver/A2AVectors.cc \
Modules/MSolver/A2AAslashVector.cc \ Modules/MSolver/A2AAslashVectors.cc \
Modules/MSolver/RBPrecCG.cc \ Modules/MSolver/RBPrecCG.cc \
Modules/MSolver/MixedPrecisionRBPrecCG.cc \ Modules/MSolver/MixedPrecisionRBPrecCG.cc \
Modules/MSolver/LocalCoherenceLanczos.cc \ Modules/MSolver/LocalCoherenceLanczos.cc \
@ -97,7 +97,7 @@ modules_hpp =\
Modules/MSolver/Guesser.hpp \ Modules/MSolver/Guesser.hpp \
Modules/MSolver/RBPrecCG.hpp \ Modules/MSolver/RBPrecCG.hpp \
Modules/MSolver/A2AVectors.hpp \ Modules/MSolver/A2AVectors.hpp \
Modules/MSolver/A2AAslashVector.hpp \ Modules/MSolver/A2AAslashVectors.hpp \
Modules/MGauge/UnitEm.hpp \ Modules/MGauge/UnitEm.hpp \
Modules/MGauge/StoutSmearing.hpp \ Modules/MGauge/StoutSmearing.hpp \
Modules/MGauge/Unit.hpp \ Modules/MGauge/Unit.hpp \