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

Test attributes added per step #2389

Merged
merged 1 commit into from
Jul 21, 2020
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
2 changes: 1 addition & 1 deletion testing/adios2/engine/staging-common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ if(ADIOS2_HAVE_MPI AND MPIEXEC_EXECUTABLE)
endforeach()
endif()

set (SIMPLE_TESTS "1x1;NoReaderNoWait;TimeoutOnOpen;1x1.NoData;1x1.Modes;1x1.Attrs;1x1.Local;1x1.SharedNothing;1x1.SharedIO;1x1.SharedVar;1x1.SharedNothingSync;1x1.SharedIOSync;1x1.SharedVarSync;1x1EarlyExit")
set (SIMPLE_TESTS "1x1;NoReaderNoWait;TimeoutOnOpen;1x1.NoData;1x1.Modes;1x1.Attrs;1x1.Local;1x1.SharedNothing;1x1.SharedIO;1x1.SharedVar;1x1.SharedNothingSync;1x1.SharedIOSync;1x1.SharedVarSync;1x1EarlyExit;CumulativeAttr.1x1")

set (SIMPLE_FORTRAN_TESTS "")
if(ADIOS2_HAVE_Fortran)
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 AdvancingAttrs = false;
int NoData = 0;
int NoDataNode = -1;
int EarlyExit = 0;
Expand Down Expand Up @@ -218,6 +219,10 @@ static void ParseArgs(int argc, char **argv)
{
VaryingDataSize = true;
}
else if (std::string(argv[1]) == "--advancing_attributes")
{
AdvancingAttrs = true;
}
else if (std::string(argv[1]) == "--long_first_delay")
{
LongFirstDelay = 1;
Expand Down
27 changes: 27 additions & 0 deletions testing/adios2/engine/staging-common/TestCommonClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,31 @@ TEST_F(SstReadTest, ADIOS2SstRead)
EXPECT_EQ(validateCommonTestData(myStart, myLength, currentStep, 0),
0);
write_times.push_back(write_time);
if (AdvancingAttrs)
{
/* we only succeed if every attribute from every prior step is
* there, but not the next few */
for (int step = 0; step <= currentStep + 2; step++)
{
const std::string r64_Single =
std::string("r64_PerStep_") + std::to_string(step);
auto attr_r64 = io.InquireAttribute<double>(r64_Single);
std::cout << "Testing for attribute " << r64_Single
<< std::endl;
if (step <= currentStep)
{
EXPECT_TRUE(attr_r64);
ASSERT_EQ(attr_r64.Data().size() == 1, true);
ASSERT_EQ(attr_r64.Type(), adios2::GetType<double>());
ASSERT_EQ(attr_r64.Data().front(),
(double)(step * 10.0));
}
else
{
EXPECT_FALSE(attr_r64);
}
}
}
}
catch (...)
{
Expand All @@ -305,6 +330,8 @@ TEST_F(SstReadTest, ADIOS2SstRead)
break;
}
}
std::cout << "Reader finished with step " << ExpectedStep - 1
<< std::endl;
if (IncreasingDelay && !DelayWhileHoldingStep)
{
std::this_thread::sleep_for(std::chrono::milliseconds(
Expand Down
27 changes: 27 additions & 0 deletions testing/adios2/engine/staging-common/TestCommonRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,33 @@ TEST_F(CommonReadTest, ADIOS2CommonRead1D8)
<< " timestep " << t << std::endl;
}
EXPECT_EQ(result, 0);
if (AdvancingAttrs)
{
/* we only succeed if every attribute from every prior step is
* there, but not the next few */
for (int step = 0; step <= currentStep + 2; step++)
{
const std::string r64_Single =
std::string("r64_PerStep_") + std::to_string(step);
auto attr_r64 = io.InquireAttribute<double>(r64_Single);
std::cout << "Testing for attribute " << r64_Single
<< std::endl;
if (step <= currentStep)
{
EXPECT_TRUE(attr_r64);
ASSERT_EQ(attr_r64.Data().size() == 1, true);
ASSERT_EQ(attr_r64.Type(), adios2::GetType<double>());
ASSERT_EQ(attr_r64.Data().front(),
(double)(step * 10.0));
}
else
{
// The file engines let attributes appear early, so only
// enforce non-appearance if that changes.
// EXPECT_FALSE(attr_r64);
}
}
}
write_times.push_back(write_time);
}
else
Expand Down
7 changes: 7 additions & 0 deletions testing/adios2/engine/staging-common/TestCommonServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,14 @@ TEST_F(CommonServerTest, ADIOS2CommonServer)
// we'll never change our data decomposition
engine.LockWriterDefinitions();
}
if (AdvancingAttrs)
{
const std::string r64_Single =
std::string("r64_PerStep_") + std::to_string(step);
io.DefineAttribute<double>(r64_Single, (double)(step * 10.0));
}
engine.EndStep();
std::cout << "Writer finished step " << step << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(
DelayMS)); /* sleep for DelayMS milliseconds */
step++;
Expand Down
7 changes: 7 additions & 0 deletions testing/adios2/engine/staging-common/TestCommonWrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ TEST_F(CommonWriteTest, ADIOS2CommonWrite)
// we'll never change our data decomposition
engine.LockWriterDefinitions();
}
if (AdvancingAttrs)
{
const std::string r64_Single =
std::string("r64_PerStep_") + std::to_string(step);
io.DefineAttribute<double>(r64_Single, (double)(step * 10.0));
std::cout << "Dumping attribute " << r64_Single << std::endl;
}
engine.EndStep();
std::this_thread::sleep_for(std::chrono::milliseconds(
DelayMS)); /* sleep for DelayMS milliseconds */
Expand Down
3 changes: 3 additions & 0 deletions testing/adios2/engine/staging-common/TestSupp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ set (LatestReaderHold.1x1_CMD "run_test.py.$<CONFIG> --test_protocol one_client
# A faster writer and a queue policy that will cause timesteps to be discarded
set (DiscardWriter.1x1_CMD "run_test.py.$<CONFIG> --test_protocol one_client -nw 1 -nr 1 --warg=--engine_params --warg=QueueLimit=1,QueueFullPolicy=discard,WENGINE_PARAMS --warg=--ms_delay --warg=250 --rarg=--discard")

# Readers using Advancing attributes
set (CumulativeAttr.1x1_CMD "run_test.py.$<CONFIG> -nw 1 -nr 1 --warg=--advancing_attributes --rarg=--advancing_attributes")

function(remove_engine_params_placeholder dst_str src_str )
string(REGEX REPLACE "([^ ]*),WENGINE_PARAMS" "\\1" src_str "${src_str}")
string(REGEX REPLACE "([^ ]*),RENGINE_PARAMS" "\\1" src_str "${src_str}")
Expand Down