1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-07-22 07:37:07 +01:00

Merge branch 'develop' into feature/gpu-port

This commit is contained in:
Peter Boyle
2018-12-13 05:11:34 +00:00
647 changed files with 49155 additions and 11160 deletions

View File

@@ -0,0 +1,504 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/qcd/modules/ActionModules.h
Copyright (C) 2016
Author: Guido Cossu <guido.cossu@ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution
directory
*************************************************************************************/
/* END LEGAL */
#ifndef ACTION_MODULES_H
#define ACTION_MODULES_H
/*
Define loadable, serializable modules
for the HMC execution
*/
NAMESPACE_BEGIN(Grid);
//////////////////////////////////////////////
// Actions
//////////////////////////////////////////////
template <class Product, class R>
class ActionModuleBase: public HMCModuleBase<Product>{
public:
typedef R Resource;
virtual void acquireResource(R& ){};
};
template <class ActionType, class APar>
class ActionModule
: public Parametrized<APar>,
public ActionModuleBase< Action<typename ActionType::GaugeField> , GridModule > {
public:
typedef ActionModuleBase< Action<typename ActionType::GaugeField>, GridModule > Base;
typedef typename Base::Product Product;
typedef APar Parameters;
std::unique_ptr<ActionType> ActionPtr;
ActionModule(APar Par) : Parametrized<APar>(Par) {}
template <class ReaderClass>
ActionModule(Reader<ReaderClass>& Reader) : Parametrized<APar>(Reader){};
virtual void print_parameters(){
Parametrized<APar>::print_parameters();
}
Product* getPtr() {
if (!ActionPtr) initialize();
return ActionPtr.get();
}
private:
virtual void initialize() = 0;
};
//////////////////////////
// Modules
//////////////////////////
class PlaqPlusRectangleGaugeActionParameters : Serializable {
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(PlaqPlusRectangleGaugeActionParameters,
RealD, c_plaq,
RealD, c_rect);
};
class RBCGaugeActionParameters : Serializable {
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(RBCGaugeActionParameters,
RealD, beta,
RealD, c1);
};
class BetaGaugeActionParameters : Serializable {
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(BetaGaugeActionParameters,
RealD, beta);
};
template <class Impl >
class WilsonGModule: public ActionModule<WilsonGaugeAction<Impl>, BetaGaugeActionParameters> {
typedef ActionModule<WilsonGaugeAction<Impl>, BetaGaugeActionParameters> ActionBase;
using ActionBase::ActionBase; // for constructors
// acquire resource
virtual void initialize(){
this->ActionPtr.reset(new WilsonGaugeAction<Impl>(this->Par_.beta));
}
};
template <class Impl >
class PlaqPlusRectangleGModule: public ActionModule<PlaqPlusRectangleAction<Impl>, PlaqPlusRectangleGaugeActionParameters> {
typedef ActionModule<PlaqPlusRectangleAction<Impl>, PlaqPlusRectangleGaugeActionParameters> ActionBase;
using ActionBase::ActionBase; // for constructors
// acquire resource
virtual void initialize(){
this->ActionPtr.reset(new PlaqPlusRectangleAction<Impl>(this->Par_.c_plaq, this->Par_.c_rect));
}
};
template <class Impl >
class RBCGModule: public ActionModule<RBCGaugeAction<Impl>, RBCGaugeActionParameters> {
typedef ActionModule<RBCGaugeAction<Impl>, RBCGaugeActionParameters> ActionBase;
using ActionBase::ActionBase; // for constructors
// acquire resource
virtual void initialize(){
this->ActionPtr.reset(new RBCGaugeAction<Impl>(this->Par_.beta, this->Par_.c1));
}
};
template <class Impl >
class SymanzikGModule: public ActionModule<SymanzikGaugeAction<Impl>, BetaGaugeActionParameters> {
typedef ActionModule<SymanzikGaugeAction<Impl>, BetaGaugeActionParameters> ActionBase;
using ActionBase::ActionBase; // for constructors
// acquire resource
virtual void initialize(){
this->ActionPtr.reset(new SymanzikGaugeAction<Impl>(this->Par_.beta));
}
};
template <class Impl >
class IwasakiGModule: public ActionModule<IwasakiGaugeAction<Impl>, BetaGaugeActionParameters> {
typedef ActionModule<IwasakiGaugeAction<Impl>, BetaGaugeActionParameters> ActionBase;
using ActionBase::ActionBase; // for constructors
// acquire resource
virtual void initialize(){
this->ActionPtr.reset(new IwasakiGaugeAction<Impl>(this->Par_.beta));
}
};
template <class Impl >
class DBW2GModule: public ActionModule<DBW2GaugeAction<Impl>, BetaGaugeActionParameters> {
typedef ActionModule<DBW2GaugeAction<Impl>, BetaGaugeActionParameters> ActionBase;
using ActionBase::ActionBase; // for constructors
// acquire resource
virtual void initialize(){
this->ActionPtr.reset(new DBW2GaugeAction<Impl>(this->Par_.beta));
}
};
/////////////////////////////////////////
// Fermion Actions
/////////////////////////////////////////
template <class Impl, template <typename> class FermionA, class Params = NoParameters >
class PseudoFermionModuleBase: public ActionModule<FermionA<Impl>, Params> {
protected:
typedef ActionModule<FermionA<Impl>, Params> ActionBase;
using ActionBase::ActionBase; // for constructors
typedef std::unique_ptr<FermionOperatorModuleBase<FermionOperator<Impl>> > operator_type;
typedef std::unique_ptr<HMCModuleBase<OperatorFunction<typename Impl::FermionField> > > solver_type;
template <class ReaderClass>
void getFermionOperator(Reader<ReaderClass>& Reader, operator_type &fo, std::string section_name){
auto &FOFactory = HMC_FermionOperatorModuleFactory<fermionop_string, Impl, ReaderClass>::getInstance();
Reader.push(section_name);
std::string op_name;
read(Reader,"name", op_name);
fo = FOFactory.create(op_name, Reader);
Reader.pop();
}
template <class ReaderClass>
void getSolverOperator(Reader<ReaderClass>& Reader, solver_type &so, std::string section_name){
auto& SolverFactory = HMC_SolverModuleFactory<solver_string, typename Impl::FermionField, ReaderClass>::getInstance();
Reader.push(section_name);
std::string solv_name;
read(Reader,"name", solv_name);
so = SolverFactory.create(solv_name, Reader);
Reader.pop();
}
};
template <class Impl >
class TwoFlavourFModule: public PseudoFermionModuleBase<Impl, TwoFlavourPseudoFermionAction>{
typedef PseudoFermionModuleBase<Impl, TwoFlavourPseudoFermionAction> Base;
using Base::Base;
typename Base::operator_type fop_mod;
typename Base::solver_type solver_mod;
public:
virtual void acquireResource(typename Base::Resource& GridMod){
fop_mod->AddGridPair(GridMod);
}
// constructor
template <class ReaderClass>
TwoFlavourFModule(Reader<ReaderClass>& R): Base(R) {
this->getSolverOperator(R, solver_mod, "Solver");
this->getFermionOperator(R, fop_mod, "Operator");
}
// acquire resource
virtual void initialize() {
// here temporarily assuming that the force and action solver are the same
this->ActionPtr.reset(new TwoFlavourPseudoFermionAction<Impl>(*(this->fop_mod->getPtr()), *(this->solver_mod->getPtr()), *(this->solver_mod->getPtr())));
}
};
// very similar, I could have templated this but it is overkilling
template <class Impl >
class TwoFlavourEOFModule: public PseudoFermionModuleBase<Impl, TwoFlavourEvenOddPseudoFermionAction>{
typedef PseudoFermionModuleBase<Impl, TwoFlavourEvenOddPseudoFermionAction> Base;
using Base::Base;
typename Base::operator_type fop_mod;
typename Base::solver_type solver_mod;
public:
virtual void acquireResource(typename Base::Resource& GridMod){
fop_mod->AddGridPair(GridMod);
}
// constructor
template <class ReaderClass>
TwoFlavourEOFModule(Reader<ReaderClass>& R): PseudoFermionModuleBase<Impl, TwoFlavourEvenOddPseudoFermionAction>(R) {
this->getSolverOperator(R, solver_mod, "Solver");
this->getFermionOperator(R, fop_mod, "Operator");
}
// acquire resource
virtual void initialize() {
// here temporarily assuming that the force and action solver are the same
this->ActionPtr.reset(new TwoFlavourEvenOddPseudoFermionAction<Impl>(*(this->fop_mod->getPtr()), *(this->solver_mod->getPtr()), *(this->solver_mod->getPtr())));
}
};
template <class Impl >
class TwoFlavourRatioFModule: public PseudoFermionModuleBase<Impl, TwoFlavourRatioPseudoFermionAction>{
typedef PseudoFermionModuleBase<Impl, TwoFlavourRatioPseudoFermionAction> Base;
using Base::Base;
typename Base::operator_type fop_numerator_mod;
typename Base::operator_type fop_denominator_mod;
typename Base::solver_type solver_mod;
public:
virtual void acquireResource(typename Base::Resource& GridMod){
fop_numerator_mod->AddGridPair(GridMod);
fop_denominator_mod->AddGridPair(GridMod);
}
// constructor
template <class ReaderClass>
TwoFlavourRatioFModule(Reader<ReaderClass>& R): PseudoFermionModuleBase<Impl, TwoFlavourRatioPseudoFermionAction>(R) {
this->getSolverOperator(R, solver_mod, "Solver");
this->getFermionOperator(R, fop_numerator_mod, "Numerator");
this->getFermionOperator(R, fop_denominator_mod, "Denominator");
}
// acquire resource
virtual void initialize() {
// here temporarily assuming that the force and action solver are the same
this->ActionPtr.reset(new TwoFlavourRatioPseudoFermionAction<Impl>(*(this->fop_numerator_mod->getPtr()),
*(this->fop_denominator_mod->getPtr()), *(this->solver_mod->getPtr()), *(this->solver_mod->getPtr())));
}
};
template <class Impl >
class TwoFlavourRatioEOFModule: public PseudoFermionModuleBase<Impl, TwoFlavourEvenOddRatioPseudoFermionAction>{
typedef PseudoFermionModuleBase<Impl, TwoFlavourEvenOddRatioPseudoFermionAction> Base;
using Base::Base;
typename Base::operator_type fop_numerator_mod;
typename Base::operator_type fop_denominator_mod;
typename Base::solver_type solver_mod;
public:
virtual void acquireResource(typename Base::Resource& GridMod){
fop_numerator_mod->AddGridPair(GridMod);
fop_denominator_mod->AddGridPair(GridMod);
}
// constructor
template <class ReaderClass>
TwoFlavourRatioEOFModule(Reader<ReaderClass>& R): Base(R) {
this->getSolverOperator(R, solver_mod, "Solver");
this->getFermionOperator(R, fop_numerator_mod, "Numerator");
this->getFermionOperator(R, fop_denominator_mod, "Denominator");
}
// acquire resource
virtual void initialize() {
// here temporarily assuming that the force and action solver are the same
this->ActionPtr.reset(new TwoFlavourEvenOddRatioPseudoFermionAction<Impl>(*(this->fop_numerator_mod->getPtr()),
*(this->fop_denominator_mod->getPtr()), *(this->solver_mod->getPtr()), *(this->solver_mod->getPtr())));
}
};
template <class Impl >
class OneFlavourFModule: public PseudoFermionModuleBase<Impl, OneFlavourRationalPseudoFermionAction, OneFlavourRationalParams>{
typedef PseudoFermionModuleBase<Impl, OneFlavourRationalPseudoFermionAction, OneFlavourRationalParams> Base;
using Base::Base;
typename Base::operator_type fop_mod;
public:
virtual void acquireResource(typename Base::Resource& GridMod){
fop_mod->AddGridPair(GridMod);
}
// constructor
template <class ReaderClass>
OneFlavourFModule(Reader<ReaderClass>& R): Base(R) {
this->getFermionOperator(R, fop_mod, "Operator");
}
// acquire resource
virtual void initialize() {
this->ActionPtr.reset(new OneFlavourRationalPseudoFermionAction<Impl>(*(this->fop_mod->getPtr()), this->Par_ ));
}
};
template <class Impl >
class OneFlavourEOFModule:
public PseudoFermionModuleBase<Impl, OneFlavourEvenOddRationalPseudoFermionAction, OneFlavourRationalParams>
{
typedef PseudoFermionModuleBase<Impl, OneFlavourEvenOddRationalPseudoFermionAction, OneFlavourRationalParams> Base;
using Base::Base;
typename Base::operator_type fop_mod;
public:
virtual void acquireResource(typename Base::Resource& GridMod){
fop_mod->AddGridPair(GridMod);
}
// constructor
template <class ReaderClass>
OneFlavourEOFModule(Reader<ReaderClass>& R): Base(R) {
this->getFermionOperator(R, fop_mod, "Operator");
}
// acquire resource
virtual void initialize() {
this->ActionPtr.reset(new OneFlavourEvenOddRationalPseudoFermionAction<Impl>(*(this->fop_mod->getPtr()), this->Par_ ));
}
};
template <class Impl >
class OneFlavourRatioFModule:
public PseudoFermionModuleBase<Impl, OneFlavourRatioRationalPseudoFermionAction, OneFlavourRationalParams>
{
typedef PseudoFermionModuleBase<Impl, OneFlavourRatioRationalPseudoFermionAction, OneFlavourRationalParams> Base;
using Base::Base;
typename Base::operator_type fop_numerator_mod;
typename Base::operator_type fop_denominator_mod;
public:
virtual void acquireResource(typename Base::Resource& GridMod){
fop_numerator_mod->AddGridPair(GridMod);
fop_denominator_mod->AddGridPair(GridMod);
}
// constructor
template <class ReaderClass>
OneFlavourRatioFModule(Reader<ReaderClass>& R): Base(R) {
this->getFermionOperator(R, fop_numerator_mod, "Numerator");
this->getFermionOperator(R, fop_denominator_mod, "Denominator");
}
// acquire resource
virtual void initialize() {
this->ActionPtr.reset(new OneFlavourRatioRationalPseudoFermionAction<Impl>( *(this->fop_numerator_mod->getPtr()),
*(this->fop_denominator_mod->getPtr()),
this->Par_ ));
}
};
template <class Impl >
class OneFlavourRatioEOFModule:
public PseudoFermionModuleBase<Impl, OneFlavourEvenOddRatioRationalPseudoFermionAction, OneFlavourRationalParams>
{
typedef PseudoFermionModuleBase<Impl, OneFlavourEvenOddRatioRationalPseudoFermionAction, OneFlavourRationalParams> Base;
using Base::Base;
typename Base::operator_type fop_numerator_mod;
typename Base::operator_type fop_denominator_mod;
public:
virtual void acquireResource(typename Base::Resource& GridMod){
fop_numerator_mod->AddGridPair(GridMod);
fop_denominator_mod->AddGridPair(GridMod);
}
// constructor
template <class ReaderClass>
OneFlavourRatioEOFModule(Reader<ReaderClass>& R): Base(R) {
this->getFermionOperator(R, fop_numerator_mod, "Numerator");
this->getFermionOperator(R, fop_denominator_mod, "Denominator");
}
// acquire resource
virtual void initialize() {
this->ActionPtr.reset(new OneFlavourEvenOddRatioRationalPseudoFermionAction<Impl>(*(this->fop_numerator_mod->getPtr()),
*(this->fop_denominator_mod->getPtr()),
this->Par_ ));
}
};
////////////////////////////////////////
// Factories specialisations
////////////////////////////////////////
// use the same classed defined by Antonin, does not make sense to rewrite
// Factory is perfectly fine
// Registar must be changed because I do not want to use the ModuleFactory
// explicit ref to LatticeGaugeField must be changed or put in the factory
//typedef ActionModuleBase< Action< LatticeGaugeField >, GridModule > HMC_LGTActionModBase;
//typedef ActionModuleBase< Action< LatticeReal >, GridModule > HMC_ScalarActionModBase;
template <char const *str, class Field, class ReaderClass >
class HMC_ActionModuleFactory
: public Factory < ActionModuleBase< Action< Field >, GridModule > , Reader<ReaderClass> > {
public:
typedef Reader<ReaderClass> TheReader;
// use SINGLETON FUNCTOR MACRO HERE
HMC_ActionModuleFactory(const HMC_ActionModuleFactory& e) = delete;
void operator=(const HMC_ActionModuleFactory& e) = delete;
static HMC_ActionModuleFactory& getInstance(void) {
static HMC_ActionModuleFactory e;
return e;
}
private:
HMC_ActionModuleFactory(void) = default;
std::string obj_type() const {
return std::string(str);
}
};
extern char gauge_string[];
NAMESPACE_END(Grid);
#endif //HMC_MODULES_H

109
Grid/qcd/modules/Factory.h Normal file
View File

@@ -0,0 +1,109 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: Factory.h
Copyright (C) 2015
Copyright (C) 2016
Author: Antonin Portelli <antonin.portelli@me.com>
Author: Guido Cossu <guido.cossu@ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution directory
*************************************************************************************/
/* END LEGAL */
#ifndef Factory_hpp_
#define Factory_hpp_
namespace Grid{
/******************************************************************************
* abstract factory class *
******************************************************************************/
template <typename T, typename CreatorInput>
class Factory
{
public:
typedef std::function< std::unique_ptr<T> (const CreatorInput&) > Func;
// constructor
Factory(void) = default;
// destructor
virtual ~Factory(void) = default;
// registration
void registerBuilder(const std::string type, const Func &f);
// get builder list
std::vector<std::string> getBuilderList(void) const;
// factory
std::unique_ptr<T> create(const std::string type,
const CreatorInput& input) const;
private:
std::map<std::string, Func> builder_;
virtual std::string obj_type() const = 0;
};
/******************************************************************************
* template implementation *
******************************************************************************/
// registration ////////////////////////////////////////////////////////////////
template <typename T, typename CreatorInput>
void Factory<T, CreatorInput>::registerBuilder(const std::string type, const Func &f)
{
builder_[type] = f;
}
// get module list /////////////////////////////////////////////////////////////
template <typename T, typename CreatorInput>
std::vector<std::string> Factory<T, CreatorInput>::getBuilderList(void) const
{
std::vector<std::string> list;
for (auto &b: builder_)
{
list.push_back(b.first);
}
return list;
}
// factory /////////////////////////////////////////////////////////////////////
template <typename T, typename CreatorInput>
std::unique_ptr<T> Factory<T, CreatorInput>::create(const std::string type,
const CreatorInput& input) const
{
Func func;
std::cout << GridLogDebug << "Creating object of type "<< type << std::endl;
try
{
func = builder_.at(type);
}
catch (std::out_of_range &)
{
//HADRONS_ERROR("object of type '" + type + "' unknown");
std::cout << GridLogError << "Error" << std::endl;
std::cout << GridLogError << obj_type() << " object of name [" << type << "] unknown" << std::endl;
exit(1);
}
return func(input);
}
}
#endif // Factory_hpp_

View File

@@ -0,0 +1,240 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/qcd/modules/FermionOperatorModules.h
Copyright (C) 2016
Author: Guido Cossu <guido.cossu@ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution
directory
*************************************************************************************/
/* END LEGAL */
#ifndef FERMIONOPERATOR_MODULES_H
#define FERMIONOPERATOR_MODULES_H
NAMESPACE_BEGIN(Grid);
////////////////////////////////////
// Fermion operators
/////////////////////////////////////
template < class Product>
class FermionOperatorModuleBase : public HMCModuleBase<Product>{
public:
virtual void AddGridPair(GridModule&) = 0;
};
template <template <typename> class FOType, class FermionImpl, class FOPar>
class FermionOperatorModule
: public Parametrized<FOPar>,
public FermionOperatorModuleBase<FermionOperator<FermionImpl> > {
protected:
std::unique_ptr< FOType<FermionImpl> > FOPtr;
std::vector< GridModule* > GridRefs;
public:
typedef HMCModuleBase< FermionOperator<FermionImpl> > Base;
typedef typename Base::Product Product;
FermionOperatorModule(FOPar Par) : Parametrized<FOPar>(Par) {}
template <class ReaderClass>
FermionOperatorModule(Reader<ReaderClass>& Reader) : Parametrized<FOPar>(Reader){};
void AddGridPair(GridModule &Mod){
if (GridRefs.size()>1){
std::cout << GridLogError << "Adding too many Grids to the FermionOperatorModule" << std::endl;
exit(1);
}
GridRefs.push_back(&Mod);
if (Ls()){
GridRefs.push_back(new GridModule());
GridRefs[1]->set_full(SpaceTimeGrid::makeFiveDimGrid(Ls(),GridRefs[0]->get_full()));
GridRefs[1]->set_rb(SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls(),GridRefs[0]->get_full()));
}
}
virtual unsigned int Ls(){
return 0;
}
virtual void print_parameters(){
std::cout << this->Par_ << std::endl;
}
Product* getPtr() {
if (!FOPtr) initialize();
return FOPtr.get();
}
private:
virtual void initialize() = 0;
};
// Factory
template <char const *str, class FermionImpl, class ReaderClass >
class HMC_FermionOperatorModuleFactory
: public Factory < FermionOperatorModuleBase<FermionOperator<FermionImpl> > , Reader<ReaderClass> > {
public:
// use SINGLETON FUNCTOR MACRO HERE
typedef Reader<ReaderClass> TheReader;
HMC_FermionOperatorModuleFactory(const HMC_FermionOperatorModuleFactory& e) = delete;
void operator=(const HMC_FermionOperatorModuleFactory& e) = delete;
static HMC_FermionOperatorModuleFactory& getInstance(void) {
static HMC_FermionOperatorModuleFactory e;
return e;
}
private:
HMC_FermionOperatorModuleFactory(void) = default;
std::string obj_type() const {
return std::string(str);
}
};
extern char fermionop_string[];
// Modules
class WilsonFermionParameters : Serializable {
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(WilsonFermionParameters,
RealD, mass);
};
template <class FermionImpl >
class WilsonFermionModule: public FermionOperatorModule<WilsonFermion, FermionImpl, WilsonFermionParameters> {
typedef FermionOperatorModule<WilsonFermion, FermionImpl, WilsonFermionParameters> FermBase;
using FermBase::FermBase; // for constructors
// acquire resource
virtual void initialize(){
auto GridMod = this->GridRefs[0];
typename FermionImpl::GaugeField U(GridMod->get_full());
this->FOPtr.reset(new WilsonFermion<FermionImpl>(U, *(GridMod->get_full()), *(GridMod->get_rb()), this->Par_.mass));
}
};
class MobiusFermionParameters : Serializable {
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(MobiusFermionParameters,
RealD, mass,
RealD, M5,
RealD, b,
RealD, c,
unsigned int, Ls);
};
template <class FermionImpl >
class MobiusFermionModule: public FermionOperatorModule<MobiusFermion, FermionImpl, MobiusFermionParameters> {
typedef FermionOperatorModule<MobiusFermion, FermionImpl, MobiusFermionParameters> FermBase;
using FermBase::FermBase; // for constructors
virtual unsigned int Ls(){
return this->Par_.Ls;
}
// acquire resource
virtual void initialize(){
auto GridMod = this->GridRefs[0];
auto GridMod5d = this->GridRefs[1];
typename FermionImpl::GaugeField U(GridMod->get_full());
this->FOPtr.reset(new MobiusFermion<FermionImpl>( U, *(GridMod->get_full()), *(GridMod->get_rb()),
*(GridMod5d->get_full()), *(GridMod5d->get_rb()),
this->Par_.mass, this->Par_.M5, this->Par_.b, this->Par_.c));
}
};
class DomainWallFermionParameters : Serializable {
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(DomainWallFermionParameters,
RealD, mass,
RealD, M5,
unsigned int, Ls);
};
template <class FermionImpl >
class DomainWallFermionModule: public FermionOperatorModule<DomainWallFermion, FermionImpl, DomainWallFermionParameters> {
typedef FermionOperatorModule<DomainWallFermion, FermionImpl, DomainWallFermionParameters> FermBase;
using FermBase::FermBase; // for constructors
virtual unsigned int Ls(){
return this->Par_.Ls;
}
// acquire resource
virtual void initialize(){
auto GridMod = this->GridRefs[0];
auto GridMod5d = this->GridRefs[1];
typename FermionImpl::GaugeField U(GridMod->get_full());
this->FOPtr.reset(new DomainWallFermion<FermionImpl>( U, *(GridMod->get_full()), *(GridMod->get_rb()),
*(GridMod5d->get_full()), *(GridMod5d->get_rb()),
this->Par_.mass, this->Par_.M5));
}
};
class DomainWallEOFAFermionParameters : Serializable {
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(DomainWallEOFAFermionParameters,
RealD, mq1,
RealD, mq2,
RealD, mq3,
RealD, shift,
int, pm,
RealD, M5,
unsigned int, Ls);
};
template <class FermionImpl >
class DomainWallEOFAFermionModule: public FermionOperatorModule<DomainWallEOFAFermion, FermionImpl, DomainWallEOFAFermionParameters> {
typedef FermionOperatorModule<DomainWallEOFAFermion, FermionImpl, DomainWallEOFAFermionParameters> FermBase;
using FermBase::FermBase; // for constructors
virtual unsigned int Ls(){
return this->Par_.Ls;
}
// acquire resource
virtual void initialize(){
auto GridMod = this->GridRefs[0];
auto GridMod5d = this->GridRefs[1];
typename FermionImpl::GaugeField U(GridMod->get_full());
this->FOPtr.reset(new DomainWallEOFAFermion<FermionImpl>( U, *(GridMod->get_full()), *(GridMod->get_rb()),
*(GridMod5d->get_full()), *(GridMod5d->get_rb()),
this->Par_.mq1, this->Par_.mq2, this->Par_.mq3,
this->Par_.shift, this->Par_.pm, this->Par_.M5));
}
};
NAMESPACE_END(Grid);
#endif //FERMIONOPERATOR_MODULES_H

View File

@@ -0,0 +1,39 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/qcd/modules/Modules.cc
Copyright (C) 2016
Author: Guido Cossu <guido.cossu@ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution
directory
*************************************************************************************/
/* END LEGAL */
namespace Grid{
char gauge_string[] = "gauge";
char cp_string[] = "CheckPointer";
char hmc_string[] = "HMC";
char observable_string[] = "Observable";
char solver_string[] = "Solver";
char fermionop_string[] = "FermionOperator";
}

127
Grid/qcd/modules/Modules.h Normal file
View File

@@ -0,0 +1,127 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/qcd/action/gauge/WilsonGaugeAction.h
Copyright (C) 2016
Author: Guido Cossu <guido.cossu@ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution
directory
*************************************************************************************/
/* END LEGAL */
#ifndef HMC_MODULES_H
#define HMC_MODULES_H
/*
Define loadable, serializable modules
for the HMC execution
*/
NAMESPACE_BEGIN(Grid);
// Empty class for no parameters
class NoParameters{};
/*
Base class for modules with parameters
*/
template < class P >
class Parametrized{
public:
typedef P Parameters;
Parametrized(Parameters Par):Par_(Par){};
template <class ReaderClass>
Parametrized(Reader<ReaderClass> & R, std::string section_name = "parameters"){
read(R, section_name, Par_);
}
void set_parameters(Parameters Par){
Par_ = Par;
}
void print_parameters(){
std::cout << Par_ << std::endl;
}
protected:
Parameters Par_;
private:
std::string section_name;
};
template <>
class Parametrized<NoParameters>{
public:
typedef NoParameters Parameters;
Parametrized(Parameters Par){};
template <class ReaderClass>
Parametrized(Reader<ReaderClass> & Reader){};
void set_parameters(Parameters Par){}
void print_parameters(){}
};
////////////////////////////////////////
// Lowest level abstract module class
////////////////////////////////////////
template <class Prod>
class HMCModuleBase {
public:
typedef Prod Product;
virtual Prod* getPtr() = 0;
// add a getReference?
virtual void print_parameters(){}; // default to nothing
};
/////////////////////////////////////////////
// Registration class
/////////////////////////////////////////////
template <class T, class TheFactory>
class Registrar {
public:
Registrar(std::string className) {
// register the class factory function
TheFactory::getInstance().registerBuilder(className,
[&](typename TheFactory::TheReader Reader)
{
return std::unique_ptr<T>(new T(Reader));
}
);
}
};
NAMESPACE_END(Grid);
#endif //HMC_MODULES_H

View File

@@ -0,0 +1,151 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/qcd/modules/ObservableModules.h
Copyright (C) 2016
Author: Guido Cossu <guido.cossu@ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution
directory
*************************************************************************************/
/* END LEGAL */
#ifndef HMC_OBSERVABLE_MODULES_H
#define HMC_OBSERVABLE_MODULES_H
NAMESPACE_BEGIN(Grid);
/////////////////////////////
// Observables
/////////////////////////////
template <class ObservableType, class OPar>
class ObservableModule
: public Parametrized<OPar>,
public HMCModuleBase< HmcObservable<typename ObservableType::Field> > {
public:
typedef HMCModuleBase< HmcObservable< typename ObservableType::Field> > Base;
typedef typename Base::Product Product;
typedef OPar Parameters;
std::unique_ptr<ObservableType> ObservablePtr;
ObservableModule(OPar Par) : Parametrized<OPar>(Par) {}
virtual void print_parameters(){
Parametrized<OPar>::print_parameters();
}
template <class ReaderClass>
ObservableModule(Reader<ReaderClass>& Reader) : Parametrized<OPar>(Reader){};
Product* getPtr() {
if (!ObservablePtr) initialize();
return ObservablePtr.get();
}
private:
virtual void initialize() = 0;
};
////////////////
// Modules
////////////////
//// Observables module
class PlaquetteObsParameters : Serializable {
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(PlaquetteObsParameters,
std::string, output_prefix);
};
template < class Impl >
class PlaquetteMod: public ObservableModule<PlaquetteLogger<Impl>, NoParameters>{
typedef ObservableModule<PlaquetteLogger<Impl>, NoParameters> ObsBase;
using ObsBase::ObsBase; // for constructors
// acquire resource
virtual void initialize(){
this->ObservablePtr.reset(new PlaquetteLogger<Impl>());
}
public:
PlaquetteMod(): ObsBase(NoParameters()){}
};
template < class Impl >
class PolyakovMod: public ObservableModule<PolyakovLogger<Impl>, NoParameters>{
typedef ObservableModule<PolyakovLogger<Impl>, NoParameters> ObsBase;
using ObsBase::ObsBase; // for constructors
// acquire resource
virtual void initialize(){
this->ObservablePtr.reset(new PolyakovLogger<Impl>());
}
public:
PolyakovMod(): ObsBase(NoParameters()){}
};
template < class Impl >
class TopologicalChargeMod: public ObservableModule<TopologicalCharge<Impl>, TopologyObsParameters>{
typedef ObservableModule<TopologicalCharge<Impl>, TopologyObsParameters> ObsBase;
using ObsBase::ObsBase; // for constructors
// acquire resource
virtual void initialize(){
this->ObservablePtr.reset(new TopologicalCharge<Impl>(this->Par_));
}
public:
TopologicalChargeMod(TopologyObsParameters Par): ObsBase(Par){}
TopologicalChargeMod(): ObsBase(){}
};
////////////////////////////////////////
// Factories specialisations
////////////////////////////////////////
// explicit ref to LatticeGaugeField must be changed or put in the factory
//typedef HMCModuleBase< HmcObservable<LatticeGaugeField> > HMC_ObsModBase;
template <char const *str, class Field, class ReaderClass >
class HMC_ObservablesModuleFactory
: public Factory < HMCModuleBase< HmcObservable<Field> >, Reader<ReaderClass> > {
public:
typedef Reader<ReaderClass> TheReader;
// use SINGLETON FUNCTOR MACRO HERE
HMC_ObservablesModuleFactory(const HMC_ObservablesModuleFactory& e) = delete;
void operator=(const HMC_ObservablesModuleFactory& e) = delete;
static HMC_ObservablesModuleFactory& getInstance(void) {
static HMC_ObservablesModuleFactory e;
return e;
}
private:
HMC_ObservablesModuleFactory(void) = default;
std::string obj_type() const {
return std::string(str);
}
};
extern char observable_string[];
NAMESPACE_END(Grid);
#endif //HMC_OBSERVABLE_MODULES_H

View File

@@ -0,0 +1,127 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/qcd/modules/Registration.h
Copyright (C) 2016
Author: Guido Cossu <guido.cossu@ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution
directory
*************************************************************************************/
/* END LEGAL */
#ifndef MODULES_REGISTRATION_H
#define MODULES_REGISTRATION_H
// simplify with macros
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Actions
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef WilsonGModule<ImplementationPolicy> WilsonGMod;
typedef SymanzikGModule<ImplementationPolicy> SymanzikGMod;
typedef IwasakiGModule<ImplementationPolicy> IwasakiGMod;
typedef DBW2GModule<ImplementationPolicy> DBW2GMod;
typedef RBCGModule<ImplementationPolicy> RBCGMod;
typedef PlaqPlusRectangleGModule<ImplementationPolicy> PlaqPlusRectangleGMod;
static Registrar<WilsonGMod, HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __WGmodXMLInit("Wilson");
static Registrar<SymanzikGMod, HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __SymGmodXMLInit("Symanzik");
static Registrar<IwasakiGMod, HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __IwGmodXMLInit("Iwasaki");
static Registrar<DBW2GMod, HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __DBW2GmodXMLInit("DBW2");
static Registrar<RBCGMod, HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __RBCGmodXMLInit("RBC");
static Registrar<PlaqPlusRectangleGMod, HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __PPRectGmodXMLInit("PlaqPlusRect");
// FIXME more general implementation
static Registrar<TwoFlavourFModule<FermionImplementationPolicy> ,
HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __TwoFlavourFmodXMLInit("TwoFlavours");
static Registrar<TwoFlavourRatioFModule<FermionImplementationPolicy> ,
HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __TwoFlavourRatioFmodXMLInit("TwoFlavoursRatio");
static Registrar<TwoFlavourEOFModule<FermionImplementationPolicy> ,
HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __TwoFlavourEOFmodXMLInit("TwoFlavoursEvenOdd");
static Registrar<TwoFlavourRatioEOFModule<FermionImplementationPolicy>,
HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __TwoFlavourRatioEOFmodXMLInit("TwoFlavoursEvenOddRatio");
static Registrar<OneFlavourFModule<FermionImplementationPolicy> ,
HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __OneFlavourFmodXMLInit("OneFlavour");
static Registrar<OneFlavourEOFModule<FermionImplementationPolicy> ,
HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __OneFlavourEOFmodXMLInit("OneFlavourEvenOdd");
static Registrar<OneFlavourRatioFModule<FermionImplementationPolicy> ,
HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __OneFlavourRatioFmodXMLInit("OneFlavourRatio");
static Registrar<OneFlavourRatioEOFModule<FermionImplementationPolicy>,
HMC_ActionModuleFactory<gauge_string, typename ImplementationPolicy::Field, Serialiser> > __OneFlavourRatioEOFmodXMLInit("OneFlavourEvenOddRatio");
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Solvers
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Now a specific registration with a fermion field
// here must instantiate CG and CR for every new fermion field type (macro!!)
static Registrar< ConjugateGradientModule<WilsonFermionR::FermionField>,
HMC_SolverModuleFactory<solver_string, WilsonFermionR::FermionField, Serialiser> > __CGWFmodXMLInit("ConjugateGradient");
static Registrar< ConjugateResidualModule<WilsonFermionR::FermionField>,
HMC_SolverModuleFactory<solver_string, WilsonFermionR::FermionField, Serialiser> > __CRWFmodXMLInit("ConjugateResidual");
// add the staggered, scalar versions here
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Fermion operators
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static Registrar< WilsonFermionModule<FermionImplementationPolicy>,
HMC_FermionOperatorModuleFactory<fermionop_string, FermionImplementationPolicy, Serialiser> > __WilsonFOPmodXMLInit("Wilson");
static Registrar< MobiusFermionModule<FermionImplementationPolicy>,
HMC_FermionOperatorModuleFactory<fermionop_string, FermionImplementationPolicy, Serialiser> > __MobiusFOPmodXMLInit("Mobius");
static Registrar< DomainWallFermionModule<FermionImplementationPolicy>,
HMC_FermionOperatorModuleFactory<fermionop_string, FermionImplementationPolicy, Serialiser> > __DWFOPmodXMLInit("DomainWall");
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Observables
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static Registrar<PlaquetteMod<ImplementationPolicy>, HMC_ObservablesModuleFactory<observable_string, typename ImplementationPolicy::Field, Serialiser> > __OBSPLmodXMLInit("Plaquette");
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Checkpointers
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static Registrar<BinaryCPModule<ImplementationPolicy>, HMC_CPModuleFactory<cp_string, ImplementationPolicy, Serialiser> > __CPBinarymodXMLInit("Binary");
static Registrar<NerscCPModule<ImplementationPolicy> , HMC_CPModuleFactory<cp_string, ImplementationPolicy, Serialiser> > __CPNerscmodXMLInit("Nersc");
#ifdef HAVE_LIME
static Registrar<ILDGCPModule<ImplementationPolicy> , HMC_CPModuleFactory<cp_string, ImplementationPolicy, Serialiser> > __CPILDGmodXMLInit("ILDG");
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Integrators
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static Registrar< HMCLeapFrog<ImplementationPolicy, RepresentationPolicy, Serialiser> , HMCRunnerModuleFactory<hmc_string, Serialiser> > __HMCLFmodXMLInit("LeapFrog");
static Registrar< HMCMinimumNorm2<ImplementationPolicy, RepresentationPolicy, Serialiser> , HMCRunnerModuleFactory<hmc_string, Serialiser> > __HMCMN2modXMLInit("MinimumNorm2");
static Registrar< HMCForceGradient<ImplementationPolicy, RepresentationPolicy, Serialiser> , HMCRunnerModuleFactory<hmc_string, Serialiser> > __HMCFGmodXMLInit("ForceGradient");
typedef HMCRunnerModuleFactory<hmc_string, Serialiser > HMCModuleFactory;
#endif

View File

@@ -0,0 +1,138 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/qcd/modules/SolverModules.h
Copyright (C) 2016
Author: Guido Cossu <guido.cossu@ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution
directory
*************************************************************************************/
/* END LEGAL */
#ifndef SOLVER_MODULES_H
#define SOLVER_MODULES_H
NAMESPACE_BEGIN(Grid);
//////////////////////////////////////////////
// Operator Functions (Solvers)
//////////////////////////////////////////////
template <template <typename> class SolverType, class Field, class SPar>
class SolverModule
: public Parametrized<SPar>,
public HMCModuleBase<OperatorFunction<Field> > {
public:
typedef HMCModuleBase< OperatorFunction<Field> > Base;
typedef typename Base::Product Product;
std::unique_ptr< SolverType<Field> > SolverPtr;
SolverModule(SPar Par) : Parametrized<SPar>(Par) {}
template <class ReaderClass>
SolverModule(Reader<ReaderClass>& Reader) : Parametrized<SPar>(Reader){};
virtual void print_parameters(){
std::cout << this->Par_ << std::endl;
}
Product* getPtr() {
if (!SolverPtr) initialize();
return SolverPtr.get();
}
private:
virtual void initialize() = 0;
};
// Factory
template <char const *str, class Field, class ReaderClass >
class HMC_SolverModuleFactory
: public Factory < HMCModuleBase<OperatorFunction<Field> > , Reader<ReaderClass> > {
public:
// use SINGLETON FUNCTOR MACRO HERE
typedef Reader<ReaderClass> TheReader;
HMC_SolverModuleFactory(const HMC_SolverModuleFactory& e) = delete;
void operator=(const HMC_SolverModuleFactory& e) = delete;
static HMC_SolverModuleFactory& getInstance(void) {
static HMC_SolverModuleFactory e;
return e;
}
private:
HMC_SolverModuleFactory(void) = default;
std::string obj_type() const {
return std::string(str);
}
};
class SolverParameters : Serializable {
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(SolverParameters,
RealD, tolerance,
RealD, max_iterations);
// add error on no convergence?
};
class SolverObjName: Serializable {
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(SolverObjName,
std::string, name,
SolverParameters, parameters);
};
template <class Field >
class ConjugateGradientModule: public SolverModule<ConjugateGradient, Field, SolverParameters> {
typedef SolverModule<ConjugateGradient, Field, SolverParameters> SolverBase;
using SolverBase::SolverBase; // for constructors
// acquire resource
virtual void initialize(){
this->SolverPtr.reset(new ConjugateGradient<Field>(this->Par_.tolerance, this->Par_.max_iterations, true));
}
};
template <class Field >
class ConjugateResidualModule: public SolverModule<ConjugateResidual, Field, SolverParameters> {
typedef SolverModule<ConjugateResidual, Field, SolverParameters> SolverBase;
using SolverBase::SolverBase; // for constructors
// acquire resource
virtual void initialize(){
this->SolverPtr.reset(new ConjugateResidual<Field>(this->Par_.tolerance, this->Par_.max_iterations));
}
};
extern char solver_string[];
NAMESPACE_END(Grid);
#endif //SOLVER_MODULES_H

46
Grid/qcd/modules/mods.h Normal file
View File

@@ -0,0 +1,46 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/qcd/action/gauge/WilsonGaugeAction.h
Copyright (C) 2016
Author: Guido Cossu <guido.cossu@ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution
directory
*************************************************************************************/
/* END LEGAL */
#ifndef MODS_H
#define MODS_H
// Modules files
#include <Grid/qcd/modules/Factory.h>
#include <Grid/qcd/modules/Modules.h>
#include <Grid/qcd/hmc/checkpointers/CheckPointerModules.h>
#include <Grid/qcd/modules/SolverModules.h>
#include <Grid/qcd/modules/FermionOperatorModules.h>
#include <Grid/qcd/modules/ActionModules.h>
#include <Grid/qcd/modules/ObservableModules.h>
#endif //MODS_H