mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-13 01:05:36 +00:00
Hadrons: everything is broken, repairing while implementing the new memory model
This commit is contained in:
parent
f403ab0133
commit
a3fe874a5b
@ -316,3 +316,17 @@ void Application::configLoop(void)
|
|||||||
LOG(Message) << BIG_SEP << " End of measurement " << BIG_SEP << std::endl;
|
LOG(Message) << BIG_SEP << " End of measurement " << BIG_SEP << std::endl;
|
||||||
env().freeAll();
|
env().freeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// memory profile //////////////////////////////////////////////////////////////
|
||||||
|
void Application::memoryProfile(void)
|
||||||
|
{
|
||||||
|
auto graph = env().makeModuleGraph();
|
||||||
|
auto program = graph.topoSort();
|
||||||
|
bool msg;
|
||||||
|
|
||||||
|
msg = HadronsLogMessage.isActive();
|
||||||
|
HadronsLogMessage.Active(false);
|
||||||
|
|
||||||
|
HadronsLogMessage.Active(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -101,6 +101,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
// environment shortcut
|
// environment shortcut
|
||||||
Environment & env(void) const;
|
Environment & env(void) const;
|
||||||
|
// memory profile
|
||||||
|
void memoryProfile(void);
|
||||||
private:
|
private:
|
||||||
long unsigned int locVol_;
|
long unsigned int locVol_;
|
||||||
std::string parameterFileName_{""};
|
std::string parameterFileName_{""};
|
||||||
|
@ -67,6 +67,16 @@ bool Environment::isDryRun(void) const
|
|||||||
return dryRun_;
|
return dryRun_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Environment::memoryProfile(const bool doMemoryProfile)
|
||||||
|
{
|
||||||
|
memoryProfile_ = doMemoryProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Environment::doMemoryProfile(void) const
|
||||||
|
{
|
||||||
|
return memoryProfile_;
|
||||||
|
}
|
||||||
|
|
||||||
// trajectory number ///////////////////////////////////////////////////////////
|
// trajectory number ///////////////////////////////////////////////////////////
|
||||||
void Environment::setTrajectory(const unsigned int traj)
|
void Environment::setTrajectory(const unsigned int traj)
|
||||||
{
|
{
|
||||||
@ -349,10 +359,10 @@ Environment::executeProgram(const std::vector<unsigned int> &p)
|
|||||||
auto it = std::find_if(p.rbegin(), p.rend(), pred);
|
auto it = std::find_if(p.rbegin(), p.rend(), pred);
|
||||||
if (it != p.rend())
|
if (it != p.rend())
|
||||||
{
|
{
|
||||||
freeProg[p.rend() - it - 1].insert(i);
|
freeProg[std::distance(p.rend(), it) - 1].insert(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// program execution
|
// program execution
|
||||||
for (unsigned int i = 0; i < p.size(); ++i)
|
for (unsigned int i = 0; i < p.size(); ++i)
|
||||||
{
|
{
|
||||||
@ -448,6 +458,7 @@ void Environment::addObject(const std::string name, const int moduleAddress)
|
|||||||
|
|
||||||
info.name = name;
|
info.name = name;
|
||||||
info.module = moduleAddress;
|
info.module = moduleAddress;
|
||||||
|
info.data = nullptr;
|
||||||
object_.push_back(std::move(info));
|
object_.push_back(std::move(info));
|
||||||
objectAddress_[name] = static_cast<unsigned int>(object_.size() - 1);
|
objectAddress_[name] = static_cast<unsigned int>(object_.size() - 1);
|
||||||
}
|
}
|
||||||
@ -457,39 +468,6 @@ void Environment::addObject(const std::string name, const int moduleAddress)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Environment::registerObject(const unsigned int address,
|
|
||||||
const unsigned int size, const unsigned int Ls)
|
|
||||||
{
|
|
||||||
if (!hasRegisteredObject(address))
|
|
||||||
{
|
|
||||||
if (hasObject(address))
|
|
||||||
{
|
|
||||||
object_[address].size = size;
|
|
||||||
object_[address].Ls = Ls;
|
|
||||||
object_[address].isRegistered = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HADRON_ERROR("no object with address " + std::to_string(address));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HADRON_ERROR("object with address " + std::to_string(address)
|
|
||||||
+ " already registered");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Environment::registerObject(const std::string name,
|
|
||||||
const unsigned int size, const unsigned int Ls)
|
|
||||||
{
|
|
||||||
if (!hasObject(name))
|
|
||||||
{
|
|
||||||
addObject(name);
|
|
||||||
}
|
|
||||||
registerObject(getObjectAddress(name), size, Ls);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int Environment::getObjectAddress(const std::string name) const
|
unsigned int Environment::getObjectAddress(const std::string name) const
|
||||||
{
|
{
|
||||||
if (hasObject(name))
|
if (hasObject(name))
|
||||||
@ -516,7 +494,7 @@ std::string Environment::getObjectName(const unsigned int address) const
|
|||||||
|
|
||||||
std::string Environment::getObjectType(const unsigned int address) const
|
std::string Environment::getObjectType(const unsigned int address) const
|
||||||
{
|
{
|
||||||
if (hasRegisteredObject(address))
|
if (hasObject(address))
|
||||||
{
|
{
|
||||||
if (object_[address].type)
|
if (object_[address].type)
|
||||||
{
|
{
|
||||||
@ -527,11 +505,6 @@ std::string Environment::getObjectType(const unsigned int address) const
|
|||||||
return "<no type>";
|
return "<no type>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (hasObject(address))
|
|
||||||
{
|
|
||||||
HADRON_ERROR("object with address " + std::to_string(address)
|
|
||||||
+ " exists but is not registered");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HADRON_ERROR("no object with address " + std::to_string(address));
|
HADRON_ERROR("no object with address " + std::to_string(address));
|
||||||
@ -545,15 +518,10 @@ std::string Environment::getObjectType(const std::string name) const
|
|||||||
|
|
||||||
Environment::Size Environment::getObjectSize(const unsigned int address) const
|
Environment::Size Environment::getObjectSize(const unsigned int address) const
|
||||||
{
|
{
|
||||||
if (hasRegisteredObject(address))
|
if (hasObject(address))
|
||||||
{
|
{
|
||||||
return object_[address].size;
|
return object_[address].size;
|
||||||
}
|
}
|
||||||
else if (hasObject(address))
|
|
||||||
{
|
|
||||||
HADRON_ERROR("object with address " + std::to_string(address)
|
|
||||||
+ " exists but is not registered");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HADRON_ERROR("no object with address " + std::to_string(address));
|
HADRON_ERROR("no object with address " + std::to_string(address));
|
||||||
@ -584,15 +552,10 @@ unsigned int Environment::getObjectModule(const std::string name) const
|
|||||||
|
|
||||||
unsigned int Environment::getObjectLs(const unsigned int address) const
|
unsigned int Environment::getObjectLs(const unsigned int address) const
|
||||||
{
|
{
|
||||||
if (hasRegisteredObject(address))
|
if (hasObject(address))
|
||||||
{
|
{
|
||||||
return object_[address].Ls;
|
return object_[address].Ls;
|
||||||
}
|
}
|
||||||
else if (hasObject(address))
|
|
||||||
{
|
|
||||||
HADRON_ERROR("object with address " + std::to_string(address)
|
|
||||||
+ " exists but is not registered");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HADRON_ERROR("no object with address " + std::to_string(address));
|
HADRON_ERROR("no object with address " + std::to_string(address));
|
||||||
@ -616,30 +579,6 @@ bool Environment::hasObject(const std::string name) const
|
|||||||
return ((it != objectAddress_.end()) and hasObject(it->second));
|
return ((it != objectAddress_.end()) and hasObject(it->second));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Environment::hasRegisteredObject(const unsigned int address) const
|
|
||||||
{
|
|
||||||
if (hasObject(address))
|
|
||||||
{
|
|
||||||
return object_[address].isRegistered;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Environment::hasRegisteredObject(const std::string name) const
|
|
||||||
{
|
|
||||||
if (hasObject(name))
|
|
||||||
{
|
|
||||||
return hasRegisteredObject(getObjectAddress(name));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Environment::hasCreatedObject(const unsigned int address) const
|
bool Environment::hasCreatedObject(const unsigned int address) const
|
||||||
{
|
{
|
||||||
if (hasObject(address))
|
if (hasObject(address))
|
||||||
@ -680,10 +619,7 @@ Environment::Size Environment::getTotalSize(void) const
|
|||||||
|
|
||||||
for (auto &o: object_)
|
for (auto &o: object_)
|
||||||
{
|
{
|
||||||
if (o.isRegistered)
|
size += o.size;
|
||||||
{
|
|
||||||
size += o.size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
@ -738,7 +674,7 @@ bool Environment::freeObject(const unsigned int address)
|
|||||||
{
|
{
|
||||||
if (!hasOwners(address))
|
if (!hasOwners(address))
|
||||||
{
|
{
|
||||||
if (!isDryRun() and object_[address].isRegistered)
|
if (!isDryRun())
|
||||||
{
|
{
|
||||||
LOG(Message) << "Destroying object '" << object_[address].name
|
LOG(Message) << "Destroying object '" << object_[address].name
|
||||||
<< "'" << std::endl;
|
<< "'" << std::endl;
|
||||||
@ -747,10 +683,8 @@ bool Environment::freeObject(const unsigned int address)
|
|||||||
{
|
{
|
||||||
object_[p].owners.erase(address);
|
object_[p].owners.erase(address);
|
||||||
}
|
}
|
||||||
object_[address].size = 0;
|
object_[address].size = 0;
|
||||||
object_[address].Ls = 0;
|
object_[address].type = nullptr;
|
||||||
object_[address].isRegistered = false;
|
|
||||||
object_[address].type = nullptr;
|
|
||||||
object_[address].owners.clear();
|
object_[address].owners.clear();
|
||||||
object_[address].properties.clear();
|
object_[address].properties.clear();
|
||||||
object_[address].data.reset(nullptr);
|
object_[address].data.reset(nullptr);
|
||||||
|
@ -83,12 +83,12 @@ private:
|
|||||||
std::string name;
|
std::string name;
|
||||||
ModPt data{nullptr};
|
ModPt data{nullptr};
|
||||||
std::vector<unsigned int> input;
|
std::vector<unsigned int> input;
|
||||||
|
size_t maxAllocated;
|
||||||
};
|
};
|
||||||
struct ObjInfo
|
struct ObjInfo
|
||||||
{
|
{
|
||||||
Size size{0};
|
Size size{0};
|
||||||
unsigned int Ls{0};
|
unsigned int Ls{0};
|
||||||
bool isRegistered{false};
|
|
||||||
const std::type_info *type{nullptr};
|
const std::type_info *type{nullptr};
|
||||||
std::string name;
|
std::string name;
|
||||||
int module{-1};
|
int module{-1};
|
||||||
@ -99,6 +99,8 @@ public:
|
|||||||
// dry run
|
// dry run
|
||||||
void dryRun(const bool isDry);
|
void dryRun(const bool isDry);
|
||||||
bool isDryRun(void) const;
|
bool isDryRun(void) const;
|
||||||
|
void memoryProfile(const bool doMemoryProfile);
|
||||||
|
bool doMemoryProfile(void) const;
|
||||||
// trajectory number
|
// trajectory number
|
||||||
void setTrajectory(const unsigned int traj);
|
void setTrajectory(const unsigned int traj);
|
||||||
unsigned int getTrajectory(void) const;
|
unsigned int getTrajectory(void) const;
|
||||||
@ -143,32 +145,17 @@ public:
|
|||||||
// general memory management
|
// general memory management
|
||||||
void addObject(const std::string name,
|
void addObject(const std::string name,
|
||||||
const int moduleAddress = -1);
|
const int moduleAddress = -1);
|
||||||
void registerObject(const unsigned int address,
|
template <typename T, typename ... Ts>
|
||||||
const unsigned int size,
|
void createObject(const std::string name,
|
||||||
const unsigned int Ls = 1);
|
const unsigned int Ls,
|
||||||
void registerObject(const std::string name,
|
Ts ... args);
|
||||||
const unsigned int size,
|
|
||||||
const unsigned int Ls = 1);
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
unsigned int lattice4dSize(void) const;
|
void createLattice(const std::string name,
|
||||||
template <typename T>
|
const unsigned int Ls = 1);
|
||||||
void registerLattice(const unsigned int address,
|
|
||||||
const unsigned int Ls = 1);
|
|
||||||
template <typename T>
|
|
||||||
void registerLattice(const std::string name,
|
|
||||||
const unsigned int Ls = 1);
|
|
||||||
template <typename T>
|
|
||||||
void setObject(const unsigned int address, T *object);
|
|
||||||
template <typename T>
|
|
||||||
void setObject(const std::string name, T *object);
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T * getObject(const unsigned int address) const;
|
T * getObject(const unsigned int address) const;
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T * getObject(const std::string name) const;
|
T * getObject(const std::string name) const;
|
||||||
template <typename T>
|
|
||||||
T * createLattice(const unsigned int address);
|
|
||||||
template <typename T>
|
|
||||||
T * createLattice(const std::string name);
|
|
||||||
unsigned int getObjectAddress(const std::string name) const;
|
unsigned int getObjectAddress(const std::string name) const;
|
||||||
std::string getObjectName(const unsigned int address) const;
|
std::string getObjectName(const unsigned int address) const;
|
||||||
std::string getObjectType(const unsigned int address) const;
|
std::string getObjectType(const unsigned int address) const;
|
||||||
@ -181,8 +168,6 @@ public:
|
|||||||
unsigned int getObjectLs(const std::string name) const;
|
unsigned int getObjectLs(const std::string name) const;
|
||||||
bool hasObject(const unsigned int address) const;
|
bool hasObject(const unsigned int address) const;
|
||||||
bool hasObject(const std::string name) const;
|
bool hasObject(const std::string name) const;
|
||||||
bool hasRegisteredObject(const unsigned int address) const;
|
|
||||||
bool hasRegisteredObject(const std::string name) const;
|
|
||||||
bool hasCreatedObject(const unsigned int address) const;
|
bool hasCreatedObject(const unsigned int address) const;
|
||||||
bool hasCreatedObject(const std::string name) const;
|
bool hasCreatedObject(const std::string name) const;
|
||||||
bool isObject5d(const unsigned int address) const;
|
bool isObject5d(const unsigned int address) const;
|
||||||
@ -204,7 +189,7 @@ public:
|
|||||||
void printContent(void);
|
void printContent(void);
|
||||||
private:
|
private:
|
||||||
// general
|
// general
|
||||||
bool dryRun_{false};
|
bool dryRun_{false}, memoryProfile_{false};
|
||||||
unsigned int traj_, locVol_;
|
unsigned int traj_, locVol_;
|
||||||
// grids
|
// grids
|
||||||
std::vector<int> dim_;
|
std::vector<int> dim_;
|
||||||
@ -296,56 +281,45 @@ M * Environment::getModule(const std::string name) const
|
|||||||
return getModule<M>(getModuleAddress(name));
|
return getModule<M>(getModuleAddress(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T, typename ... Ts>
|
||||||
unsigned int Environment::lattice4dSize(void) const
|
void Environment::createObject(const std::string name, const unsigned int Ls,
|
||||||
|
Ts ... args)
|
||||||
{
|
{
|
||||||
return sizeof(typename T::vector_object)/getGrid()->Nsimd();
|
if (!hasObject(name))
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void Environment::registerLattice(const unsigned int address,
|
|
||||||
const unsigned int Ls)
|
|
||||||
{
|
|
||||||
createGrid(Ls);
|
|
||||||
registerObject(address, Ls*lattice4dSize<T>(), Ls);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void Environment::registerLattice(const std::string name, const unsigned int Ls)
|
|
||||||
{
|
|
||||||
createGrid(Ls);
|
|
||||||
registerObject(name, Ls*lattice4dSize<T>(), Ls);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void Environment::setObject(const unsigned int address, T *object)
|
|
||||||
{
|
|
||||||
if (hasRegisteredObject(address))
|
|
||||||
{
|
{
|
||||||
object_[address].data.reset(new Holder<T>(object));
|
addObject(name);
|
||||||
object_[address].type = &typeid(T);
|
|
||||||
}
|
}
|
||||||
else if (hasObject(address))
|
|
||||||
|
unsigned int address = getObjectAddress(name);
|
||||||
|
|
||||||
|
if (!object_[address].data)
|
||||||
{
|
{
|
||||||
HADRON_ERROR("object with address " + std::to_string(address) +
|
MemoryStats memStats;
|
||||||
" exists but is not registered");
|
|
||||||
|
MemoryProfiler::stats = &memStats;
|
||||||
|
object_[address].Ls = Ls;
|
||||||
|
object_[address].data.reset(new Holder<T>(new T(args...)));
|
||||||
|
object_[address].size = memStats.totalAllocated;
|
||||||
|
object_[address].type = &typeid(T);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HADRON_ERROR("no object with address " + std::to_string(address));
|
HADRON_ERROR("object '" + name + "' already allocated");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Environment::setObject(const std::string name, T *object)
|
void Environment::createLattice(const std::string name, const unsigned int Ls)
|
||||||
{
|
{
|
||||||
setObject(getObjectAddress(name), object);
|
GridCartesian *g = getGrid(Ls);
|
||||||
|
|
||||||
|
createObject<T>(name, Ls, g);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T * Environment::getObject(const unsigned int address) const
|
T * Environment::getObject(const unsigned int address) const
|
||||||
{
|
{
|
||||||
if (hasRegisteredObject(address))
|
if (hasObject(address))
|
||||||
{
|
{
|
||||||
if (auto h = dynamic_cast<Holder<T> *>(object_[address].data.get()))
|
if (auto h = dynamic_cast<Holder<T> *>(object_[address].data.get()))
|
||||||
{
|
{
|
||||||
@ -358,11 +332,6 @@ T * Environment::getObject(const unsigned int address) const
|
|||||||
"' (has type '" + getObjectType(address) + "')");
|
"' (has type '" + getObjectType(address) + "')");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (hasObject(address))
|
|
||||||
{
|
|
||||||
HADRON_ERROR("object with address " + std::to_string(address) +
|
|
||||||
" exists but is not registered");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HADRON_ERROR("no object with address " + std::to_string(address));
|
HADRON_ERROR("no object with address " + std::to_string(address));
|
||||||
@ -375,26 +344,10 @@ T * Environment::getObject(const std::string name) const
|
|||||||
return getObject<T>(getObjectAddress(name));
|
return getObject<T>(getObjectAddress(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
T * Environment::createLattice(const unsigned int address)
|
|
||||||
{
|
|
||||||
GridCartesian *g = getGrid(getObjectLs(address));
|
|
||||||
|
|
||||||
setObject(address, new T(g));
|
|
||||||
|
|
||||||
return getObject<T>(address);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
T * Environment::createLattice(const std::string name)
|
|
||||||
{
|
|
||||||
return createLattice<T>(getObjectAddress(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool Environment::isObjectOfType(const unsigned int address) const
|
bool Environment::isObjectOfType(const unsigned int address) const
|
||||||
{
|
{
|
||||||
if (hasRegisteredObject(address))
|
if (hasObject(address))
|
||||||
{
|
{
|
||||||
if (auto h = dynamic_cast<Holder<T> *>(object_[address].data.get()))
|
if (auto h = dynamic_cast<Holder<T> *>(object_[address].data.get()))
|
||||||
{
|
{
|
||||||
@ -405,11 +358,6 @@ bool Environment::isObjectOfType(const unsigned int address) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (hasObject(address))
|
|
||||||
{
|
|
||||||
HADRON_ERROR("object with address " + std::to_string(address) +
|
|
||||||
" exists but is not registered");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HADRON_ERROR("no object with address " + std::to_string(address));
|
HADRON_ERROR("no object with address " + std::to_string(address));
|
||||||
|
@ -88,6 +88,12 @@ static ns##mod##ModuleRegistrar ns##mod##ModuleRegistrarInstance;
|
|||||||
|
|
||||||
#define ARG(...) __VA_ARGS__
|
#define ARG(...) __VA_ARGS__
|
||||||
|
|
||||||
|
#define mCreateObj(type, name, Ls, ...)\
|
||||||
|
env().template createObject<type>(name, Ls, __VA_ARGS__)
|
||||||
|
|
||||||
|
#define mGetObj(type, name)\
|
||||||
|
*env().template getObject<type>(name)
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Module class *
|
* Module class *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
@ -30,31 +30,31 @@ See the full license in the file "LICENSE" in the top level distribution directo
|
|||||||
|
|
||||||
#include <Grid/Hadrons/Modules/MAction/DWF.hpp>
|
#include <Grid/Hadrons/Modules/MAction/DWF.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MAction/Wilson.hpp>
|
#include <Grid/Hadrons/Modules/MAction/Wilson.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MContraction/Baryon.hpp>
|
// #include <Grid/Hadrons/Modules/MContraction/Baryon.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MContraction/DiscLoop.hpp>
|
// #include <Grid/Hadrons/Modules/MContraction/DiscLoop.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MContraction/Gamma3pt.hpp>
|
// #include <Grid/Hadrons/Modules/MContraction/Gamma3pt.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MContraction/Meson.hpp>
|
// #include <Grid/Hadrons/Modules/MContraction/Meson.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MContraction/WardIdentity.hpp>
|
// #include <Grid/Hadrons/Modules/MContraction/WardIdentity.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MContraction/WeakHamiltonian.hpp>
|
// #include <Grid/Hadrons/Modules/MContraction/WeakHamiltonian.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MContraction/WeakHamiltonianEye.hpp>
|
// #include <Grid/Hadrons/Modules/MContraction/WeakHamiltonianEye.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MContraction/WeakHamiltonianNonEye.hpp>
|
// #include <Grid/Hadrons/Modules/MContraction/WeakHamiltonianNonEye.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MContraction/WeakNeutral4ptDisc.hpp>
|
// #include <Grid/Hadrons/Modules/MContraction/WeakNeutral4ptDisc.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MFermion/GaugeProp.hpp>
|
// #include <Grid/Hadrons/Modules/MFermion/GaugeProp.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MGauge/Load.hpp>
|
// #include <Grid/Hadrons/Modules/MGauge/Load.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MGauge/Random.hpp>
|
// #include <Grid/Hadrons/Modules/MGauge/Random.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MGauge/StochEm.hpp>
|
// #include <Grid/Hadrons/Modules/MGauge/StochEm.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MGauge/Unit.hpp>
|
#include <Grid/Hadrons/Modules/MGauge/Unit.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MLoop/NoiseLoop.hpp>
|
// #include <Grid/Hadrons/Modules/MLoop/NoiseLoop.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MScalar/ChargedProp.hpp>
|
// #include <Grid/Hadrons/Modules/MScalar/ChargedProp.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MScalar/FreeProp.hpp>
|
// #include <Grid/Hadrons/Modules/MScalar/FreeProp.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MScalar/Scalar.hpp>
|
// #include <Grid/Hadrons/Modules/MScalar/Scalar.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSink/Point.hpp>
|
// #include <Grid/Hadrons/Modules/MSink/Point.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSink/Smear.hpp>
|
// #include <Grid/Hadrons/Modules/MSink/Smear.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSolver/RBPrecCG.hpp>
|
#include <Grid/Hadrons/Modules/MSolver/RBPrecCG.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSource/Point.hpp>
|
// #include <Grid/Hadrons/Modules/MSource/Point.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSource/SeqConserved.hpp>
|
// #include <Grid/Hadrons/Modules/MSource/SeqConserved.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSource/SeqGamma.hpp>
|
// #include <Grid/Hadrons/Modules/MSource/SeqGamma.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSource/Wall.hpp>
|
// #include <Grid/Hadrons/Modules/MSource/Wall.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSource/Z2.hpp>
|
// #include <Grid/Hadrons/Modules/MSource/Z2.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MUtilities/TestSeqConserved.hpp>
|
// #include <Grid/Hadrons/Modules/MUtilities/TestSeqConserved.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MUtilities/TestSeqGamma.hpp>
|
// #include <Grid/Hadrons/Modules/MUtilities/TestSeqGamma.hpp>
|
||||||
|
@ -102,37 +102,30 @@ std::vector<std::string> TDWF<FImpl>::getOutput(void)
|
|||||||
// setup ///////////////////////////////////////////////////////////////////////
|
// setup ///////////////////////////////////////////////////////////////////////
|
||||||
template <typename FImpl>
|
template <typename FImpl>
|
||||||
void TDWF<FImpl>::setup(void)
|
void TDWF<FImpl>::setup(void)
|
||||||
{
|
|
||||||
unsigned int size;
|
|
||||||
|
|
||||||
size = 2*env().template lattice4dSize<typename FImpl::DoubledGaugeField>();
|
|
||||||
env().registerObject(getName(), size, par().Ls);
|
|
||||||
}
|
|
||||||
|
|
||||||
// execution ///////////////////////////////////////////////////////////////////
|
|
||||||
template <typename FImpl>
|
|
||||||
void TDWF<FImpl>::execute(void)
|
|
||||||
{
|
{
|
||||||
LOG(Message) << "Setting up domain wall fermion matrix with m= "
|
LOG(Message) << "Setting up domain wall fermion matrix with m= "
|
||||||
<< par().mass << ", M5= " << par().M5 << " and Ls= "
|
<< par().mass << ", M5= " << par().M5 << " and Ls= "
|
||||||
<< par().Ls << " using gauge field '" << par().gauge << "'"
|
<< par().Ls << " using gauge field '" << par().gauge << "'"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
LOG(Message) << "Fermion boundary conditions: " << par().boundary
|
LOG(Message) << "Fermion boundary conditions: " << par().boundary
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
env().createGrid(par().Ls);
|
env().createGrid(par().Ls);
|
||||||
auto &U = *env().template getObject<LatticeGaugeField>(par().gauge);
|
auto &U = mGetObj(LatticeGaugeField, par().gauge);
|
||||||
auto &g4 = *env().getGrid();
|
auto &g4 = *env().getGrid();
|
||||||
auto &grb4 = *env().getRbGrid();
|
auto &grb4 = *env().getRbGrid();
|
||||||
auto &g5 = *env().getGrid(par().Ls);
|
auto &g5 = *env().getGrid(par().Ls);
|
||||||
auto &grb5 = *env().getRbGrid(par().Ls);
|
auto &grb5 = *env().getRbGrid(par().Ls);
|
||||||
std::vector<Complex> boundary = strToVec<Complex>(par().boundary);
|
std::vector<Complex> boundary = strToVec<Complex>(par().boundary);
|
||||||
typename DomainWallFermion<FImpl>::ImplParams implParams(boundary);
|
typename DomainWallFermion<FImpl>::ImplParams implParams(boundary);
|
||||||
FMat *fMatPt = new DomainWallFermion<FImpl>(U, g5, grb5, g4, grb4,
|
mCreateObj(DomainWallFermion<FImpl>, getName(), par().Ls,
|
||||||
par().mass, par().M5,
|
U, g5, grb5, g4, grb4, par().mass, par().M5, implParams);
|
||||||
implParams);
|
|
||||||
env().setObject(getName(), fMatPt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
|
template <typename FImpl>
|
||||||
|
void TDWF<FImpl>::execute(void)
|
||||||
|
{}
|
||||||
|
|
||||||
END_MODULE_NAMESPACE
|
END_MODULE_NAMESPACE
|
||||||
|
|
||||||
END_HADRONS_NAMESPACE
|
END_HADRONS_NAMESPACE
|
||||||
|
@ -101,29 +101,23 @@ std::vector<std::string> TWilson<FImpl>::getOutput(void)
|
|||||||
template <typename FImpl>
|
template <typename FImpl>
|
||||||
void TWilson<FImpl>::setup(void)
|
void TWilson<FImpl>::setup(void)
|
||||||
{
|
{
|
||||||
unsigned int size;
|
LOG(Message) << "Setting up TWilson fermion matrix with m= " << par().mass
|
||||||
|
<< " using gauge field '" << par().gauge << "'" << std::endl;
|
||||||
size = 2*env().template lattice4dSize<typename FImpl::DoubledGaugeField>();
|
LOG(Message) << "Fermion boundary conditions: " << par().boundary
|
||||||
env().registerObject(getName(), size);
|
<< std::endl;
|
||||||
|
auto &U = mGetObj(LatticeGaugeField, par().gauge);
|
||||||
|
auto &grid = *env().getGrid();
|
||||||
|
auto &gridRb = *env().getRbGrid();
|
||||||
|
std::vector<Complex> boundary = strToVec<Complex>(par().boundary);
|
||||||
|
typename WilsonFermion<FImpl>::ImplParams implParams(boundary);
|
||||||
|
mCreateObj(WilsonFermion<FImpl>, getName(), 1, U, grid, gridRb, par().mass,
|
||||||
|
implParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
// execution ///////////////////////////////////////////////////////////////////
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
template <typename FImpl>
|
template <typename FImpl>
|
||||||
void TWilson<FImpl>::execute()
|
void TWilson<FImpl>::execute()
|
||||||
{
|
{}
|
||||||
LOG(Message) << "Setting up TWilson fermion matrix with m= " << par().mass
|
|
||||||
<< " using gauge field '" << par().gauge << "'" << std::endl;
|
|
||||||
LOG(Message) << "Fermion boundary conditions: " << par().boundary
|
|
||||||
<< std::endl;
|
|
||||||
auto &U = *env().template getObject<LatticeGaugeField>(par().gauge);
|
|
||||||
auto &grid = *env().getGrid();
|
|
||||||
auto &gridRb = *env().getRbGrid();
|
|
||||||
std::vector<Complex> boundary = strToVec<Complex>(par().boundary);
|
|
||||||
typename WilsonFermion<FImpl>::ImplParams implParams(boundary);
|
|
||||||
FMat *fMatPt = new WilsonFermion<FImpl>(U, grid, gridRb, par().mass,
|
|
||||||
implParams);
|
|
||||||
env().setObject(getName(), fMatPt);
|
|
||||||
}
|
|
||||||
|
|
||||||
END_MODULE_NAMESPACE
|
END_MODULE_NAMESPACE
|
||||||
|
|
||||||
|
@ -57,13 +57,13 @@ std::vector<std::string> TUnit::getOutput(void)
|
|||||||
// setup ///////////////////////////////////////////////////////////////////////
|
// setup ///////////////////////////////////////////////////////////////////////
|
||||||
void TUnit::setup(void)
|
void TUnit::setup(void)
|
||||||
{
|
{
|
||||||
env().registerLattice<LatticeGaugeField>(getName());
|
mCreateObj(LatticeGaugeField, getName(), 1, env().getGrid());
|
||||||
}
|
}
|
||||||
|
|
||||||
// execution ///////////////////////////////////////////////////////////////////
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
void TUnit::execute(void)
|
void TUnit::execute(void)
|
||||||
{
|
{
|
||||||
LOG(Message) << "Creating unit gauge configuration" << std::endl;
|
LOG(Message) << "Creating unit gauge configuration" << std::endl;
|
||||||
LatticeGaugeField &U = *env().createLattice<LatticeGaugeField>(getName());
|
auto &U = mGetObj(LatticeGaugeField, getName());
|
||||||
SU3::ColdConfiguration(*env().get4dRng(), U);
|
SU3::ColdConfiguration(*env().get4dRng(), U);
|
||||||
}
|
}
|
||||||
|
@ -100,17 +100,12 @@ std::vector<std::string> TRBPrecCG<FImpl>::getOutput(void)
|
|||||||
template <typename FImpl>
|
template <typename FImpl>
|
||||||
void TRBPrecCG<FImpl>::setup(void)
|
void TRBPrecCG<FImpl>::setup(void)
|
||||||
{
|
{
|
||||||
auto Ls = env().getObjectLs(par().action);
|
LOG(Message) << "setting up Schur red-black preconditioned CG for"
|
||||||
|
<< " action '" << par().action << "' with residual "
|
||||||
env().registerObject(getName(), 0, Ls);
|
<< par().residual << std::endl;
|
||||||
env().addOwnership(getName(), par().action);
|
|
||||||
}
|
|
||||||
|
|
||||||
// execution ///////////////////////////////////////////////////////////////////
|
auto Ls = env().getObjectLs(par().action);
|
||||||
template <typename FImpl>
|
auto &mat = mGetObj(FMat, par().action);
|
||||||
void TRBPrecCG<FImpl>::execute(void)
|
|
||||||
{
|
|
||||||
auto &mat = *(env().template getObject<FMat>(par().action));
|
|
||||||
auto solver = [&mat, this](FermionField &sol, const FermionField &source)
|
auto solver = [&mat, this](FermionField &sol, const FermionField &source)
|
||||||
{
|
{
|
||||||
ConjugateGradient<FermionField> cg(par().residual, 10000);
|
ConjugateGradient<FermionField> cg(par().residual, 10000);
|
||||||
@ -118,13 +113,15 @@ void TRBPrecCG<FImpl>::execute(void)
|
|||||||
|
|
||||||
schurSolver(mat, source, sol);
|
schurSolver(mat, source, sol);
|
||||||
};
|
};
|
||||||
|
mCreateObj(SolverFn, getName(), Ls, solver);
|
||||||
LOG(Message) << "setting up Schur red-black preconditioned CG for"
|
env().addOwnership(getName(), par().action);
|
||||||
<< " action '" << par().action << "' with residual "
|
|
||||||
<< par().residual << std::endl;
|
|
||||||
env().setObject(getName(), new SolverFn(solver));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
|
template <typename FImpl>
|
||||||
|
void TRBPrecCG<FImpl>::execute(void)
|
||||||
|
{}
|
||||||
|
|
||||||
END_MODULE_NAMESPACE
|
END_MODULE_NAMESPACE
|
||||||
|
|
||||||
END_HADRONS_NAMESPACE
|
END_HADRONS_NAMESPACE
|
||||||
|
@ -1,42 +1,44 @@
|
|||||||
modules_cc =\
|
modules_cc =\
|
||||||
Modules/MContraction/WeakHamiltonianEye.cc \
|
Modules/MGauge/Unit.cc
|
||||||
Modules/MContraction/WeakHamiltonianNonEye.cc \
|
# Modules/MContraction/WeakHamiltonianEye.cc \
|
||||||
Modules/MContraction/WeakNeutral4ptDisc.cc \
|
# Modules/MContraction/WeakHamiltonianNonEye.cc \
|
||||||
Modules/MGauge/Load.cc \
|
# Modules/MContraction/WeakNeutral4ptDisc.cc \
|
||||||
Modules/MGauge/Random.cc \
|
# Modules/MGauge/Load.cc \
|
||||||
Modules/MGauge/StochEm.cc \
|
# Modules/MGauge/Random.cc \
|
||||||
Modules/MGauge/Unit.cc \
|
# Modules/MGauge/StochEm.cc \
|
||||||
Modules/MScalar/ChargedProp.cc \
|
# Modules/MScalar/ChargedProp.cc \
|
||||||
Modules/MScalar/FreeProp.cc
|
# Modules/MScalar/FreeProp.cc
|
||||||
|
|
||||||
modules_hpp =\
|
modules_hpp =\
|
||||||
Modules/MAction/DWF.hpp \
|
Modules/MAction/DWF.hpp \
|
||||||
Modules/MAction/Wilson.hpp \
|
Modules/MAction/Wilson.hpp \
|
||||||
Modules/MContraction/Baryon.hpp \
|
|
||||||
Modules/MContraction/DiscLoop.hpp \
|
|
||||||
Modules/MContraction/Gamma3pt.hpp \
|
|
||||||
Modules/MContraction/Meson.hpp \
|
|
||||||
Modules/MContraction/WardIdentity.hpp \
|
|
||||||
Modules/MContraction/WeakHamiltonian.hpp \
|
|
||||||
Modules/MContraction/WeakHamiltonianEye.hpp \
|
|
||||||
Modules/MContraction/WeakHamiltonianNonEye.hpp \
|
|
||||||
Modules/MContraction/WeakNeutral4ptDisc.hpp \
|
|
||||||
Modules/MFermion/GaugeProp.hpp \
|
|
||||||
Modules/MGauge/Load.hpp \
|
|
||||||
Modules/MGauge/Random.hpp \
|
|
||||||
Modules/MGauge/StochEm.hpp \
|
|
||||||
Modules/MGauge/Unit.hpp \
|
Modules/MGauge/Unit.hpp \
|
||||||
Modules/MLoop/NoiseLoop.hpp \
|
Modules/MSolver/RBPrecCG.hpp
|
||||||
Modules/MScalar/ChargedProp.hpp \
|
|
||||||
Modules/MScalar/FreeProp.hpp \
|
# Modules/MContraction/Baryon.hpp \
|
||||||
Modules/MScalar/Scalar.hpp \
|
# Modules/MContraction/DiscLoop.hpp \
|
||||||
Modules/MSink/Point.hpp \
|
# Modules/MContraction/Gamma3pt.hpp \
|
||||||
Modules/MSink/Smear.hpp \
|
# Modules/MContraction/Meson.hpp \
|
||||||
Modules/MSolver/RBPrecCG.hpp \
|
# Modules/MContraction/WardIdentity.hpp \
|
||||||
Modules/MSource/Point.hpp \
|
# Modules/MContraction/WeakHamiltonian.hpp \
|
||||||
Modules/MSource/SeqConserved.hpp \
|
# Modules/MContraction/WeakHamiltonianEye.hpp \
|
||||||
Modules/MSource/SeqGamma.hpp \
|
# Modules/MContraction/WeakHamiltonianNonEye.hpp \
|
||||||
Modules/MSource/Wall.hpp \
|
# Modules/MContraction/WeakNeutral4ptDisc.hpp \
|
||||||
Modules/MSource/Z2.hpp \
|
# Modules/MFermion/GaugeProp.hpp \
|
||||||
Modules/MUtilities/TestSeqConserved.hpp \
|
# Modules/MGauge/Load.hpp \
|
||||||
Modules/MUtilities/TestSeqGamma.hpp
|
# Modules/MGauge/Random.hpp \
|
||||||
|
# Modules/MGauge/StochEm.hpp \
|
||||||
|
# Modules/MLoop/NoiseLoop.hpp \
|
||||||
|
# Modules/MScalar/ChargedProp.hpp \
|
||||||
|
# Modules/MScalar/FreeProp.hpp \
|
||||||
|
# Modules/MScalar/Scalar.hpp \
|
||||||
|
# Modules/MSink/Point.hpp \
|
||||||
|
# Modules/MSink/Smear.hpp \
|
||||||
|
# Modules/MSolver/RBPrecCG.hpp \
|
||||||
|
# Modules/MSource/Point.hpp \
|
||||||
|
# Modules/MSource/SeqConserved.hpp \
|
||||||
|
# Modules/MSource/SeqGamma.hpp \
|
||||||
|
# Modules/MSource/Wall.hpp \
|
||||||
|
# Modules/MSource/Z2.hpp \
|
||||||
|
# Modules/MUtilities/TestSeqConserved.hpp \
|
||||||
|
# Modules/MUtilities/TestSeqGamma.hpp
|
||||||
|
Loading…
Reference in New Issue
Block a user