|
31 | 31 | #endif |
32 | 32 |
|
33 | 33 | #include "adios2/operator/OperatorFactory.h" |
| 34 | +#include "adios2/operator/plugin/PluginOperator.h" |
34 | 35 |
|
35 | 36 | #include <array> |
36 | 37 | #include <float.h> |
@@ -1993,22 +1994,39 @@ void BP5Deserializer::FinalizeGet(const ReadRequest &Read, const bool freeAddr) |
1993 | 1994 | std::shared_ptr<Operator> op = nullptr; |
1994 | 1995 | VariableBase *VB = |
1995 | 1996 | static_cast<VariableBase *>(((struct BP5VarRec *)Req.VarRec)->Variable); |
1996 | | - if (!VB->m_Operations.empty() && (VB->m_Operations[0]->m_TypeString != "null")) |
1997 | | - { |
1998 | | - op = VB->m_Operations[0]; |
1999 | | - } |
2000 | | - else |
2001 | | - { |
2002 | | - Operator::OperatorType compressorType = |
2003 | | - static_cast<Operator::OperatorType>(IncomingData[0]); |
2004 | | - op = MakeOperator(OperatorTypeToString(compressorType), {}); |
2005 | | - VB->m_Operations.resize(1); |
2006 | | - VB->m_Operations[0] = op; |
2007 | | - } |
2008 | | - op->SetAccuracy(VB->GetAccuracyRequested()); |
2009 | | - |
2010 | 1997 | { |
2011 | 1998 | std::lock_guard<std::mutex> lockGuard(mutexDecompress); |
| 1999 | + // lock_guard protects mods to VB->m_Operations as well as the decompress operator |
| 2000 | + if (!VB->m_Operations.empty() && (VB->m_Operations[0]->m_TypeString != "null")) |
| 2001 | + { |
| 2002 | + op = VB->m_Operations[0]; |
| 2003 | + } |
| 2004 | + else |
| 2005 | + { |
| 2006 | + Operator::OperatorType compressorType = |
| 2007 | + static_cast<Operator::OperatorType>(IncomingData[0]); |
| 2008 | + op = MakeOperator(OperatorTypeToString(compressorType), {}); |
| 2009 | + VB->m_Operations.clear(); |
| 2010 | + VB->m_Operations.push_back(op); |
| 2011 | + if (m_Engine->m_OperatorNameQuery) |
| 2012 | + { |
| 2013 | + if (compressorType == Operator::PLUGIN_INTERFACE) |
| 2014 | + { |
| 2015 | + auto pop = dynamic_cast<plugin::PluginOperator *>(op.get()); |
| 2016 | + pop->m_OperatorNameQuery = true; |
| 2017 | + } |
| 2018 | + else |
| 2019 | + { |
| 2020 | + auto m = MakeMessage("Operator", "OperatorFactory", "MakeOperator", |
| 2021 | + "ADIOS2 compiled with " + |
| 2022 | + OperatorTypeToString(compressorType) + |
| 2023 | + " library, operator added", |
| 2024 | + -1, helper::LogMode::EXCEPTION); |
| 2025 | + throw MissingOperatorFailure(m, OperatorTypeToString(compressorType)); |
| 2026 | + } |
| 2027 | + } |
| 2028 | + } |
| 2029 | + op->SetAccuracy(VB->GetAccuracyRequested()); |
2012 | 2030 | core::Decompress( |
2013 | 2031 | IncomingData, |
2014 | 2032 | ((MetaArrayRecOperator *)writer_meta_base)->DataBlockSize[Read.BlockID], |
|
0 commit comments