Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill reader-created variables in parent IO upon engine close (for BP5) #3270

Merged
merged 2 commits into from
Jul 1, 2022
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
3 changes: 3 additions & 0 deletions source/adios2/toolkit/format/bp5/BP5Deserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,9 @@ BP5Deserializer::~BP5Deserializer()
}
for (auto &VarRec : VarByName)
{
/* remove any variables that we've created from our IO */
m_Engine->m_IO.RemoveVariable(VarRec.second->VarName);

free(VarRec.second->VarName);
if (VarRec.second->Operator)
free(VarRec.second->Operator);
Expand Down
10 changes: 9 additions & 1 deletion testing/adios2/engine/staging-common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ if(ADIOS2_HAVE_MPI AND MPIEXEC_EXECUTABLE)
endforeach()
endif()

set (SIMPLE_TESTS "1x1;1x1DefSync")
set (SIMPLE_TESTS "1x1;1x1DefSync;1x1VarDestruction")
set (BP5File_ONLY_TESTS "1x1DataWrite")

set (SIMPLE_FORTRAN_TESTS "")
Expand Down Expand Up @@ -196,6 +196,8 @@ if(NOT WIN32) # not on windows
list (FILTER BP_TESTS EXCLUDE REGEX ".*NoData$")
# BP3 and BP4 don't do PerformDataWrite
list (FILTER BP_TESTS EXCLUDE REGEX ".*DataWrite.*")
# BP3 and BP4 don't do VarDestruction
list (FILTER BP_TESTS EXCLUDE REGEX ".*VarDestruction.*")
foreach(test ${BP_TESTS})
add_common_test(${test} BP4)
endforeach()
Expand Down Expand Up @@ -254,6 +256,8 @@ if(NOT MSVC) # not on windows
list (FILTER BP4_STREAM_TESTS EXCLUDE REGEX ".*SharedVar.BPS$")
# Local fail with BP4_streaming*
list (FILTER BP4_STREAM_TESTS EXCLUDE REGEX ".*Local.BPS$")
# BP3 and BP4 don't do VarDestruction
list (FILTER BP4_STREAM_TESTS EXCLUDE REGEX ".*VarDestruction.*")
# Fortran scalar reads don't work for BP4 streaming
list (FILTER BP4_STREAM_TESTS EXCLUDE REGEX "(FtoF|CtoF).*")
# Local Vars have a heisen failure for BP4 streaming
Expand Down Expand Up @@ -296,6 +300,8 @@ if(NOT MSVC) # not on windows
list (FILTER FILESTREAM_TESTS EXCLUDE REGEX ".*NoReaderNoWait.FS$")
list (FILTER FILESTREAM_TESTS EXCLUDE REGEX ".*1x1DefSync.*")
list (FILTER FILESTREAM_TESTS EXCLUDE REGEX ".*Flush.*")
# BP3 and BP4 don't do VarDestruction
list (FILTER FILESTREAM_TESTS EXCLUDE REGEX ".*VarDestruction.*")

foreach(test ${FILESTREAM_TESTS})
add_common_test(${test} FileStream)
Expand All @@ -321,6 +327,8 @@ if(NOT MSVC AND ADIOS2_HAVE_HDF5 AND (NOT ADIOS2_HAVE_MPI OR HDF5_IS_PARALLEL))
list (FILTER HDF5_TESTS EXCLUDE REGEX "[2345]x")
# The nobody-writes-data-in-a-timestep tests don't work with HDF5
list (FILTER HDF5_TESTS EXCLUDE REGEX ".*HalfNoData$")
# The variables with HDF5 reads persist
list (FILTER HDF5_TESTS EXCLUDE REGEX ".*VarDestruction.*")
foreach(test ${HDF5_TESTS})
add_common_test(${test} HDF5)
endforeach()
Expand Down
5 changes: 5 additions & 0 deletions testing/adios2/engine/staging-common/ParseArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ int LongFirstDelay = 0;
int FirstTimestepMustBeZero = 0;
int LockGeometry = 0;
bool VaryingDataSize = false;
bool TestVarDestruction = false;
bool AdvancingAttrs = false;
int NoData = 0;
int NoDataNode = -1;
Expand Down Expand Up @@ -154,6 +155,10 @@ void ParseArgs(int argc, char **argv)
{
SharedIO = true;
}
else if (std::string(argv[1]) == "--var_destruction")
{
TestVarDestruction = true;
}
else if (std::string(argv[1]) == "--shared_var")
{
SharedVar = true;
Expand Down
4 changes: 4 additions & 0 deletions testing/adios2/engine/staging-common/TestCommonRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,10 @@ TEST_F(CommonReadTest, ADIOS2CommonRead1D8)

// Close the file
engine.Close();
if (TestVarDestruction)
{
EXPECT_FALSE(io.InquireVariable<std::complex<float>>("c32"));
}
}

//******************************************************************************
Expand Down
1 change: 1 addition & 0 deletions testing/adios2/engine/staging-common/TestSupp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ set (STAGING_COMMON_TEST_SUPP_VERBOSE OFF)
set (1x1_CMD "run_test.py.$<CONFIG> -nw 1 -nr 1")
set (1x1GetSync_CMD "run_test.py.$<CONFIG> -nw 1 -nr 1 --rarg=--read_mode --rarg=sync")
set (1x1DefSync_CMD "TestDefSyncWrite --data_size 200 --engine_params ChunkSize=500,MinDeferredSize=150")
set (1x1VarDestruction_CMD "run_test.py.$<CONFIG> -nw 1 -nr 1 --rarg=--var_destruction")
set (1x1DataWrite_CMD "TestDefSyncWrite --perform_data_write --data_size 200 --engine_params ChunkSize=500,MinDeferredSize=150")
set (1x1.NoPreload_CMD "run_test.py.$<CONFIG> -nw 1 -nr 1 --rarg=PreloadMode=SstPreloadNone,RENGINE_PARAMS")
set (1x1.SstRUDP_CMD "run_test.py.$<CONFIG> -nw 1 -nr 1 --rarg=DataTransport=WAN,WANDataTransport=enet,RENGINE_PARAMS --warg=DataTransport=WAN,WANDataTransport=enet,WENGINE_PARAMS")
Expand Down