Skip to content
Snippets Groups Projects
Unverified Commit 5c64052a authored by williamfgc's avatar williamfgc Committed by GitHub
Browse files

Merge pull request #331 from williamfgc/putd_single

Issue #330 put get deferred for single values not working
parents 8f07fb99 20b31b1f
No related branches found
No related tags found
No related merge requests found
......@@ -125,7 +125,7 @@ public:
/**
* Retrieve a reference pointer to an existing Operator object
* created with DeclareIO.
* created with DefineOperator.
* @return if IO exists returns a reference to existing IO object inside
* ADIOS, otherwise a nullptr
*/
......
......@@ -68,13 +68,13 @@ namespace adios2
void Engine::Put##L(Variable<T> &variable, const T &value) \
{ \
const T valueLocal = value; \
Put##L(variable, &valueLocal); \
PutSync(variable, &valueLocal); \
} \
\
template <class T> \
void Engine::Put##L(const std::string &variableName, const T &value) \
{ \
Put##L(FindVariable<T>(variableName), value); \
PutSync(FindVariable<T>(variableName), value); \
}
ADIOS2_FOREACH_LAUNCH_MODE(declare_launch_mode)
#undef declare_launch_mode
......@@ -125,13 +125,13 @@ ADIOS2_FOREACH_LAUNCH_MODE(declare_launch_mode)
template <class T> \
void Engine::Get##L(Variable<T> &variable, T &value) \
{ \
Get##L(variable, &value); \
GetSync(variable, &value); \
} \
\
template <class T> \
void Engine::Get##L(const std::string &variableName, T &value) \
{ \
Get##L(FindVariable<T>(variableName), value); \
GetSync(FindVariable<T>(variableName), value); \
}
ADIOS2_FOREACH_LAUNCH_MODE(declare_launch_mode)
#undef declare_launch_mode
......
......@@ -60,13 +60,24 @@ StepStatus BPFileReader::BeginStep(StepMode mode, const float timeoutSeconds)
return StepStatus::OK;
}
void BPFileReader::EndStep() { ++m_CurrentStep; }
void BPFileReader::EndStep()
{
if (m_DebugMode && !m_BP3Deserializer.m_PerformedGets)
{
throw std::invalid_argument("ERROR: existing variables subscribed with "
"GetDeferred, did you forget to call "
"PerformGets()?, in call to EndStep\n");
}
++m_CurrentStep;
}
void BPFileReader::PerformGets()
{
const std::map<std::string, SubFileInfoMap> variablesSubfileInfo =
m_BP3Deserializer.PerformGetsVariablesSubFileInfo(m_IO);
ReadVariables(m_IO, variablesSubfileInfo);
m_BP3Deserializer.m_PerformedGets = true;
}
void BPFileReader::Close(const int transportIndex)
......
......@@ -40,6 +40,7 @@ void BPFileReader::GetDeferredCommon(Variable<T> &variable, T *data)
{
// returns immediately
m_BP3Deserializer.GetDeferredVariable(variable, data);
m_BP3Deserializer.m_PerformedGets = false;
}
} // end namespace adios2
......
......@@ -50,10 +50,19 @@ void BPFileWriter::PerformPuts()
{
PutSync(variableName);
}
m_BP3Serializer.m_DeferredVariables.clear();
}
void BPFileWriter::EndStep()
{
if (m_DebugMode && m_BP3Serializer.m_DeferredVariables.size() > 0)
{
throw std::invalid_argument("ERROR: existing variables subscribed with "
"PutDeferred, did you forget to call "
"PerformPuts()?, in call to EndStep\n");
}
m_BP3Serializer.SerializeData(m_IO, true); // true: advances step
}
......
......@@ -31,6 +31,8 @@ public:
/** BP Minifooter fields */
Minifooter m_Minifooter;
bool m_PerformedGets = false;
/**
* Unique constructor
* @param mpiComm
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment