Skip to content

Commit

Permalink
Several fixes for ASAN issues (#3959)
Browse files Browse the repository at this point in the history
* BP5 Min/Max Cleanup
* mod attr fix
* Testing leak
* overall adios suppression file
* Fix leak on array of strings
* Clarify attribute handling
* minblocks leaks in bpls
* Leak in C bindings
* Release IOs in test
* Finalize adios to free memory
* Only ignore unfixed asan issues
  • Loading branch information
eisenhauer committed Dec 28, 2023
1 parent 17c2bd0 commit 18205ce
Show file tree
Hide file tree
Showing 13 changed files with 125 additions and 199 deletions.
204 changes: 32 additions & 172 deletions CTestConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,176 +13,36 @@ set(CTEST_DROP_SITE_CDASH TRUE)
set(MEMORYCHECK_SUPPRESSIONS_FILE ${CMAKE_SOURCE_DIR}/scripts/dashboard/nightly/valgrind-suppressions.txt)

# Ignore tests that are currently failing, remove tests here as they are fixed
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE
Bindings.C.ADIOS2_C_API.ADIOS2BPWriteTypes.Serial
Bindings.C.BPWriteReadMultiblockCC.ZeroSizeBlocks.Serial
Engine.BP.*/BPAppendAfterStepsP.Test/*.BP5.Serial
Engine.BP.*/BPChangingShapeWithinStep.MultiBlock/*.BP5.Serial
Engine.BP.*/BPParameterSelectStepsP.Read/*.BP5.Serial
Engine.BP.*/BPReadMultithreadedTestP.ReadFile/*.BP5.Serial
Engine.BP.*/BPStepsFileGlobalArrayParameters.EveryOtherStep/*.BP5.Serial
Engine.BP.*/BPStepsFileGlobalArrayReaders.EveryStep/*.BP5.Serial
Engine.BP.*/BPStepsFileGlobalArrayReaders.NewVarPerStep/*.BP5.Serial
Engine.BP.*/BPStepsFileLocalArrayParameters.EveryOtherStep/*.BP5.Serial
Engine.BP.*/BPStepsFileLocalArrayReaders.EveryStep/*.BP5.Serial
Engine.BP.*/BPStepsFileLocalArrayReaders.NewVarPerStep/*.BP5.Serial
Engine.BP.BPChangingShape.BPWriteReadShape2D.BP5.Serial
Engine.BP.BPLargeMetadata.ManyLongStrings.BP5.Serial
Engine.BP.BPWriteAppendReadTestADIOS2.ADIOS2BPWriteAppendRead2D2x4.BP5.Serial
Engine.BP.BPWriteAppendReadTestADIOS2.ADIOS2BPWriteAppendReadAggregate.BP5.Serial
Engine.BP.BPWriteAppendReadTestADIOS2.ADIOS2BPWriteAppendReadVaryingAggregation.BP5.Serial
Engine.BP.BPWriteMultiblockReadTest.ADIOS2BPWriteMultiblockRead1D8.BP5.Serial
Engine.BP.BPWriteMultiblockReadTest.ADIOS2BPWriteMultiblockRead2D2x4.BP5.Serial
Engine.BP.BPWriteMultiblockReadTest.ADIOS2BPWriteMultiblockRead2D4x2.BP5.Serial
Engine.BP.BPWriteMultiblockReadTest.ADIOS2BPWriteRead1D8ZeroBlock.BP5.Serial
Engine.BP.BPWriteReadAsStreamTestADIOS2.ReaderWriterDefineVariable.BP5.Serial
Engine.BP.BPWriteReadAttributes.BPWriteReadSingleTypesVar.BP5.Serial
Engine.BP.BPWriteReadAttributes.WriteReadArrayTypes.BP5.Serial
Engine.BP.BPWriteReadAttributes.WriteReadArrayTypesVar.BP5.Serial
Engine.BP.BPWriteReadAttributes.WriteReadSingleTypes.BP5.Serial
Engine.BP.BPWriteReadAttributes.WriteReadStreamVarp.BP5.Serial
Engine.BP.BPWriteReadAttributeTestMultirank.ADIOS2BPWriteReadArrayTypes.BP5.Serial
Engine.BP.BPWriteReadBlockInfo.BPWriteReadBlockInfo1D8_C.BP3.Serial
Engine.BP.BPWriteReadBlockInfo.BPWriteReadBlockInfo1D8_C.BP4.Serial
Engine.BP.BPWriteReadBlockInfo.BPWriteReadBlockInfo1D8_C.BP5.Serial
Engine.BP.BPWriteReadBlockInfo.BPWriteReadBlockInfo1D8.BP5.Serial
Engine.BP.BPWriteReadBlockInfo.BPWriteReadBlockInfo2D2x4.BP5.Serial
Engine.BP.BPWriteReadLocalVariables.ADIOS2BPWriteReadLocal1DAllSteps.BP5.Serial
Engine.BP.BPWriteReadLocalVariables.ADIOS2BPWriteReadLocal1DBlockInfo.BP5.Serial
Engine.BP.BPWriteReadLocalVariables.ADIOS2BPWriteReadLocal2DChangeCount.BP3.Serial
Engine.BP.BPWriteReadLocalVariables.ADIOS2BPWriteReadLocal2DChangeCount.BP4.Serial
Engine.BP.BPWriteReadLocalVariables.ADIOS2BPWriteReadLocal2DChangeCount.BP5.Serial
Engine.BP.BPWriteReadLocalVariablesSel.BPWriteReadLocal1DAllStepsSel.BP5.Serial
Engine.BP.BPWriteReadLocalVariablesSelHighLevel.BPWriteReadLocal1DAllStepsSel.BP5.Serial
Engine.BP.BPWriteReadMultiblockTest.ADIOS2BPWriteReadMultiblock1D8.BP5.Serial
Engine.BP.BPWriteReadMultiblockTest.ADIOS2BPWriteReadMultiblock2D2x4.BP5.Serial
Engine.BP.BPWriteReadMultiblockTest.ADIOS2BPWriteReadMultiblock2D4x2.BP5.Serial
Engine.BP.BPWriteReadMultiblockTest.MultiblockNullBlocks.BP5.Serial
Engine.BP.BPWriteReadMultiblockTest.MultiblockPerformDataWrite.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead10D2x2.Async.BP5.EWS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead10D2x2.Async.BP5.EWS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead10D2x2.Async.BP5.TLS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead10D2x2.Async.BP5.TLS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead10D2x2.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead1D8.Async.BP5.EWS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead1D8.Async.BP5.EWS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead1D8.Async.BP5.TLS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead1D8.Async.BP5.TLS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead1D8.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D2x4.Async.BP5.EWS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D2x4.Async.BP5.EWS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D2x4.Async.BP5.TLS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D2x4.Async.BP5.TLS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D2x4.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2_MultiStepsOverflow.Async.BP5.EWS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2_MultiStepsOverflow.Async.BP5.EWS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2_MultiStepsOverflow.Async.BP5.TLS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2_MultiStepsOverflow.Async.BP5.TLS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2_MultiStepsOverflow.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2_ReadMultiSteps.Async.BP5.EWS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2_ReadMultiSteps.Async.BP5.EWS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2_ReadMultiSteps.Async.BP5.TLS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2_ReadMultiSteps.Async.BP5.TLS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2_ReadMultiSteps.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2.Async.BP5.EWS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2.Async.BP5.EWS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2.Async.BP5.TLS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2.Async.BP5.TLS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ADIOS2BPWriteRead2D4x2.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2.GetDeferredInClose.Async.BP5.EWS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.GetDeferredInClose.Async.BP5.EWS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.GetDeferredInClose.Async.BP5.TLS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.GetDeferredInClose.Async.BP5.TLS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.GetDeferredInClose.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2.ReadStartCount.Async.BP5.EWS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ReadStartCount.Async.BP5.EWS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ReadStartCount.Async.BP5.TLS.Guided.Serial
Engine.BP.BPWriteReadTestADIOS2.ReadStartCount.Async.BP5.TLS.Naive.Serial
Engine.BP.BPWriteReadTestADIOS2.ReadStartCount.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2fstream.ADIOS2BPWriteRead1D8.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2fstream.ADIOS2BPWriteRead2D2x4.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2fstream.ADIOS2BPWriteRead2D4x2_MultiStepsOverflow.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2fstream.ADIOS2BPWriteRead2D4x2_ReadMultiSteps.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2fstream.ADIOS2BPWriteRead2D4x2.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2stdio.ADIOS2BPWriteRead1D8.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2stdio.ADIOS2BPWriteRead2D2x4.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2stdio.ADIOS2BPWriteRead2D4x2_MultiStepsOverflow.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2stdio.ADIOS2BPWriteRead2D4x2_ReadMultiSteps.BP5.Serial
Engine.BP.BPWriteReadTestADIOS2stdio.ADIOS2BPWriteRead2D4x2.BP5.Serial
Engine.BP.BPWriteReadVector.ADIOS2BPWriteRead1D8.BP5.Serial
Engine.BP.BPWriteReadVector.ADIOS2BPWriteRead2D2x4.BP5.Serial
Engine.BP.BPWriteReadVector.ADIOS2BPWriteRead2D4x2.BP5.Serial
Engine.BP.BPWriteReadVector.ADIOS2BPWriteReadVector2D4x2_MultiSteps.BP5.Serial
Engine.BPEngineTest.ZfpComplex.Serial
Engine.SST.SstWriteFails.InvalidBeginStep.Serial
Engine.SST.SstWriteFails.InvalidPut.Serial
Engine.Staging.TestThreads.Basic.SST.BP.Serial
Engine.Staging.TestThreads.Basic.SST.FFS.Serial
Interface.ADIOS2_CXX11_API_Selection.MemorySelectionComplex.BPfile.Serial
Interface.ADIOS2_CXX11_API_Selection.MemorySelectionReadStart.BPfile.Serial
Remote.BPWriteMemorySelectionRead.FileRemote
Remote.BPWriteMemorySelectionRead.GetRemote
Remote.BPWriteReadADIOS2stdio.GetRemote
remoteServerCleanup
remoteServerSetup
Staging.1x1.Attrs.BP5
Staging.1x1.Attrs.CommMin.BP.SST
Staging.1x1.Attrs.CommMin.BP5.SST
Staging.1x1.CommMin.BP.SST
Staging.1x1.CommMin.BP5.SST
Staging.1x1.ForcePreload.CommMin.BP.SST
Staging.1x1.ForcePreload.CommMin.BP5.SST
Staging.1x1.Local2.CommMin.BP.SST
Staging.1x1.Local2.CommMin.BP5.SST
Staging.1x1.LocalMultiblock.CommMin.BP.SST
Staging.1x1.LocalMultiblock.CommMin.BP5.SST
Staging.1x1.ModAttrs.BP5
Staging.1x1.ModAttrs.CommMin.BP.SST
Staging.1x1.ModAttrs.CommMin.BP5.SST
Staging.1x1.NoPreload.CommMin.BP.SST
Staging.1x1.NoPreload.CommMin.BP5.SST
Staging.1x1.SstRUDP.CommMin.BP.SST
Staging.1x1.SstRUDP.CommMin.BP5.SST
Staging.1x1Joined.BP5
Staging.1x1Joined.CommMin.BP5.SST
Staging.1x1LockGeometry.CommMin.BP.SST
Staging.1x1LockGeometry.CommMin.BP5.SST
Staging.1x1Struct.BP5
Staging.1x1Struct.CommMin.BP5.SST
Staging.1x1VarDestruction.CommMin.BP.SST
Staging.1x1VarDestruction.CommMin.BP5.SST
Staging.AllToAllDistribution.1x1x3.CommMin.BP.SST
Staging.AllToAllDistribution.1x1x3.CommMin.BP5.SST
Staging.DiscardWriter.1x1.CommMin.BP.SST
Staging.DiscardWriter.1x1.CommMin.BP5.SST
Staging.LatestReader.1x1.CommMin.BP.SST
Staging.LatestReader.1x1.CommMin.BP5.SST
Staging.LatestReaderHold.1x1.CommMin.BP.SST
Staging.LatestReaderHold.1x1.CommMin.BP5.SST
Staging.OnDemandSingle.1x1.CommMin.BP.SST
Staging.OnDemandSingle.1x1.CommMin.BP5.SST
Staging.RoundRobinDistribution.1x1x3.CommMin.BP.SST
Staging.RoundRobinDistribution.1x1x3.CommMin.BP5.SST
Staging.TimeoutReader.1x1.CommMin.BP.SST
Staging.TimeoutReader.1x1.CommMin.BP5.SST
Staging.WriteMemorySelectionRead.1x1.CommMin.BP.SST
Staging.WriteMemorySelectionRead.1x1.CommMin.BP5.SST
Staging.ZFPCompression.1x1.CommMin.BP.SST
Staging.ZFPCompression.1x1.CommMin.BP5.SST
Staging.ZFPCompression.3x5.CommMin.BP.SST
Staging.ZFPCompression.3x5.CommMin.BP5.SST
Utils.ChangingShape.AlternatingStepsAndChangingShapeVar.Dump
Utils.ChangingShape.AlternatingStepsVarSelection.Dump
Utils.ChangingShape.ChangingShapeVarOneStep.Dump
Utils.ChangingShape.Dump
Utils.ChangingShape.FixedShapeVarTooManySteps.Dump
Utils.ChangingShape.Screen
Utils.CWriter
Utils.CWriter.Bpls.Al.Dump
Utils.CWriter.Bpls.h.Dump
Utils.CWriter.Bpls.la.Dump
Utils.CWriter.Bpls.la.Screen
Utils.CWriter.Bpls.ldDav.Dump
Utils.CWriter.Bpls.ldDavvv.Dump
Utils.CWriter.Bpls.ldvarI16.Dump
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE
Staging.TimeoutReader.1x1.CommMin.BP5.SST
Staging.1x1Struct.BP5
Staging.WriteMemorySelectionRead.1x1.CommMin.BP.SST
Staging.1x1.Local2.CommMin.BP.SST
Staging.OnDemandSingle.1x1.CommMin.BP5.SST
Staging.AllToAllDistribution.1x1x3.CommMin.BP5.SST
Staging.RoundRobinDistribution.1x1x3.CommMin.BP5.SST
Staging.1x1.LocalMultiblock.CommMin.BP5.SST
Staging.1x1.SstRUDP.CommMin.BP5.SST
Staging.WriteMemorySelectionRead.1x1.CommMin.BP5.SST
Staging.1x1LockGeometry.CommMin.BP5.SST
Staging.1x1.ForcePreload.CommMin.BP5.SST
Staging.1x1.NoPreload.CommMin.BP5.SST
Staging.DiscardWriter.1x1.CommMin.BP5.SST
Staging.LatestReaderHold.1x1.CommMin.BP5.SST
Staging.LatestReader.1x1.CommMin.BP5.SST
Engine.BP.BPWriteReadAsStreamTestADIOS2.ReaderWriterDefineVariable.BP5.Serial
Staging.ZFPCompression.3x5.CommMin.BP5.SST
Staging.ZFPCompression.1x1.CommMin.BP5.SST
Staging.1x1Joined.CommMin.BP5.SST
Staging.1x1Struct.CommMin.BP5.SST
Staging.1x1.Local2.CommMin.BP5.SST
Staging.1x1VarDestruction.CommMin.BP5.SST
Staging.1x1.ModAttrs.CommMin.BP5.SST
Staging.1x1.Attrs.CommMin.BP5.SST
Staging.1x1.CommMin.BP5.SST
Engine.SST.SstWriteFails.InvalidBeginStep.Serial
remoteServerCleanup
Remote.BPWriteMemorySelectionRead.FileRemote
Remote.BPWriteMemorySelectionRead.GetRemote
Remote.BPWriteReadADIOS2stdio.GetRemote
)
5 changes: 3 additions & 2 deletions bindings/C/adios2/c/adios2_c_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,7 @@ adios2_varinfo *adios2_inquire_blockinfo(adios2_engine *engine, adios2_variable
b[i].MinUnion.uint64 = 0;
// minBlocksInfo->BlocksInfo[i].MaxUnion;
b[i].MaxUnion.uint64 = 0;
b[i].Value.str = (char *)malloc(blocksInfo[i].Value.size() + 1);
std::strcpy(b[i].Value.str, blocksInfo[i].Value.data());
b[i].Value.str = (char *)blocksInfo[i].Value.data();
};
}
#define declare_template_instantiation(T) \
Expand Down Expand Up @@ -749,6 +748,8 @@ void adios2_free_blockinfo(adios2_varinfo *data_blocks)
free(data_blocks->BlocksInfo[i].Start);
free(data_blocks->BlocksInfo[i].Count);
}
if (data_blocks->Shape)
free(data_blocks->Shape);
free(data_blocks->BlocksInfo);
free(data_blocks);
}
Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/cmake/adios-asan.supp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
leak:ps_make_timer_name_
leak:ibv_get_device_list
2 changes: 1 addition & 1 deletion scripts/ci/cmake/ci-fedora-asan.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(ENV{CC} clang)
set(ENV{CXX} clang++)
set(ASAN_FLAGS "-fsanitize=address -fno-omit-frame-pointer -pthread -mllvm -asan-use-private-alias=1 -Wno-unused-command-line-argument")
set(ENV{ASAN_OPTIONS} "use_odr_indicator=1")
set(ENV{LSAN_OPTIONS} "suppressions=$ENV{CI_SOURCE_DIR}/thirdparty/perfstubs/perfstubs.supp")
set(ENV{LSAN_OPTIONS} "suppressions=$ENV{CI_SOURCE_DIR}/scripts/ci/cmake/adios-asan.supp")
set(ENV{CFLAGS} "${ASAN_FLAGS}")
set(ENV{CXXFLAGS} "${ASAN_FLAGS}")

Expand Down
21 changes: 21 additions & 0 deletions source/adios2/common/ADIOSTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,27 @@ int TypeElementSize(DataType adiosvartype)
}
}

bool TypeHasMinMax(DataType adiosvartype)
{
switch (adiosvartype)
{
case DataType::UInt8:
case DataType::Int8:
case DataType::UInt16:
case DataType::Int16:
case DataType::UInt32:
case DataType::Int32:
case DataType::UInt64:
case DataType::Int64:
case DataType::Float:
case DataType::Double:
case DataType::LongDouble:
return true;
default:
return false;
}
}

static void PrintMBI(std::ostream &os, const MinBlockInfo &blk, int Dims)
{
os << "Writer: " << blk.WriterID << ", Blk: " << blk.BlockID << ", Start: {";
Expand Down
6 changes: 6 additions & 0 deletions source/adios2/common/ADIOSTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,12 @@ constexpr double Linf_norm = std::numeric_limits<double>::infinity();
*/
int TypeElementSize(DataType adiosvartype);

/**
* Return true if a type has a reasonable Min/Max (is a simple integer or float type), false
* otherwise
*/
bool TypeHasMinMax(DataType adiosvartype);

/**
* ToString
* makes a string from an enum class like ShapeID etc, for debugging etc
Expand Down
9 changes: 6 additions & 3 deletions source/adios2/core/IO.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,12 @@ Params IO::GetVariableInfo(const std::string &variableName, const std::set<std::

if (keys.empty() || (keysLC.count("min") == 1 && keysLC.count("max") == 1))
{
const auto pairMinMax = variable.MinMax();
info["Min"] = helper::ValueToString(pairMinMax.first);
info["Max"] = helper::ValueToString(pairMinMax.second);
if (TypeHasMinMax(helper::GetDataType<T>()))
{
const auto pairMinMax = variable.MinMax();
info["Min"] = helper::ValueToString(pairMinMax.first);
info["Max"] = helper::ValueToString(pairMinMax.second);
}
}
else if (keysLC.count("min") == 1)
{
Expand Down
13 changes: 11 additions & 2 deletions source/adios2/engine/bp5/BP5Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ StepStatus BP5Writer::BeginStep(StepMode mode, const float timeoutSeconds)
// std::cout << "BEGIN STEP starts at: " << ts.count() << std::endl;
m_BetweenStepPairs = true;

if (m_WriterStep > 0)
if (!m_IsFirstStep)
{
m_LastTimeBetweenSteps = Now() - m_EndStepEnd;
m_TotalTimeBetweenSteps += m_LastTimeBetweenSteps;
Expand All @@ -71,16 +71,20 @@ StepStatus BP5Writer::BeginStep(StepMode mode, const float timeoutSeconds)
}
}

if ((m_WriterStep == 0) && m_Parameters.UseOneTimeAttributes)
if (m_IsFirstStep && m_Parameters.UseOneTimeAttributes)
{
const auto &attributes = m_IO.GetAttributes();

for (const auto &attributePair : attributes)
{
m_BP5Serializer.OnetimeMarshalAttribute(*(attributePair.second));
}
m_MarshalAttributesNecessary = false;
}

// one-time stuff after Open must be done above
m_IsFirstStep = false;

if (m_Parameters.AsyncWrite)
{
m_AsyncWriteLock.lock();
Expand Down Expand Up @@ -474,6 +478,11 @@ void BP5Writer::MarshalAttributes()

m_BP5Serializer.MarshalAttribute(name.c_str(), type, sizeof(char *), element_count,
data_addr);
if (!attribute.m_IsSingleValue)
{
// array of strings
free(data_addr);
}
}
#define declare_type(T) \
else if (type == helper::GetDataType<T>()) \
Expand Down
1 change: 1 addition & 0 deletions source/adios2/engine/bp5/BP5Writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class BP5Writer : public BP5Engine, public core::Engine
transportman::TransportMan m_FileMetaMetadataManager;

int64_t m_WriterStep = 0;
bool m_IsFirstStep = true; // might not be 0 for append
/*
* Burst buffer variables
*/
Expand Down
7 changes: 7 additions & 0 deletions source/adios2/toolkit/format/bp5/BP5Deserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2347,6 +2347,13 @@ bool BP5Deserializer::VariableMinMax(const VariableBase &Var, const size_t Step,
MinMaxStruct &MinMax)
{
BP5VarRec *VarRec = LookupVarByKey((void *)&Var);
if (!TypeHasMinMax(VarRec->Type))
{
// this type doesn't even have a min/max
helper::Throw<std::logic_error>("Toolkit", "format::BP5Deserializer", "VariableMinMax",
"Min/Max requested for invalid variable type");
}

if ((VarRec->OrigShapeID == ShapeID::LocalArray) ||
(VarRec->OrigShapeID == ShapeID::JoinedArray) ||
(VarRec->OrigShapeID == ShapeID::GlobalArray))
Expand Down

0 comments on commit 18205ce

Please sign in to comment.