Skip to content

Commit

Permalink
Different names for MPI and Serial tests (#4118)
Browse files Browse the repository at this point in the history
* Different names for MPI and Serial tests
  • Loading branch information
eisenhauer committed Mar 30, 2024
1 parent 4a96483 commit a65abe2
Show file tree
Hide file tree
Showing 59 changed files with 670 additions and 216 deletions.
10 changes: 8 additions & 2 deletions testing/adios2/bindings/C/TestBPAvailableVariablesAttribites.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@ TEST_F(BPAvailableVariablesAttributes, AvailableVariablesAttributes)
adios2_variable *varR64 = adios2_define_variable(
ioH, "varR64", adios2_type_double, 1, shape, start, count, adios2_constant_dims_false);

#if ADIOS2_USE_MPI
adios2_engine *engineH = adios2_open(ioH, "available_MPI.bp", adios2_mode_write);
#else
adios2_engine *engineH = adios2_open(ioH, "available.bp", adios2_mode_write);

#endif
for (size_t i = 0; i < steps; ++i)
{
adios2_begin_step(engineH, adios2_step_mode_append, -1., &status);
Expand Down Expand Up @@ -177,8 +180,11 @@ TEST_F(BPAvailableVariablesAttributes, AvailableVariablesAttributes)
std::vector<double> inR64(data_Nx / 2);

adios2_io *ioH = adios2_declare_io(adiosH, "Reader");
#if ADIOS2_USE_MPI
adios2_engine *engineH = adios2_open(ioH, "available_MPI.bp", adios2_mode_read);
#else
adios2_engine *engineH = adios2_open(ioH, "available.bp", adios2_mode_read);

#endif
size_t nsteps;
adios2_steps(&nsteps, engineH);
EXPECT_EQ(nsteps, steps);
Expand Down
4 changes: 4 additions & 0 deletions testing/adios2/bindings/C/TestBPMemorySpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ TEST_F(ADIOS2_C_API, ADIOS2BPMemorySpaceGPU)

TEST_F(ADIOS2_C_API, ADIOS2BPMemorySpaceShape)
{
#if ADIOS2_USE_MPI
const char fname[] = "ADIOS2_C_API.ADIOS2BPMemorySpace_MPI.bp";
#else
const char fname[] = "ADIOS2_C_API.ADIOS2BPMemorySpace.bp";
#endif
// write
{
adios2_io *ioH = adios2_declare_io(adiosH, "CMemSpace");
Expand Down
10 changes: 8 additions & 2 deletions testing/adios2/bindings/C/TestBPWriteAggregateReadLocal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ void LocalAggregate1D(const std::string substreams)
{
// Each process would write a 1x8 array and all processes would
// form a mpiSize * Nx 1D array
#if ADIOS2_USE_MPI
const std::string fname("LocalAggregate1D_" + substreams + "_MPI.bp");
#else
const std::string fname("LocalAggregate1D_" + substreams + ".bp");

#endif
int mpiRank = 0, mpiSize = 1;
// Number of steps
constexpr size_t NSteps = 5;
Expand Down Expand Up @@ -151,8 +154,11 @@ void LocalAggregate1DBlock0(const std::string substreams)
{
// Each process would write a 1x8 array and all processes would
// form a mpiSize * Nx 1D array
#if ADIOS2_USE_MPI
const std::string fname("LocalAggregate1DSubFile_" + substreams + "_MPI.bp");
#else
const std::string fname("LocalAggregate1DSubFile_" + substreams + ".bp");

#endif
int mpiRank = 0, mpiSize = 1;
// Number of steps
constexpr size_t NSteps = 5;
Expand Down
9 changes: 8 additions & 1 deletion testing/adios2/bindings/C/TestBPWriteReadMultiblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ TEST_F(BPWriteReadMultiblockCC, ZeroSizeBlocks)
adios2_variable *varR64 = adios2_define_variable(
ioH, "varR64", adios2_type_double, 1, shape, start, count, adios2_constant_dims_false);

#if ADIOS2_USE_MPI
adios2_engine *engineH = adios2_open(ioH, "cmblocks_MPI.bp", adios2_mode_write);
#else
adios2_engine *engineH = adios2_open(ioH, "cmblocks.bp", adios2_mode_write);
#endif

for (size_t i = 0; i < steps; ++i)
{
Expand Down Expand Up @@ -172,8 +176,11 @@ TEST_F(BPWriteReadMultiblockCC, ZeroSizeBlocks)
std::vector<double> inR64(data_Nx / 2);

adios2_io *ioH = adios2_declare_io(adiosH, "Reader");
#if ADIOS2_USE_MPI
adios2_engine *engineH = adios2_open(ioH, "cmblocks_MPI.bp", adios2_mode_read);
#else
adios2_engine *engineH = adios2_open(ioH, "cmblocks.bp", adios2_mode_read);

#endif
size_t nsteps;
adios2_steps(&nsteps, engineH);
EXPECT_EQ(nsteps, steps);
Expand Down
8 changes: 8 additions & 0 deletions testing/adios2/bindings/C/TestBPWriteTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ class ADIOS2_C_API : public ::testing::Test

TEST_F(ADIOS2_C_API, ADIOS2BPWriteTypes)
{
#if ADIOS2_USE_MPI
const char fname[] = "ADIOS2_C_API.ADIOS2BPWriteTypes_MPI.bp";
#else
const char fname[] = "ADIOS2_C_API.ADIOS2BPWriteTypes.bp";
#endif
// write
{
// IO
Expand Down Expand Up @@ -408,7 +412,11 @@ std::string adios2_engine_name_as_string(adios2_engine *engineH)

TEST_F(ADIOS2_C_API_IO, Engine)
{
#if ADIOS2_USE_MPI
const char fname[] = "ADIOS2_C_API_IO.engine_MPI.bp";
#else
const char fname[] = "ADIOS2_C_API_IO.engine.bp";
#endif
int ierr;

ierr = adios2_set_engine(ioH, "bpfile");
Expand Down
3 changes: 2 additions & 1 deletion testing/adios2/bindings/C/TestNullWriteRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ TEST_F(NullWriteReadTests_C_API, NullWriteRead1D8)
{
// Each process would write a 1x8 array and all processes would
// form a mpiSize * Nx 1D array
const std::string fname("NullWriteRead1D8_c.bp");

int mpiRank = 0, mpiSize = 1;
// Number of rows
Expand All @@ -45,8 +44,10 @@ TEST_F(NullWriteReadTests_C_API, NullWriteRead1D8)

#if ADIOS2_USE_MPI
adios2_adios *adios = adios2_init_mpi(MPI_COMM_WORLD);
const std::string fname("NullWriteRead1D8_c_MPI.bp");
#else
adios2_adios *adios = adios2_init_serial();
const std::string fname("NullWriteRead1D8_c.bp");
#endif
{
adios2_io *io = adios2_declare_io(adios, "WriteNull");
Expand Down
14 changes: 12 additions & 2 deletions testing/adios2/bindings/fortran/TestBPWriteTypes.F90
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,20 @@ program TestBPWriteTypes
stop 1
end if

#if ADIOS2_USE_MPI
call adios2_open(bpWriter, ioWrite, "ftypes_mpi.bp", adios2_mode_write, ierr)
#else
call adios2_open(bpWriter, ioWrite, "ftypes.bp", adios2_mode_write, ierr)

#endif
if( bpWriter%valid .eqv. .false. ) then
write(*,*) 'Invalid adios2_engine post-open'
stop 1
end if
#if ADIOS2_USE_MPI
if( TRIM(bpWriter%name) /= "ftypes_mpi.bp") then
#else
if( TRIM(bpWriter%name) /= "ftypes.bp") then
#endif
write(*,*) 'Invalid adios2_engine name'
stop 1
end if
Expand Down Expand Up @@ -307,8 +314,11 @@ program TestBPWriteTypes
! Declare io reader
call adios2_declare_io(ioRead, adios, "ioRead", ierr)
! Open bpReader engine
#if ADIOS2_USE_MPI
call adios2_open(bpReader, ioRead, "ftypes_mpi.bp", adios2_mode_readRandomAccess, ierr)
#else
call adios2_open(bpReader, ioRead, "ftypes.bp", adios2_mode_readRandomAccess, ierr)

#endif
call adios2_steps(nsteps, bpReader, ierr)
if(nsteps /= 3) then
write(*,*) 'ftypes.bp must have 3 steps'
Expand Down
4 changes: 3 additions & 1 deletion testing/adios2/engine/bp/TestBPAccuracyDefaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class AccuracyTests : public ::testing::Test
// Check if SetAccuracy/GetAccuracy default behavior works
TEST_F(AccuracyTests, DefaultAccuracy)
{
const std::string fname("DefaultAccuracy.bp");

int mpiRank = 0, mpiSize = 1;

Expand All @@ -40,6 +39,9 @@ TEST_F(AccuracyTests, DefaultAccuracy)
#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
const std::string fname("DefaultAccuracy_MPI.bp");
#else
const std::string fname("DefaultAccuracy.bp");
#endif

std::vector<int64_t> localData(Nx);
Expand Down
11 changes: 8 additions & 3 deletions testing/adios2/engine/bp/TestBPBufferSize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ size_t GetAndPrintBufferSize(adios2::Engine &engine, const std::string &info,
// Put(Sync) and Put(Deferred) should have the same buffer consumption
TEST_F(BPBufferSizeTest, SyncDeferredIdenticalUsage)
{
std::string fnameSync = "ADIOS2BPBufferSizeSync.bp";
std::string fnameDeferred = "ADIOS2BPBufferSizeDeferred.bp";
std::string fnameDeferredPP = "ADIOS2BPBufferSizeDeferredPP.bp";
int mpiRank = 0, mpiSize = 1;
// Number of rows
const std::size_t Nx = 10485760; // 10M elements, 80MB variable
Expand All @@ -94,6 +91,14 @@ TEST_F(BPBufferSizeTest, SyncDeferredIdenticalUsage)
#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
std::string fnameSync = "ADIOS2BPBufferSizeSync_MPI.bp";
std::string fnameDeferred = "ADIOS2BPBufferSizeDeferred_MPI.bp";
std::string fnameDeferredPP = "ADIOS2BPBufferSizeDeferredPP_MPI.bp";
#else
std::string fnameSync = "ADIOS2BPBufferSizeSync.bp";
std::string fnameDeferred = "ADIOS2BPBufferSizeDeferred.bp";
std::string fnameDeferredPP = "ADIOS2BPBufferSizeDeferredPP.bp";

#endif

// Write test data using BP
Expand Down
3 changes: 2 additions & 1 deletion testing/adios2/engine/bp/TestBPChangingShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ TEST_F(BPChangingShape, BPWriteReadShape2D)
// Each process would write a 4x2 array and all processes would
// form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here

const std::string fname("BPChangingShape.bp");
const int nsteps = 10;
int rank = 0, nproc = 1;

#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nproc);
const std::string fname("BPChangingShape_MPI.bp");
adios2::ADIOS adios(MPI_COMM_WORLD);
#else
const std::string fname("BPChangingShape.bp");
adios2::ADIOS adios;
#endif
// Writer
Expand Down
3 changes: 2 additions & 1 deletion testing/adios2/engine/bp/TestBPChangingShapeWithinStep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ TEST_P(BPChangingShapeWithinStep, MultiBlock)
auto params = std::get<1>(GetParam());
double epsilon = std::get<2>(GetParam());

const std::string fname("BPChangingShapeMultiblock_" + operatorName + ".bp");
const int nsteps = 2;
const std::vector<int> nblocks = {2, 3};
const int N = 16384; // size of one block (should be big enough to compress)
Expand All @@ -48,8 +47,10 @@ TEST_P(BPChangingShapeWithinStep, MultiBlock)
#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nproc);
const std::string fname("BPChangingShapeMultiblock_" + operatorName + "_MPI.bp");
adios2::ADIOS adios(MPI_COMM_WORLD);
#else
const std::string fname("BPChangingShapeMultiblock_" + operatorName + ".bp");
adios2::ADIOS adios;
#endif

Expand Down
4 changes: 3 additions & 1 deletion testing/adios2/engine/bp/TestBPDirectIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ TEST_F(ADIOSReadDirectIOTest, BufferResize)
and the last chunck is resized back. It should be properly aligned
to not cause any problems at writing that chunk.
*/
std::string filename = "ADIOSDirectIO.bp";

int mpiRank = 0, mpiSize = 1;

#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
std::string filename = "ADIOSDirectIO_MPI.bp";
#else
std::string filename = "ADIOSDirectIO.bp";
#endif

// Write test data using BP
Expand Down
16 changes: 12 additions & 4 deletions testing/adios2/engine/bp/TestBPFStreamWriteReadHighLevelAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ TEST_F(StreamWriteReadHighLevelAPI, ADIOS2BPWriteRead1D8)
{
// Each process would write a 1x8 array and all processes would
// form a mpiSize * Nx 1D array
const std::string fname("ADIOS2BPWriteRead1D8_hl.bp");

int mpiRank = 0, mpiSize = 1;
// Number of rows
Expand All @@ -44,6 +43,9 @@ TEST_F(StreamWriteReadHighLevelAPI, ADIOS2BPWriteRead1D8)
#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
const std::string fname("ADIOS2BPWriteRead1D8_hl_MPI.bp");
#else
const std::string fname("ADIOS2BPWriteRead1D8_hl.bp");
#endif

// write test data using BP
Expand Down Expand Up @@ -414,7 +416,6 @@ TEST_F(StreamWriteReadHighLevelAPI, ADIOS2BPwriteRead2D2x4)
{
// Each process would write a 2x4 array and all processes would
// form a 2D 2 * (numberOfProcess*Nx) matrix where Nx is 4 here
const std::string fname("ADIOS2BPwriteRead2D2x4Test_hl.bp");

int mpiRank = 0, mpiSize = 1;
// Number of rows
Expand All @@ -429,6 +430,9 @@ TEST_F(StreamWriteReadHighLevelAPI, ADIOS2BPwriteRead2D2x4)
#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
const std::string fname("ADIOS2BPwriteRead2D2x4Test_hl_MPI.bp");
#else
const std::string fname("ADIOS2BPwriteRead2D2x4Test_hl.bp");
#endif

// write test data using ADIOS2
Expand Down Expand Up @@ -534,7 +538,6 @@ TEST_F(StreamWriteReadHighLevelAPI, ADIOS2BPwriteRead2D4x2)
{
// Each process would write a 4x2 array and all processes would
// form a 2D 4 * (NumberOfProcess * Nx) matrix where Nx is 2 here
const std::string fname("ADIOS2BPwriteRead2D4x2Test_hl.bp");

int mpiRank = 0, mpiSize = 1;
// Number of rows
Expand All @@ -548,6 +551,9 @@ TEST_F(StreamWriteReadHighLevelAPI, ADIOS2BPwriteRead2D4x2)
#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
const std::string fname("ADIOS2BPwriteRead2D4x2Test_hl_MPI.bp");
#else
const std::string fname("ADIOS2BPwriteRead2D4x2Test_hl.bp");
#endif

// write test data using ADIOS2
Expand Down Expand Up @@ -652,16 +658,18 @@ TEST_F(StreamWriteReadHighLevelAPI, DoubleOpenException)
{
// Each process would write a 1x8 array and all processes would
// form a mpiSize * Nx 1D array
const std::string fname("ADIOS2BP_hl_exception.bp");

{
#if ADIOS2_USE_MPI
const std::string fname("ADIOS2BP_hl_exception_MPI.bp");

adios2::fstream oStream(fname, adios2::fstream::out, MPI_COMM_WORLD, engineName);
EXPECT_THROW(oStream.open("second", adios2::fstream::out, MPI_COMM_WORLD, engineName),
std::invalid_argument);

#else
const std::string fname("ADIOS2BP_hl_exception.bp");

adios2::fstream oStream(fname, adios2::fstream::out);
EXPECT_THROW(oStream.open("second", adios2::fstream::out, engineName),
std::invalid_argument);
Expand Down
4 changes: 3 additions & 1 deletion testing/adios2/engine/bp/TestBPFortranToCppReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ class BPFortranToCppRead : public ::testing::Test

TEST_F(BPFortranToCppRead, ADIOS2BPFortranToCppRead)
{
const std::string fname("FortranToCpp.bp");

int mpiRank = 0, mpiSize = 1;

#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
const std::string fname("FortranToCpp_MPI.bp");
#else
const std::string fname("FortranToCpp.bp");
#endif

#if ADIOS2_USE_MPI
Expand Down
5 changes: 5 additions & 0 deletions testing/adios2/engine/bp/TestBPFortranToCppWriter.F90
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,13 @@ end function iargc
if (irank == 0) print *,"engine type :",trim(engine_type)


#if ADIOS2_USE_MPI
call adios2_open(bpWriter, ioWrite, "FortranToCpp_MPI.bp", &
adios2_mode_write, ierr)
#else
call adios2_open(bpWriter, ioWrite, "FortranToCpp.bp", &
adios2_mode_write, ierr)
#endif

do s = 1, 3
call adios2_begin_step(bpWriter, ierr)
Expand Down
4 changes: 3 additions & 1 deletion testing/adios2/engine/bp/TestBPInquireDefine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class ADIOSInquireDefineTest : public ::testing::Test

TEST_F(ADIOSInquireDefineTest, Read)
{
std::string filename = "ADIOSInquireDefine.bp";

// Number of steps
const int32_t NSteps = 5;
Expand All @@ -33,6 +32,9 @@ TEST_F(ADIOSInquireDefineTest, Read)
#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
std::string filename = "ADIOSInquireDefine_MPI.bp";
#else
std::string filename = "ADIOSInquireDefine.bp";
#endif

// Write test data using BP
Expand Down

0 comments on commit a65abe2

Please sign in to comment.