Skip to content

Commit

Permalink
Only run SSC tests if ADIOS2 has been built with SSC
Browse files Browse the repository at this point in the history
To do this, add .ssc as a possible file ending and enlist it under the
file endings.
  • Loading branch information
franzpoeschel committed Feb 24, 2021
1 parent 376790f commit b7009eb
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 18 deletions.
1 change: 1 addition & 0 deletions include/openPMD/IO/Format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace openPMD
ADIOS1,
ADIOS2,
ADIOS2_SST,
ADIOS2_SSC,
JSON,
DUMMY
};
Expand Down
4 changes: 4 additions & 0 deletions src/Format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ namespace openPMD {
}
if (auxiliary::ends_with(filename, ".sst"))
return Format::ADIOS2_SST;
if (auxiliary::ends_with(filename, ".ssc"))
return Format::ADIOS2_SSC;
if (auxiliary::ends_with(filename, ".json"))
return Format::JSON;
if (std::string::npos != filename.find('.') /* extension is provided */ )
Expand All @@ -73,6 +75,8 @@ namespace openPMD {
return ".bp";
case Format::ADIOS2_SST:
return ".sst";
case Format::ADIOS2_SSC:
return ".ssc";
case Format::JSON:
return ".json";
default:
Expand Down
6 changes: 6 additions & 0 deletions src/IO/AbstractIOHandlerHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ namespace openPMD
case Format::ADIOS2_SST:
return std::make_shared< ADIOS2IOHandler >(
path, access, comm, std::move( optionsJson ), "sst" );
case Format::ADIOS2_SSC:
return std::make_shared< ADIOS2IOHandler >(
path, access, comm, std::move( optionsJson ), "ssc" );
default:
throw std::runtime_error(
"Unknown file format! Did you specify a file ending?" );
Expand Down Expand Up @@ -89,6 +92,9 @@ namespace openPMD
case Format::ADIOS2_SST:
return std::make_shared< ADIOS2IOHandler >(
path, access, std::move( optionsJson ), "sst" );
case Format::ADIOS2_SSC:
return std::make_shared< ADIOS2IOHandler >(
path, access, std::move( optionsJson ), "ssc" );
#endif // openPMD_HAVE_ADIOS2
case Format::JSON:
return std::make_shared< JSONIOHandler >( path, access );
Expand Down
11 changes: 11 additions & 0 deletions src/Series.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,7 @@ namespace
case Format::ADIOS1:
case Format::ADIOS2:
case Format::ADIOS2_SST:
case Format::ADIOS2_SSC:
case Format::JSON:
return auxiliary::replace_last(filename, suffix(f), "");
default:
Expand Down Expand Up @@ -1238,6 +1239,16 @@ namespace
nameReg += + ")" + postfix + ".sst$";
return buildMatcher(nameReg);
}
case Format::ADIOS2_SSC:
{
std::string nameReg = "^" + prefix + "([[:digit:]]";
if( padding != 0 )
nameReg += "{" + std::to_string(padding) + "}";
else
nameReg += "+";
nameReg += + ")" + postfix + ".ssc$";
return buildMatcher(nameReg);
}
case Format::JSON: {
std::string nameReg = "^" + prefix + "([[:digit:]]";
if (padding != 0)
Expand Down
3 changes: 3 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ openPMD::getFileExtensions()
#ifdef ADIOS2_HAVE_SST
fext.emplace_back("sst");
#endif
#ifdef ADIOS2_HAVE_SSC
fext.emplace_back("ssc");
#endif
#if openPMD_HAVE_HDF5
fext.emplace_back("h5");
#endif
Expand Down
26 changes: 11 additions & 15 deletions test/ParallelIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,13 @@ TEST_CASE( "parallel_adios2_json_config", "[parallel][adios2]" )
void
adios2_ssc()
{
auto const extensions = openPMD::getFileExtensions();
if( std::find( extensions.begin(), extensions.end(), "sst" ) ==
extensions.end() )
{
// SSC engine not available in ADIOS2
return;
}
int global_size{ -1 };
int global_rank{ -1 };
MPI_Comm_size( MPI_COMM_WORLD, &global_size );
Expand All @@ -1047,23 +1054,13 @@ adios2_ssc()

constexpr size_t extent = 10;

std::string options = R"(
{
"adios2": {
"engine": {
"type": "ssc"
}
}
})";

if( color == 0 )
{
// write
Series writeSeries(
"../samples/adios2_stream.bp",
"../samples/adios2_stream.ssc",
Access::CREATE,
local_comm,
options );
local_comm );
auto iterations = writeSeries.writeIterations();
for( size_t i = 0; i < 10; ++i )
{
Expand All @@ -1082,10 +1079,9 @@ adios2_ssc()
{
// read
Series readSeries(
"../samples/adios2_stream.bp",
"../samples/adios2_stream.ssc",
Access::READ_ONLY,
local_comm,
options );
local_comm );

size_t last_iteration_index = 0;
for( auto iteration : readSeries.readIterations() )
Expand Down
7 changes: 5 additions & 2 deletions test/SerialIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ using namespace openPMD;
std::vector< std::string > testedFileExtensions()
{
auto allExtensions = getFileExtensions();
auto newEnd =
std::remove( allExtensions.begin(), allExtensions.end(), "sst" );
auto newEnd = std::remove_if(
allExtensions.begin(),
allExtensions.end(),
[]( std::string const & ext )
{ return ext == "sst" || ext == "ssc"; } );
return { allExtensions.begin(), newEnd };
}

Expand Down
4 changes: 3 additions & 1 deletion test/python/unittest/API/APITest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@

from TestUtilities.TestUtilities import generateTestFilePath

tested_file_extensions = [ext for ext in io.file_extensions if ext != 'sst']
tested_file_extensions = [
ext for ext in io.file_extensions if ext != 'sst' and ext != 'ssc'
]


class APITest(unittest.TestCase):
Expand Down

0 comments on commit b7009eb

Please sign in to comment.