Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions source/adios2/core/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,10 @@ class Engine
void RegisterCreatedVariable(const VariableBase *var);
void RemoveCreatedVars();

/** true: We only need the name of an operator used in Get, not actual operation
*/
bool m_OperatorNameQuery = false;

protected:
/** from ADIOS class passed to Engine created with Open
* if no communicator is passed */
Expand Down
7 changes: 2 additions & 5 deletions source/adios2/core/VariableBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,9 @@ size_t VariableBase::AddOperation(const std::string &type, const Params &paramet
if (!m_Operations.empty() && (m_Operations[0]->m_TypeString == "null"))
{
// if there's a dummy operation in place, replace it
m_Operations[0] = op;
}
else
{
m_Operations.push_back(op);
m_Operations.clear();
}
m_Operations.push_back(op);
}
else
{
Expand Down
8 changes: 8 additions & 0 deletions source/adios2/operator/plugin/PluginOperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ void PluginOperator::PluginInit(const std::string &pluginName, const std::string
// add for external visibility
m_PluginName = pluginName;
m_PluginLibrary = pluginLibrary;
if (m_OperatorNameQuery)
{
auto m = MakeMessage("Plugins", "PluginOperator", "PluginInit",
"Succeeding in load library " + m_PluginLibrary +
" looking for plugin " + m_PluginName,
-1, helper::LogMode::EXCEPTION);
throw PluginLoadFailure(m, pluginLibrary, pluginName);
}
}

size_t PluginOperator::GetEstimatedSize(const size_t ElemCount, const size_t ElemSize,
Expand Down
1 change: 1 addition & 0 deletions source/adios2/operator/plugin/PluginOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class PluginOperator : public core::Operator

std::string m_PluginLibrary;
std::string m_PluginName;
bool m_OperatorNameQuery = false;

protected:
void PluginInit(const std::string &pluginName, const std::string &pluginLibrary);
Expand Down
46 changes: 32 additions & 14 deletions source/adios2/toolkit/format/bp5/BP5Deserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#endif

#include "adios2/operator/OperatorFactory.h"
#include "adios2/operator/plugin/PluginOperator.h"

#include <array>
#include <float.h>
Expand Down Expand Up @@ -1993,22 +1994,39 @@ void BP5Deserializer::FinalizeGet(const ReadRequest &Read, const bool freeAddr)
std::shared_ptr<Operator> op = nullptr;
VariableBase *VB =
static_cast<VariableBase *>(((struct BP5VarRec *)Req.VarRec)->Variable);
if (!VB->m_Operations.empty() && (VB->m_Operations[0]->m_TypeString != "null"))
{
op = VB->m_Operations[0];
}
else
{
Operator::OperatorType compressorType =
static_cast<Operator::OperatorType>(IncomingData[0]);
op = MakeOperator(OperatorTypeToString(compressorType), {});
VB->m_Operations.resize(1);
VB->m_Operations[0] = op;
}
op->SetAccuracy(VB->GetAccuracyRequested());

{
std::lock_guard<std::mutex> lockGuard(mutexDecompress);
// lock_guard protects mods to VB->m_Operations as well as the decompress operator
if (!VB->m_Operations.empty() && (VB->m_Operations[0]->m_TypeString != "null"))
{
op = VB->m_Operations[0];
}
else
{
Operator::OperatorType compressorType =
static_cast<Operator::OperatorType>(IncomingData[0]);
op = MakeOperator(OperatorTypeToString(compressorType), {});
VB->m_Operations.clear();
VB->m_Operations.push_back(op);
if (m_Engine->m_OperatorNameQuery)
{
if (compressorType == Operator::PLUGIN_INTERFACE)
{
auto pop = dynamic_cast<plugin::PluginOperator *>(op.get());
pop->m_OperatorNameQuery = true;
}
else
{
auto m = MakeMessage("Operator", "OperatorFactory", "MakeOperator",
"ADIOS2 compiled with " +
OperatorTypeToString(compressorType) +
" library, operator added",
-1, helper::LogMode::EXCEPTION);
throw MissingOperatorFailure(m, OperatorTypeToString(compressorType));
}
}
}
op->SetAccuracy(VB->GetAccuracyRequested());
core::Decompress(
IncomingData,
((MetaArrayRecOperator *)writer_meta_base)->DataBlockSize[Read.BlockID],
Expand Down
2 changes: 2 additions & 0 deletions source/utils/bpls/bpls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,9 @@ int doList_operators(core::Engine *fp, core::IO *io)
variable->SetBlockSelection(0); \
std::vector<T> dataV; \
dataV.resize(variable->SelectionSize()); \
fp->m_OperatorNameQuery = true; \
fp->Get(*variable, dataV, adios2::Mode::Sync); \
fp->m_OperatorNameQuery = false; \
}
ADIOS2_FOREACH_STDTYPE_1ARG(declare_template_instantiation)
#undef declare_template_instantiation
Expand Down
Loading