Skip to content

Commit b70a46f

Browse files
committed
Separate MPI tests by MPI barriers
1 parent e0b089e commit b70a46f

1 file changed

Lines changed: 41 additions & 31 deletions

File tree

test/ParallelIOTest.cpp

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@
3636
#include <catch2/catch_test_macros.hpp>
3737
#include <catch2/matchers/catch_matchers_string.hpp>
3838

39+
#define PARALLEL_TEST_CASE(name, tags) \
40+
static void openPMD_parallel_##name(); \
41+
TEST_CASE(#name, tags) \
42+
{ \
43+
MPI_Barrier(MPI_COMM_WORLD); \
44+
openPMD_parallel_##name(); \
45+
MPI_Barrier(MPI_COMM_WORLD); \
46+
} \
47+
static void openPMD_parallel_##name()
48+
3949
#if !openPMD_HAVE_MPI
4050
TEST_CASE("none", "[parallel]")
4151
{}
@@ -80,7 +90,7 @@ TEST_CASE("none", "[parallel]")
8090

8191
using namespace openPMD;
8292

83-
TEST_CASE("parallel_multi_series_test", "[parallel]")
93+
PARALLEL_TEST_CASE(parallel_multi_series_test, "[parallel]")
8494
{
8595
std::list<Series> allSeries;
8696

@@ -223,7 +233,7 @@ void write_test_zero_extent(
223233
#endif
224234

225235
#if openPMD_HAVE_HDF5 && openPMD_HAVE_MPI
226-
TEST_CASE("git_hdf5_sample_content_test", "[parallel][hdf5]")
236+
PARALLEL_TEST_CASE(git_hdf5_sample_content_test, "[parallel][hdf5]")
227237
{
228238
int mpi_rank{-1};
229239
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@@ -307,7 +317,7 @@ TEST_CASE("git_hdf5_sample_content_test", "[parallel][hdf5]")
307317
}
308318
}
309319

310-
TEST_CASE("hdf5_write_test", "[parallel][hdf5]")
320+
PARALLEL_TEST_CASE(hdf5_write_test, "[parallel][hdf5]")
311321
{
312322
int mpi_s{-1};
313323
int mpi_r{-1};
@@ -377,13 +387,13 @@ TEST_CASE("hdf5_write_test", "[parallel][hdf5]")
377387
o.flush("hdf5.independent_stores = false");
378388
}
379389

380-
TEST_CASE("hdf5_write_test_zero_extent", "[parallel][hdf5]")
390+
PARALLEL_TEST_CASE(hdf5_write_test_zero_extent, "[parallel][hdf5]")
381391
{
382392
write_test_zero_extent(false, "h5", true, true);
383393
write_test_zero_extent(true, "h5", true, true);
384394
}
385395

386-
TEST_CASE("hdf5_write_test_skip_chunk", "[parallel][hdf5]")
396+
PARALLEL_TEST_CASE(hdf5_write_test_skip_chunk, "[parallel][hdf5]")
387397
{
388398
//! @todo add via JSON option instead of environment read
389399
auto const hdf5_collective =
@@ -397,7 +407,7 @@ TEST_CASE("hdf5_write_test_skip_chunk", "[parallel][hdf5]")
397407
REQUIRE(true);
398408
}
399409

400-
TEST_CASE("hdf5_write_test_skip_declare", "[parallel][hdf5]")
410+
PARALLEL_TEST_CASE(hdf5_write_test_skip_declare, "[parallel][hdf5]")
401411
{
402412
//! @todo add via JSON option instead of environment read
403413
auto const hdf5_collective =
@@ -413,7 +423,7 @@ TEST_CASE("hdf5_write_test_skip_declare", "[parallel][hdf5]")
413423

414424
#else
415425

416-
TEST_CASE("no_parallel_hdf5", "[parallel][hdf5]")
426+
PARALLEL_TEST_CASE(no_parallel_hdf5, "[parallel][hdf5]")
417427
{
418428
REQUIRE(true);
419429
}
@@ -495,7 +505,7 @@ void available_chunks_test(std::string const &file_ending)
495505
}
496506
}
497507

498-
TEST_CASE("available_chunks_test", "[parallel][adios]")
508+
PARALLEL_TEST_CASE(available_chunks_test, "[parallel][adios]")
499509
{
500510
available_chunks_test("bp");
501511
}
@@ -550,14 +560,14 @@ void extendDataset(std::string const &ext, std::string const &jsonConfig)
550560
}
551561
}
552562

553-
TEST_CASE("extend_dataset", "[parallel]")
563+
PARALLEL_TEST_CASE(extend_dataset, "[parallel]")
554564
{
555565
extendDataset("bp", R"({"backend": "adios2"})");
556566
}
557567
#endif
558568

559569
#if openPMD_HAVE_ADIOS2 && openPMD_HAVE_MPI
560-
TEST_CASE("adios_write_test", "[parallel][adios]")
570+
PARALLEL_TEST_CASE(adios_write_test, "[parallel][adios]")
561571
{
562572
Series o = Series(
563573
"../samples/parallel_write.bp",
@@ -645,25 +655,25 @@ TEST_CASE("adios_write_test", "[parallel][adios]")
645655
}
646656
}
647657

648-
TEST_CASE("adios_write_test_zero_extent", "[parallel][adios]")
658+
PARALLEL_TEST_CASE(adios_write_test_zero_extent, "[parallel][adios]")
649659
{
650660
write_test_zero_extent(false, "bp", true, true);
651661
write_test_zero_extent(true, "bp", true, true);
652662
}
653663

654-
TEST_CASE("adios_write_test_skip_chunk", "[parallel][adios]")
664+
PARALLEL_TEST_CASE(adios_write_test_skip_chunk, "[parallel][adios]")
655665
{
656666
write_test_zero_extent(false, "bp", false, true);
657667
write_test_zero_extent(true, "bp", false, true);
658668
}
659669

660-
TEST_CASE("adios_write_test_skip_declare", "[parallel][adios]")
670+
PARALLEL_TEST_CASE(adios_write_test_skip_declare, "[parallel][adios]")
661671
{
662672
write_test_zero_extent(false, "bp", false, false);
663673
write_test_zero_extent(true, "bp", false, false);
664674
}
665675

666-
TEST_CASE("hzdr_adios_sample_content_test", "[parallel][adios2][bp3]")
676+
PARALLEL_TEST_CASE(hzdr_adios_sample_content_test, "[parallel][adios2][bp3]")
667677
{
668678
int mpi_rank{-1};
669679
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@@ -743,7 +753,7 @@ void write_4D_test(std::string const &file_ending)
743753
o.flush();
744754
}
745755

746-
TEST_CASE("write_4D_test", "[parallel]")
756+
PARALLEL_TEST_CASE(write_4D_test, "[parallel]")
747757
{
748758
for (auto const &t : getBackends())
749759
{
@@ -776,7 +786,7 @@ void write_makeconst_some(std::string const &file_ending)
776786
E_x.makeConstant(42);
777787
}
778788

779-
TEST_CASE("write_makeconst_some", "[parallel]")
789+
PARALLEL_TEST_CASE(write_makeconst_some, "[parallel]")
780790
{
781791
for (auto const &t : getBackends())
782792
{
@@ -883,7 +893,7 @@ void close_iteration_test(std::string const &file_ending)
883893
}
884894
}
885895

886-
TEST_CASE("close_iteration_test", "[parallel]")
896+
PARALLEL_TEST_CASE(close_iteration_test, "[parallel]")
887897
{
888898
for (auto const &t : getBackends())
889899
{
@@ -1002,7 +1012,7 @@ void file_based_write_read(std::string const &file_ending)
10021012
}
10031013
}
10041014

1005-
TEST_CASE("file_based_write_read", "[parallel]")
1015+
PARALLEL_TEST_CASE(file_based_write_read, "[parallel]")
10061016
{
10071017
return;
10081018
for (auto const &t : getBackends())
@@ -1182,7 +1192,7 @@ void hipace_like_write(std::string const &file_ending)
11821192
}
11831193
}
11841194

1185-
TEST_CASE("hipace_like_write", "[parallel]")
1195+
PARALLEL_TEST_CASE(hipace_like_write, "[parallel]")
11861196
{
11871197
for (auto const &t : getBackends())
11881198
{
@@ -1192,7 +1202,7 @@ TEST_CASE("hipace_like_write", "[parallel]")
11921202
#endif
11931203

11941204
#if openPMD_HAVE_ADIOS2 && openPMD_HAVE_MPI
1195-
TEST_CASE("independent_write_with_collective_flush", "[parallel]")
1205+
PARALLEL_TEST_CASE(independent_write_with_collective_flush, "[parallel]")
11961206
{
11971207
Series write(
11981208
"../samples/independent_write_with_collective_flush.bp5",
@@ -1226,7 +1236,7 @@ TEST_CASE("independent_write_with_collective_flush", "[parallel]")
12261236
#endif
12271237

12281238
#if openPMD_HAVE_MPI
1229-
TEST_CASE("unavailable_backend", "[core][parallel]")
1239+
PARALLEL_TEST_CASE(unavailable_backend, "[core][parallel]")
12301240
{
12311241
#if !openPMD_HAVE_ADIOS2
12321242
{
@@ -1374,15 +1384,15 @@ void adios2_streaming(bool variableBasedLayout)
13741384
}
13751385
}
13761386

1377-
TEST_CASE("adios2_streaming", "[pseudoserial][adios2]")
1387+
PARALLEL_TEST_CASE(adios2_streaming, "[pseudoserial][adios2]")
13781388
{
13791389
#if HAS_ADIOS_2_9
13801390
adios2_streaming(true);
13811391
#endif // HAS_ADIOS_2_9
13821392
adios2_streaming(false);
13831393
}
13841394

1385-
TEST_CASE("parallel_adios2_json_config", "[parallel][adios2]")
1395+
PARALLEL_TEST_CASE(parallel_adios2_json_config, "[parallel][adios2]")
13861396
{
13871397
int size{-1};
13881398
int rank{-1};
@@ -1593,7 +1603,7 @@ void adios2_ssc()
15931603
}
15941604
}
15951605

1596-
TEST_CASE("adios2_ssc", "[parallel][adios2]")
1606+
PARALLEL_TEST_CASE(adios2_ssc, "[parallel][adios2]")
15971607
{
15981608
adios2_ssc();
15991609
}
@@ -1919,7 +1929,7 @@ void append_mode(
19191929
#endif
19201930
}
19211931

1922-
TEST_CASE("append_mode", "[serial]")
1932+
PARALLEL_TEST_CASE(append_mode, "[serial]")
19231933
{
19241934
for (auto const &t : testedFileExtensions())
19251935
{
@@ -2122,7 +2132,7 @@ void joined_dim(std::string const &ext)
21222132
}
21232133
}
21242134

2125-
TEST_CASE("joined_dim", "[parallel]")
2135+
PARALLEL_TEST_CASE(joined_dim, "[parallel]")
21262136
{
21272137
#if 100000000 * ADIOS2_VERSION_MAJOR + 1000000 * ADIOS2_VERSION_MINOR + \
21282138
10000 * ADIOS2_VERSION_PATCH + 100 * ADIOS2_VERSION_TWEAK >= \
@@ -2147,7 +2157,7 @@ TEST_CASE("joined_dim", "[parallel]")
21472157

21482158
#if openPMD_HAVE_ADIOS2_BP5
21492159
// Parallel version of the same test from SerialIOTest.cpp
2150-
TEST_CASE("adios2_flush_via_step")
2160+
PARALLEL_TEST_CASE(adios2_flush_via_step, "[parallel]")
21512161
{
21522162
int size_i(0), rank_i(0);
21532163
MPI_Comm_rank(MPI_COMM_WORLD, &rank_i);
@@ -2254,12 +2264,12 @@ TEST_CASE("adios2_flush_via_step")
22542264
}
22552265
#endif
22562266

2257-
TEST_CASE("read_variablebased_randomaccess")
2267+
PARALLEL_TEST_CASE(read_variablebased_randomaccess, "[parallel]")
22582268
{
22592269
read_variablebased_randomaccess::read_variablebased_randomaccess();
22602270
}
22612271

2262-
TEST_CASE("iterate_nonstreaming_series", "[serial][adios2]")
2272+
PARALLEL_TEST_CASE(iterate_nonstreaming_series, "[parallel][adios2]")
22632273
{
22642274
iterate_nonstreaming_series::iterate_nonstreaming_series();
22652275
}
@@ -2720,14 +2730,14 @@ void run_test()
27202730
}
27212731
} // namespace adios2_chunk_distribution
27222732

2723-
TEST_CASE("adios2_chunk_distribution", "[parallel][adios2]")
2733+
PARALLEL_TEST_CASE(adios2_chunk_distribution, "[parallel][adios2]")
27242734
{
27252735
adios2_chunk_distribution::run_test();
27262736
}
27272737
#endif // openPMD_HAVE_ADIOS2 && openPMD_HAVE_MPI
27282738

27292739
#if openPMD_HAVE_MPI
2730-
TEST_CASE("bug_1655_bp5_writer_hangup", "[parallel]")
2740+
PARALLEL_TEST_CASE(bug_1655_bp5_writer_hangup, "[parallel]")
27312741
{
27322742
bug_1655_bp5_writer_hangup::bug_1655_bp5_writer_hangup();
27332743
}

0 commit comments

Comments
 (0)