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

Tweak OnDemand test #3190

Merged
merged 2 commits into from
May 2, 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
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 @@ -138,7 +138,7 @@ set (ALL_SIMPLE_TESTS "")
list (APPEND ALL_SIMPLE_TESTS ${SIMPLE_TESTS} ${SIMPLE_FORTRAN_TESTS} ${SIMPLE_MPI_TESTS} ${SIMPLE_ZFP_TESTS})

set (SST_SPECIFIC_TESTS "")
list (APPEND SST_SPECIFIC_TESTS "1x1.SstRUDP;1x1.LocalMultiblock;RoundRobinDistribution.1x1x3;AllToAllDistribution.1x1x3;OnDemandDistribution.1x1x3")
list (APPEND SST_SPECIFIC_TESTS "1x1.SstRUDP;1x1.LocalMultiblock;RoundRobinDistribution.1x1x3;AllToAllDistribution.1x1x3")
if (ADIOS2_HAVE_MPI)
list (APPEND SST_SPECIFIC_TESTS "2x3.SstRUDP;2x1.LocalMultiblock;5x3.LocalMultiblock;")
endif()
Expand Down
52 changes: 42 additions & 10 deletions testing/adios2/engine/staging-common/TestDistributionRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@

#include "ParseArgs.h"

using Clock = std::chrono::steady_clock;
using std::chrono::time_point;
using std::chrono::duration_cast;
using std::chrono::milliseconds;
using std::this_thread::sleep_for;

class CommonReadTest : public ::testing::Test
{
public:
Expand Down Expand Up @@ -60,7 +66,7 @@ TEST_F(CommonReadTest, ADIOS2CommonRead1D8)

adios2::Engine engine1 = io1.Open(fname, adios2::Mode::Read);

std::vector<std::time_t> write_times;
time_point<Clock> startTime = Clock::now();

std::string varname1 = "r64";

Expand All @@ -70,6 +76,13 @@ TEST_F(CommonReadTest, ADIOS2CommonRead1D8)
{
size_t writerSize;
size_t step;
if (OnDemand && (total_steps > 0))
{
time_point<Clock> end = Clock::now();
milliseconds diff = duration_cast<milliseconds>(end - startTime);
std::cout << "Reader " << first_step << "Got an step at time "
<< diff.count() << "ms" << std::endl;
}
auto var1 = io1.InquireVariable<double>(varname1);

EXPECT_TRUE(var1);
Expand Down Expand Up @@ -126,35 +139,54 @@ TEST_F(CommonReadTest, ADIOS2CommonRead1D8)
{
case 0:
{
int StepDelay[] = {1, 3, 5, 0, 0, 20};
double StepDelay[] = {1, 3, 5, 0, 0, 20};
int ExpectedStep[] = {0, 4, 7, 10, 12, 15};
EXPECT_EQ(ExpectedStep[total_steps], step);
std::cout << "Reader " << first_step << " Sleeping for "
<< StepDelay[total_steps] << std::endl;
std::this_thread::sleep_for(
std::chrono::seconds(StepDelay[total_steps]));
std::this_thread::sleep_for(std::chrono::milliseconds(
(long)(StepDelay[total_steps] * 1000.0)));
time_point<Clock> end = Clock::now();
milliseconds diff =
duration_cast<milliseconds>(end - startTime);
std::cout << "Reader " << first_step
<< "Doing begin step at time " << diff.count() << "ms"
<< std::endl;

break;
}
case 1:
{
int StepDelay[] = {0, 0, 1, 5, 0, 0, 1, 10};
double StepDelay[] = {0, 0, 1.5, 5, 0, 0, 1, 10};
int ExpectedStep[] = {1, 3, 5, 8, 11, 14, 17, 19};
EXPECT_EQ(ExpectedStep[total_steps], step);
std::cout << "Reader " << first_step << " Sleeping for "
<< StepDelay[total_steps] << std::endl;
std::this_thread::sleep_for(
std::chrono::seconds(StepDelay[total_steps]));
std::this_thread::sleep_for(std::chrono::milliseconds(
(long)(StepDelay[total_steps] * 1000.0)));
time_point<Clock> end = Clock::now();
milliseconds diff =
duration_cast<milliseconds>(end - startTime);
std::cout << "Reader " << first_step
<< "Doing begin step at time " << diff.count() << "ms"
<< std::endl;
break;
}
case 2:
{
int StepDelay[] = {3, 2, 4, 0, 0, 0, 0};
double StepDelay[] = {3, 2, 4, 0, 0, 0, 0};
int ExpectedStep[] = {2, 6, 9, 13, 16, 18};
EXPECT_EQ(ExpectedStep[total_steps], step);
std::cout << "Reader " << first_step << " Sleeping for "
<< StepDelay[total_steps] << std::endl;
std::this_thread::sleep_for(
std::chrono::seconds(StepDelay[total_steps]));
std::this_thread::sleep_for(std::chrono::milliseconds(
(long)(StepDelay[total_steps] * 1000.0)));
time_point<Clock> end = Clock::now();
milliseconds diff =
duration_cast<milliseconds>(end - startTime);
std::cout << "Reader " << first_step
<< "Doing begin step at time " << diff.count() << "ms"
<< std::endl;
break;
}
}
Expand Down