mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Hadrons: modification of registration mechanism to allow for persistent caches
This commit is contained in:
parent
67d72000e7
commit
7a85fddc7e
@ -306,7 +306,7 @@ void Application::configLoop(void)
|
|||||||
<< " " << BIG_SEP << std::endl;
|
<< " " << BIG_SEP << std::endl;
|
||||||
env_.setTrajectory(t);
|
env_.setTrajectory(t);
|
||||||
env_.executeProgram(program_);
|
env_.executeProgram(program_);
|
||||||
env_.freeAll();
|
|
||||||
}
|
}
|
||||||
LOG(Message) << BIG_SEP << " End of measurement " << BIG_SEP << std::endl;
|
LOG(Message) << BIG_SEP << " End of measurement " << BIG_SEP << std::endl;
|
||||||
|
env_.freeAll();
|
||||||
}
|
}
|
||||||
|
@ -409,6 +409,8 @@ Environment::Size Environment::executeProgram(const std::vector<std::string> &p)
|
|||||||
|
|
||||||
// general memory management ///////////////////////////////////////////////////
|
// general memory management ///////////////////////////////////////////////////
|
||||||
void Environment::addObject(const std::string name, const int moduleAddress)
|
void Environment::addObject(const std::string name, const int moduleAddress)
|
||||||
|
{
|
||||||
|
if (!hasObject(name))
|
||||||
{
|
{
|
||||||
ObjInfo info;
|
ObjInfo info;
|
||||||
|
|
||||||
@ -417,6 +419,11 @@ void Environment::addObject(const std::string name, const int moduleAddress)
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HADRON_ERROR("object '" + name + "' already exists");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Environment::registerObject(const unsigned int address,
|
void Environment::registerObject(const unsigned int address,
|
||||||
const unsigned int size, const unsigned int Ls)
|
const unsigned int size, const unsigned int Ls)
|
||||||
@ -444,6 +451,10 @@ void Environment::registerObject(const unsigned int address,
|
|||||||
void Environment::registerObject(const std::string name,
|
void Environment::registerObject(const std::string name,
|
||||||
const unsigned int size, const unsigned int Ls)
|
const unsigned int size, const unsigned int Ls)
|
||||||
{
|
{
|
||||||
|
if (!hasObject(name))
|
||||||
|
{
|
||||||
|
addObject(name);
|
||||||
|
}
|
||||||
registerObject(getObjectAddress(name), size, Ls);
|
registerObject(getObjectAddress(name), size, Ls);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,6 +584,30 @@ bool Environment::hasRegisteredObject(const std::string name) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Environment::hasCreatedObject(const unsigned int address) const
|
||||||
|
{
|
||||||
|
if (hasObject(address))
|
||||||
|
{
|
||||||
|
return (object_[address].data != nullptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Environment::hasCreatedObject(const std::string name) const
|
||||||
|
{
|
||||||
|
if (hasObject(name))
|
||||||
|
{
|
||||||
|
return hasCreatedObject(getObjectAddress(name));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Environment::isObject5d(const unsigned int address) const
|
bool Environment::isObject5d(const unsigned int address) const
|
||||||
{
|
{
|
||||||
return (getObjectLs(address) > 1);
|
return (getObjectLs(address) > 1);
|
||||||
|
@ -137,7 +137,7 @@ public:
|
|||||||
Size executeProgram(const std::vector<std::string> &p);
|
Size executeProgram(const std::vector<std::string> &p);
|
||||||
// general memory management
|
// general memory management
|
||||||
void addObject(const std::string name,
|
void addObject(const std::string name,
|
||||||
const int moduleAddress);
|
const int moduleAddress = -1);
|
||||||
void registerObject(const unsigned int address,
|
void registerObject(const unsigned int address,
|
||||||
const unsigned int size,
|
const unsigned int size,
|
||||||
const unsigned int Ls = 1);
|
const unsigned int Ls = 1);
|
||||||
@ -176,6 +176,8 @@ public:
|
|||||||
bool hasObject(const std::string name) const;
|
bool hasObject(const std::string name) const;
|
||||||
bool hasRegisteredObject(const unsigned int address) const;
|
bool hasRegisteredObject(const unsigned int address) const;
|
||||||
bool hasRegisteredObject(const std::string name) const;
|
bool hasRegisteredObject(const std::string name) const;
|
||||||
|
bool hasCreatedObject(const unsigned int address) const;
|
||||||
|
bool hasCreatedObject(const std::string name) const;
|
||||||
bool isObject5d(const unsigned int address) const;
|
bool isObject5d(const unsigned int address) const;
|
||||||
bool isObject5d(const std::string name) const;
|
bool isObject5d(const std::string name) const;
|
||||||
Environment::Size getTotalSize(void) const;
|
Environment::Size getTotalSize(void) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user