mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Cleaning up the checkpointers interface
This commit is contained in:
parent
1bb8578173
commit
1189ebc8b5
@ -96,29 +96,23 @@ class StoutSmearingModule: public SmearingModule<ImplementationPolicy>{
|
||||
SmearedConfiguration<ImplementationPolicy> SmearingPolicy;
|
||||
};
|
||||
|
||||
|
||||
// Checkpoint module, owns the Checkpointer
|
||||
template <class ImplementationPolicy>
|
||||
class CheckPointModule{
|
||||
std::unique_ptr< BaseHmcCheckpointer<ImplementationPolicy> > cp_;
|
||||
class CheckPointModule {
|
||||
std::unique_ptr<BaseHmcCheckpointer<ImplementationPolicy> > cp_;
|
||||
|
||||
public:
|
||||
void set_Checkpointer(BaseHmcCheckpointer<ImplementationPolicy> *cp){
|
||||
cp_.reset(cp);
|
||||
};
|
||||
BaseHmcCheckpointer<ImplementationPolicy>* get_CheckPointer(){
|
||||
std::cout << "Checkpointer Pointer requested : " << cp_.get() << std::endl;
|
||||
return cp_.get();
|
||||
}
|
||||
public:
|
||||
void set_Checkpointer(BaseHmcCheckpointer<ImplementationPolicy>* cp) {
|
||||
cp_.reset(cp);
|
||||
};
|
||||
|
||||
void initialize(CheckpointerParameters& P){
|
||||
cp_.initialize(P);
|
||||
}
|
||||
BaseHmcCheckpointer<ImplementationPolicy>* get_CheckPointer() {
|
||||
return cp_.get();
|
||||
}
|
||||
|
||||
void initialize(CheckpointerParameters& P) { cp_.initialize(P); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace QCD
|
||||
} // namespace Grid
|
||||
|
||||
|
@ -33,22 +33,37 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include <unordered_map>
|
||||
|
||||
// One function per Checkpointer, use a macro to simplify
|
||||
#define RegisterLoadCheckPointerFunction(NAME) \
|
||||
void Load##NAME##Checkpointer(CheckpointerParameters& Params_) { \
|
||||
if (!have_CheckPointer) { \
|
||||
std::cout << GridLogDebug << "Loading Checkpointer " << #NAME \
|
||||
<< std::endl; \
|
||||
CP.set_Checkpointer( \
|
||||
new NAME##HmcCheckpointer<ImplementationPolicy>(Params_)); \
|
||||
have_CheckPointer = true; \
|
||||
} else { \
|
||||
std::cout << GridLogError << "Checkpointer already loaded " \
|
||||
<< std::endl; \
|
||||
exit(1); \
|
||||
} \
|
||||
#define RegisterLoadCheckPointerFunction(NAME) \
|
||||
void Load##NAME##Checkpointer(const CheckpointerParameters& Params_) { \
|
||||
if (!have_CheckPointer) { \
|
||||
std::cout << GridLogDebug << "Loading Checkpointer " << #NAME \
|
||||
<< std::endl; \
|
||||
CP.set_Checkpointer( \
|
||||
new NAME##HmcCheckpointer<ImplementationPolicy>(Params_)); \
|
||||
have_CheckPointer = true; \
|
||||
} else { \
|
||||
std::cout << GridLogError << "Checkpointer already loaded " \
|
||||
<< std::endl; \
|
||||
exit(1); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
// One function per Checkpointer using the reader, use a macro to simplify
|
||||
#define RegisterLoadCheckPointerReaderFunction(NAME) \
|
||||
template <class Reader> \
|
||||
void Load##NAME##Checkpointer(Reader& Reader_) { \
|
||||
if (!have_CheckPointer) { \
|
||||
std::cout << GridLogDebug << "Loading Checkpointer " << #NAME \
|
||||
<< std::endl; \
|
||||
CP.set_Checkpointer(new NAME##HmcCheckpointer<ImplementationPolicy>( \
|
||||
CheckpointerParameters(Reader_))); \
|
||||
have_CheckPointer = true; \
|
||||
} else { \
|
||||
std::cout << GridLogError << "Checkpointer already loaded " \
|
||||
<< std::endl; \
|
||||
exit(1); \
|
||||
} \
|
||||
}
|
||||
|
||||
namespace Grid {
|
||||
namespace QCD {
|
||||
@ -141,7 +156,11 @@ class HMCResourceManager{
|
||||
|
||||
RegisterLoadCheckPointerFunction (Binary);
|
||||
RegisterLoadCheckPointerFunction (Nersc);
|
||||
RegisterLoadCheckPointerFunction (ILDG)
|
||||
RegisterLoadCheckPointerFunction (ILDG);
|
||||
|
||||
RegisterLoadCheckPointerReaderFunction (Binary);
|
||||
RegisterLoadCheckPointerReaderFunction (Nersc);
|
||||
RegisterLoadCheckPointerReaderFunction (ILDG);
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -30,25 +30,49 @@ directory
|
||||
#define BASE_CHECKPOINTER
|
||||
|
||||
namespace Grid {
|
||||
namespace QCD {
|
||||
namespace QCD {
|
||||
|
||||
class CheckpointerParameters : Serializable {
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(CheckpointerParameters, std::string,
|
||||
configStem, std::string, rngStem, int,
|
||||
SaveInterval, std::string, format, );
|
||||
class CheckpointerParameters : Serializable {
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(CheckpointerParameters,
|
||||
std::string, config_prefix,
|
||||
std::string, rng_prefix,
|
||||
int, saveInterval,
|
||||
std::string, format, );
|
||||
|
||||
CheckpointerParameters(std::string cf = "cfg", std::string rn = "rng",
|
||||
int savemodulo = 1, const std::string &f = "IEEE64BIG")
|
||||
: configStem(cf), rngStem(rn), SaveInterval(savemodulo), format(f){};
|
||||
};
|
||||
CheckpointerParameters(std::string cf = "cfg", std::string rn = "rng",
|
||||
int savemodulo = 1, const std::string &f = "IEEE64BIG")
|
||||
: config_prefix(cf), rng_prefix(rn), saveInterval(savemodulo), format(f){};
|
||||
|
||||
|
||||
template<class ReaderClass>
|
||||
CheckpointerParameters(ReaderClass &Reader){
|
||||
read(Reader, "Checkpointer", *this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Base class for checkpointers
|
||||
template <class Impl>
|
||||
class BaseHmcCheckpointer : public HmcObservable<typename Impl::Field> {
|
||||
public:
|
||||
virtual void initialize(CheckpointerParameters &Params) = 0;
|
||||
void build_filenames(int traj, CheckpointerParameters &Params,
|
||||
std::string &conf_file, std::string &rng_file) {
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.rng_prefix << "." << traj;
|
||||
rng_file = os.str();
|
||||
}
|
||||
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.config_prefix << "." << traj;
|
||||
conf_file = os.str();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void initialize(const CheckpointerParameters &Params) = 0;
|
||||
|
||||
virtual void CheckpointRestore(int traj, typename Impl::Field &U,
|
||||
GridSerialRNG &sRNG,
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./lib/qcd/hmc/NerscCheckpointer.h
|
||||
Source file: ./lib/qcd/hmc/BinaryCheckpointer.h
|
||||
|
||||
Copyright (C) 2015
|
||||
Copyright (C) 2016
|
||||
|
||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||
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
|
||||
@ -36,7 +36,6 @@ directory
|
||||
namespace Grid {
|
||||
namespace QCD {
|
||||
|
||||
|
||||
// Simple checkpointer, only binary file
|
||||
template <class Impl>
|
||||
class BinaryHmcCheckpointer : public BaseHmcCheckpointer<Impl> {
|
||||
@ -46,17 +45,17 @@ class BinaryHmcCheckpointer : public BaseHmcCheckpointer<Impl> {
|
||||
public:
|
||||
INHERIT_FIELD_TYPES(Impl); // Gets the Field type, a Lattice object
|
||||
|
||||
// Extract types from the Field
|
||||
// Extract types from the Field
|
||||
typedef typename Field::vector_object vobj;
|
||||
typedef typename vobj::scalar_object sobj;
|
||||
typedef typename getPrecision<sobj>::real_scalar_type sobj_stype;
|
||||
typedef typename sobj::DoublePrecision sobj_double;
|
||||
|
||||
BinaryHmcCheckpointer(CheckpointerParameters& Params_){
|
||||
initialize(Params_);
|
||||
BinaryHmcCheckpointer(const CheckpointerParameters &Params_) {
|
||||
initialize(Params_);
|
||||
}
|
||||
|
||||
void initialize(CheckpointerParameters& Params_){ Params = Params_; }
|
||||
void initialize(const CheckpointerParameters &Params_) { Params = Params_; }
|
||||
|
||||
void truncate(std::string file) {
|
||||
std::ofstream fout(file, std::ios::out);
|
||||
@ -65,19 +64,9 @@ class BinaryHmcCheckpointer : public BaseHmcCheckpointer<Impl> {
|
||||
|
||||
void TrajectoryComplete(int traj, Field &U, GridSerialRNG &sRNG,
|
||||
GridParallelRNG &pRNG) {
|
||||
if ((traj % Params.SaveInterval) == 0) {
|
||||
std::string rng;
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.rngStem << "." << traj;
|
||||
rng = os.str();
|
||||
}
|
||||
std::string config;
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.configStem << "." << traj;
|
||||
config = os.str();
|
||||
}
|
||||
if ((traj % Params.saveInterval) == 0) {
|
||||
std::string config, rng;
|
||||
this->build_filenames(traj, Params, config, rng);
|
||||
|
||||
BinaryIO::BinarySimpleUnmunger<sobj_double, sobj> munge;
|
||||
truncate(rng);
|
||||
@ -93,18 +82,8 @@ class BinaryHmcCheckpointer : public BaseHmcCheckpointer<Impl> {
|
||||
|
||||
void CheckpointRestore(int traj, Field &U, GridSerialRNG &sRNG,
|
||||
GridParallelRNG &pRNG) {
|
||||
std::string rng;
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.rngStem << "." << traj;
|
||||
rng = os.str();
|
||||
}
|
||||
std::string config;
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.configStem << "." << traj;
|
||||
config = os.str();
|
||||
}
|
||||
std::string config, rng;
|
||||
this->build_filenames(traj, Params, config, rng);
|
||||
|
||||
BinaryIO::BinarySimpleMunger<sobj_double, sobj> munge;
|
||||
BinaryIO::readRNGSerial(sRNG, pRNG, rng, 0);
|
||||
|
@ -40,30 +40,23 @@ namespace QCD {
|
||||
|
||||
// Only for Gauge fields
|
||||
template <class Implementation>
|
||||
class ILDGHmcCheckpointer
|
||||
: public BaseHmcCheckpointer<Implementation> {
|
||||
class ILDGHmcCheckpointer : public BaseHmcCheckpointer<Implementation> {
|
||||
private:
|
||||
CheckpointerParameters Params;
|
||||
/*
|
||||
std::string configStem;
|
||||
std::string rngStem;
|
||||
int SaveInterval;
|
||||
std::string format;
|
||||
*/
|
||||
CheckpointerParameters Params;
|
||||
|
||||
public:
|
||||
INHERIT_GIMPL_TYPES(Implementation);
|
||||
|
||||
ILDGHmcCheckpointer(CheckpointerParameters &Params_) { initialize(Params_); }
|
||||
ILDGHmcCheckpointer(const CheckpointerParameters &Params_) { initialize(Params_); }
|
||||
|
||||
void initialize(CheckpointerParameters &Params_) {
|
||||
void initialize(const CheckpointerParameters &Params_) {
|
||||
Params = Params_;
|
||||
|
||||
// check here that the format is valid
|
||||
int ieee32big = (Params.format == std::string("IEEE32BIG"));
|
||||
int ieee32 = (Params.format == std::string("IEEE32"));
|
||||
int ieee32 = (Params.format == std::string("IEEE32"));
|
||||
int ieee64big = (Params.format == std::string("IEEE64BIG"));
|
||||
int ieee64 = (Params.format == std::string("IEEE64"));
|
||||
int ieee64 = (Params.format == std::string("IEEE64"));
|
||||
|
||||
if (!(ieee64big || ieee32 || ieee32big || ieee64)) {
|
||||
std::cout << GridLogError << "Unrecognized file format " << Params.format
|
||||
@ -78,23 +71,13 @@ class ILDGHmcCheckpointer
|
||||
|
||||
void TrajectoryComplete(int traj, GaugeField &U, GridSerialRNG &sRNG,
|
||||
GridParallelRNG &pRNG) {
|
||||
if ((traj % Params.SaveInterval) == 0) {
|
||||
std::string rng;
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.rngStem << "." << traj;
|
||||
rng = os.str();
|
||||
}
|
||||
std::string config;
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.configStem << "." << traj;
|
||||
config = os.str();
|
||||
}
|
||||
if ((traj % Params.saveInterval) == 0) {
|
||||
std::string config, rng;
|
||||
this->build_filenames(traj, Params, config, rng);
|
||||
|
||||
ILDGIO IO(config, ILDGwrite);
|
||||
BinaryIO::writeRNGSerial(sRNG, pRNG, rng, 0);
|
||||
uint32_t csum = IO.writeConfiguration(U, Params.format);
|
||||
uint32_t csum = IO.writeConfiguration(U, Params.format);
|
||||
|
||||
std::cout << GridLogMessage << "Written ILDG Configuration on " << config
|
||||
<< " checksum " << std::hex << csum << std::dec << std::endl;
|
||||
@ -103,22 +86,12 @@ class ILDGHmcCheckpointer
|
||||
|
||||
void CheckpointRestore(int traj, GaugeField &U, GridSerialRNG &sRNG,
|
||||
GridParallelRNG &pRNG) {
|
||||
std::string rng;
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.rngStem << "." << traj;
|
||||
rng = os.str();
|
||||
}
|
||||
std::string config;
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.configStem << "." << traj;
|
||||
config = os.str();
|
||||
}
|
||||
std::string config, rng;
|
||||
this->build_filenames(traj, Params, config, rng);
|
||||
|
||||
ILDGIO IO(config, ILDGread);
|
||||
BinaryIO::readRNGSerial(sRNG, pRNG, rng, 0);
|
||||
uint32_t csum = IO.readConfiguration(U);// format from the header
|
||||
uint32_t csum = IO.readConfiguration(U); // format from the header
|
||||
|
||||
std::cout << GridLogMessage << "Read ILDG Configuration from " << config
|
||||
<< " checksum " << std::hex << csum << std::dec << std::endl;
|
||||
@ -127,5 +100,5 @@ class ILDGHmcCheckpointer
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAVE_LIME
|
||||
#endif // ILDG_CHECKPOINTER
|
||||
#endif // HAVE_LIME
|
||||
#endif // ILDG_CHECKPOINTER
|
||||
|
@ -1,102 +1,80 @@
|
||||
/*************************************************************************************
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./lib/qcd/hmc/NerscCheckpointer.h
|
||||
Source file: ./lib/qcd/hmc/NerscCheckpointer.h
|
||||
|
||||
Copyright (C) 2015
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: paboyle <paboyle@ph.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 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.
|
||||
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.
|
||||
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 */
|
||||
See the full license in the file "LICENSE" in the top level distribution
|
||||
directory
|
||||
*************************************************************************************/
|
||||
/* END LEGAL */
|
||||
#ifndef NERSC_CHECKPOINTER
|
||||
#define NERSC_CHECKPOINTER
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace Grid {
|
||||
namespace QCD {
|
||||
|
||||
namespace Grid{
|
||||
namespace QCD{
|
||||
|
||||
// Only for Gauge fields
|
||||
template<class Gimpl>
|
||||
class NerscHmcCheckpointer : public BaseHmcCheckpointer<Gimpl> {
|
||||
private:
|
||||
CheckpointerParameters Params;
|
||||
// Only for Gauge fields
|
||||
template <class Gimpl>
|
||||
class NerscHmcCheckpointer : public BaseHmcCheckpointer<Gimpl> {
|
||||
private:
|
||||
CheckpointerParameters Params;
|
||||
|
||||
public:
|
||||
INHERIT_GIMPL_TYPES(Gimpl);//
|
||||
public:
|
||||
INHERIT_GIMPL_TYPES(Gimpl); // only for gauge configurations
|
||||
|
||||
NerscHmcCheckpointer(CheckpointerParameters& Params_){
|
||||
initialize(Params_);
|
||||
}
|
||||
NerscHmcCheckpointer(const CheckpointerParameters &Params_) { initialize(Params_); }
|
||||
|
||||
void initialize(CheckpointerParameters &Params_) {
|
||||
Params = Params_;
|
||||
Params.format = "IEEE64BIG"; // fixed, overwrite any other choice
|
||||
}
|
||||
void initialize(const CheckpointerParameters &Params_) {
|
||||
Params = Params_;
|
||||
Params.format = "IEEE64BIG"; // fixed, overwrite any other choice
|
||||
}
|
||||
|
||||
void TrajectoryComplete(int traj, GaugeField &U, GridSerialRNG &sRNG,
|
||||
GridParallelRNG &pRNG) {
|
||||
if ((traj % Params.SaveInterval) == 0) {
|
||||
std::string rng;
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.rngStem << "." << traj;
|
||||
rng = os.str();
|
||||
}
|
||||
std::string config;
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.configStem << "." << traj;
|
||||
config = os.str();
|
||||
}
|
||||
void TrajectoryComplete(int traj, GaugeField &U, GridSerialRNG &sRNG,
|
||||
GridParallelRNG &pRNG) {
|
||||
if ((traj % Params.saveInterval) == 0) {
|
||||
std::string config, rng;
|
||||
this->build_filenames(traj, Params, config, rng);
|
||||
|
||||
int precision32 = 1;
|
||||
int tworow = 0;
|
||||
NerscIO::writeRNGState(sRNG, pRNG, rng);
|
||||
NerscIO::writeConfiguration(U, config, tworow, precision32);
|
||||
}
|
||||
};
|
||||
int precision32 = 1;
|
||||
int tworow = 0;
|
||||
NerscIO::writeRNGState(sRNG, pRNG, rng);
|
||||
NerscIO::writeConfiguration(U, config, tworow, precision32);
|
||||
}
|
||||
};
|
||||
|
||||
void CheckpointRestore(int traj, GaugeField &U, GridSerialRNG &sRNG,
|
||||
GridParallelRNG &pRNG) {
|
||||
std::string rng;
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.rngStem << "." << traj;
|
||||
rng = os.str();
|
||||
}
|
||||
std::string config;
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << Params.configStem << "." << traj;
|
||||
config = os.str();
|
||||
}
|
||||
void CheckpointRestore(int traj, GaugeField &U, GridSerialRNG &sRNG,
|
||||
GridParallelRNG &pRNG) {
|
||||
std::string config, rng;
|
||||
this->build_filenames(traj, Params, config, rng);
|
||||
|
||||
NerscField header;
|
||||
NerscIO::readRNGState(sRNG, pRNG, header, rng);
|
||||
NerscIO::readConfiguration(U, header, config);
|
||||
};
|
||||
|
||||
};
|
||||
}}
|
||||
NerscField header;
|
||||
NerscIO::readRNGState(sRNG, pRNG, header, rng);
|
||||
NerscIO::readConfiguration(U, header, config);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -34,7 +34,7 @@ namespace Grid {
|
||||
namespace QCD {
|
||||
|
||||
//Change here the type of reader
|
||||
typedef Grid::TextReader InputFileReader;
|
||||
typedef Grid::XmlReader InputFileReader;
|
||||
|
||||
|
||||
class HMCRunnerParameters : Serializable {
|
||||
@ -42,11 +42,11 @@ namespace Grid {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(HMCRunnerParameters,
|
||||
double, beta,
|
||||
int, MDsteps,
|
||||
double, TrajectorLength,
|
||||
int, SaveInterval,
|
||||
std::string, format,
|
||||
std::string, conf_prefix,
|
||||
std::string, rng_prefix,
|
||||
double, TrajectoryLength,
|
||||
//int, SaveInterval,
|
||||
//std::string, format,
|
||||
//std::string, conf_prefix,
|
||||
//std::string, rng_prefix,
|
||||
std::string, serial_seeds,
|
||||
std::string, parallel_seeds,
|
||||
);
|
||||
@ -66,6 +66,7 @@ int main(int argc, char **argv) {
|
||||
// Typedefs to simplify notation
|
||||
typedef GenericHMCRunner<MinimumNorm2> HMCWrapper; // Uses the default minimum norm
|
||||
|
||||
// here make a routine to print all the relevant information on the run
|
||||
std::cout << GridLogMessage << "Grid is setup to use " << threads << " threads" << std::endl;
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
@ -74,21 +75,18 @@ int main(int argc, char **argv) {
|
||||
// now working with the text reader but I should drop this support
|
||||
// i need a structured format where every object is able
|
||||
// to locate the required data: XML, JSON, YAML.
|
||||
InputFileReader Reader("input.wilson_gauge.params.xml");
|
||||
HMCRunnerParameters HMCPar;
|
||||
InputFileReader Reader("input.wilson_gauge.params");
|
||||
read(Reader, "HMC", HMCPar);
|
||||
std::cout << GridLogMessage << HMCPar << std::endl;
|
||||
|
||||
// Seeds for the random number generators
|
||||
// generalise, ugly now
|
||||
std::vector<int> SerSeed = strToVec<int>(HMCPar.serial_seeds);
|
||||
std::vector<int> ParSeed = strToVec<int>(HMCPar.parallel_seeds);
|
||||
CheckpointerParameters CP_params(HMCPar.conf_prefix, HMCPar.rng_prefix,
|
||||
HMCPar.SaveInterval, HMCPar.format);
|
||||
|
||||
HMCWrapper TheHMC;
|
||||
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||
TheHMC.Resources.LoadBinaryCheckpointer(CP_params);
|
||||
TheHMC.Resources.LoadBinaryCheckpointer(Reader);
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Collect actions, here use more encapsulation
|
||||
@ -112,7 +110,7 @@ int main(int argc, char **argv) {
|
||||
// here we can simplify a lot if the input file is structured
|
||||
// just pass the input file reader
|
||||
TheHMC.Resources.AddRNGSeeds(SerSeed, ParSeed);
|
||||
TheHMC.MDparameters.set(HMCPar.MDsteps, HMCPar.TrajectorLength);
|
||||
TheHMC.MDparameters.set(HMCPar.MDsteps, HMCPar.TrajectoryLength);
|
||||
|
||||
// eventually smearing here
|
||||
// ...
|
||||
|
Loading…
Reference in New Issue
Block a user