Skip to content

Commit e27e72c

Browse files
authored
New reading engine "TimeSeries" that can read .ats text file listing a series of BP/H5 files. (ornladios#4520)
- Both Read and ReadRandomAccess modes are supported. - Full paths and relative paths to other directories are allowed in each line. - Mix of BP4, BP5 and HDF5 files are allowed. - Stream mode only returns `end of stream` when a line starting with `--end` encountered. `--end` is not required for ReadRandomAccess mode. - Empty lines and comments starting with `#` are ignored. Format of the ATS file: ``` gs100.bp gs300.bp gs500.bp --end-- ``` - Test case with changing variable shape for BP3/BP4/BP5 engines
1 parent c8ffb1e commit e27e72c

File tree

8 files changed

+1268
-4
lines changed

8 files changed

+1268
-4
lines changed

source/adios2/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ add_library(adios2_core
5959
engine/bp5/BP5Writer_TwoLevelShm_Async.cpp
6060
engine/bp5/BP5Writer_TwoLevelShm.cpp
6161

62+
engine/timeseries/TimeSeriesReader.cpp engine/timeseries/TimeSeriesReader.tcc
63+
6264
engine/skeleton/SkeletonReader.cpp engine/skeleton/SkeletonReader.tcc
6365
engine/skeleton/SkeletonWriter.cpp engine/skeleton/SkeletonWriter.tcc
6466

source/adios2/core/IO.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "adios2/engine/plugin/PluginEngine.h"
3434
#include "adios2/engine/skeleton/SkeletonReader.h"
3535
#include "adios2/engine/skeleton/SkeletonWriter.h"
36+
#include "adios2/engine/timeseries/TimeSeriesReader.h"
3637

3738
#include "adios2/helper/adiosComm.h"
3839
#include "adios2/helper/adiosCommDummy.h"
@@ -139,6 +140,9 @@ std::unordered_map<std::string, IO::EngineFactoryEntry> Factory = {
139140
{IO::NoEngine("ERROR: nullcore engine does not support read mode"),
140141
IO::MakeEngine<engine::NullWriter>}},
141142
{"plugin", {IO::MakeEngine<plugin::PluginEngine>, IO::MakeEngine<plugin::PluginEngine>}},
143+
{"timeseries",
144+
{IO::MakeEngine<engine::TimeSeriesReader>,
145+
IO::NoEngine("ERROR: campaign engine does not support write mode")}},
142146

143147
{"campaign",
144148
#ifdef ADIOS2_HAVE_CAMPAIGN
@@ -156,7 +160,7 @@ const std::unordered_map<std::string, bool> ReadRandomAccess_Supported = {
156160
{"ssc", false}, {"mhs", false}, {"sst", false}, {"daos", false},
157161
{"effis", false}, {"dataspaces", false}, {"hdf5", false}, {"skeleton", true},
158162
{"inline", false}, {"null", true}, {"nullcore", true}, {"plugin", false},
159-
{"campaign", true},
163+
{"campaign", true}, {"timeseries", true},
160164
};
161165

162166
// Synchronize access to the factory in case one thread is
@@ -586,6 +590,10 @@ Engine &IO::Open(const std::string &name, const Mode mode, helper::Comm comm, co
586590
{
587591
engineTypeLC = "campaign";
588592
}
593+
else if (helper::EndsWith(name, ".ats", false))
594+
{
595+
engineTypeLC = "timeseries";
596+
}
589597
else if ((mode_to_use == Mode::Read) || (mode_to_use == Mode::ReadRandomAccess))
590598
{
591599
if (adios2sys::SystemTools::FileIsDirectory(name))
@@ -632,9 +640,16 @@ Engine &IO::Open(const std::string &name, const Mode mode, helper::Comm comm, co
632640
falls back to default (BP4) */
633641
if (engineTypeLC == "filestream")
634642
{
635-
char v = helper::BPVersion(name, comm, m_TransportsParameters);
636-
engineTypeLC = "bp";
637-
engineTypeLC.push_back(v);
643+
if (helper::EndsWith(name, ".ats", false))
644+
{
645+
engineTypeLC = "timeseries";
646+
}
647+
else
648+
{
649+
char v = helper::BPVersion(name, comm, m_TransportsParameters);
650+
engineTypeLC = "bp";
651+
engineTypeLC.push_back(v);
652+
}
638653
// std::cout << "Engine " << engineTypeLC << " selected for FileStream"
639654
// << std::endl;
640655
}

0 commit comments

Comments
 (0)