Skip to content

Commit cd2644d

Browse files
authored
openPMD: no BP5 Group Based (#5735)
Disallow BP5 with group based encoding, because it creates files that cannot be read back efficiently. What works: BP4 f, BP4 g, BP5 f, BP5 v (still experimental, not yet fully supported in readers), H5 f, H5 g. References: - BLAST-ImpactX/impactx#870 - openPMD/openPMD-api#1724 - openPMD/openPMD-api#1457 (comment) cc @franzpoeschel
1 parent 47235b9 commit cd2644d

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

Docs/source/usage/parameters.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -2813,14 +2813,14 @@ In-situ capabilities can be used by turning on Sensei or Ascent (provided they a
28132813

28142814
* ``<diag_name>.openpmd_backend`` (``bp5``, ``bp4``, ``h5`` or ``json``) optional, only used if ``<diag_name>.format = openpmd``
28152815
`I/O backend <https://openpmd-api.readthedocs.io/en/latest/backends/overview.html>`_ for `openPMD <https://www.openPMD.org>`_ data dumps.
2816-
``bp`` is the `ADIOS I/O library <https://csmd.ornl.gov/adios>`_, ``h5`` is the `HDF5 format <https://www.hdfgroup.org/solutions/hdf5/>`_, and ``json`` is a `simple text format <https://en.wikipedia.org/wiki/JSON>`_.
2817-
``json`` only works with serial/single-rank jobs.
2816+
``bp5``/``bp4`` is the `ADIOS I/O library <https://csmd.ornl.gov/adios>`_, ``h5`` is the `HDF5 format <https://www.hdfgroup.org/solutions/hdf5/>`_, and ``json`` is a `simple text format <https://en.wikipedia.org/wiki/JSON>`_.
2817+
``json`` is for debugging and only works with serial/single-rank jobs.
28182818
When WarpX is compiled with openPMD support, the first available backend in the order given above is taken.
28192819

28202820
* ``<diag_name>.openpmd_encoding`` (optional, ``v`` (variable based), ``f`` (file based) or ``g`` (group based) ) only read if ``<diag_name>.format = openpmd``.
28212821
openPMD `file output encoding <https://openpmd-api.readthedocs.io/en/0.16.1/usage/concepts.html#iteration-and-series>`__.
28222822
File based: one file per timestep (slower), group/variable based: one file for all steps (faster)).
2823-
``variable based`` is an `experimental feature with ADIOS2 <https://openpmd-api.readthedocs.io/en/0.16.1/backends/adios2.html#experimental-new-adios2-schema>`__ and not supported for back-transformed diagnostics.
2823+
``variable based`` is an `experimental feature with ADIOS2 BP5 <https://openpmd-api.readthedocs.io/en/0.16.1/backends/adios2.html#experimental-new-adios2-schema>`__ that will replace ``g``.
28242824
Default: ``f`` (full diagnostics)
28252825

28262826
* ``<diag_name>.adios2_operator.type`` (``zfp``, ``blosc``) optional,
@@ -2854,7 +2854,7 @@ In-situ capabilities can be used by turning on Sensei or Ascent (provided they a
28542854
<diag_name>.openpmd_backend = bp5
28552855
<diag_name>.adios2_engine.parameters.FlattenSteps = on
28562856
2857-
* ``<diag_name>.adios2_engine.type`` (``bp4``, ``sst``, ``ssc``, ``dataman``) optional,
2857+
* ``<diag_name>.adios2_engine.type`` (``bp5``, ``bp4``, ``sst``, ``ssc``, ``dataman``) optional,
28582858
`ADIOS2 Engine type <https://openpmd-api.readthedocs.io/en/0.16.1/details/backendconfig.html#adios2>`__ for `openPMD <https://www.openPMD.org>`_ data dumps.
28592859
See full list of engines at `ADIOS2 readthedocs <https://adios2.readthedocs.io/en/latest/engines/engines.html>`__
28602860

Docs/source/usage/workflows/ml_materials/run_warpx_training.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def get_laser(antenna_z, profile_t_peak, fill_in=True):
274274
data_list=diag_particle_list,
275275
write_dir="lab_particle_diags",
276276
warpx_format="openpmd",
277-
warpx_openpmd_backend="bp",
277+
warpx_openpmd_backend="bp5",
278278
)
279279

280280
btd_field_diag = picmi.LabFrameFieldDiagnostic(
@@ -287,7 +287,7 @@ def get_laser(antenna_z, profile_t_peak, fill_in=True):
287287
warpx_upper_bound=[128.0e-6, 0.0e-6, 0.0],
288288
write_dir="lab_field_diags",
289289
warpx_format="openpmd",
290-
warpx_openpmd_backend="bp",
290+
warpx_openpmd_backend="bp5",
291291
)
292292

293293
field_diag = picmi.FieldDiagnostic(

Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ FlushFormatOpenPMD::FlushFormatOpenPMD (const std::string& diag_name)
4646
encoding = openPMD::IterationEncoding::fileBased;
4747
}
4848

49+
// BP5 does not support groupBased (metadata explosion)
50+
if ((openpmd_backend == "bp5" || openpmd_backend == "bp") &&
51+
(encoding == openPMD::IterationEncoding::groupBased))
52+
{
53+
throw std::runtime_error("BeamMonitor: groupBased encoding not supported for BP5.");
54+
}
55+
4956
std::string diag_type_str;
5057
pp_diag_name.get("diag_type", diag_type_str);
5158
if (diag_type_str == "BackTransformed")

Source/Diagnostics/OpenPMDHelpFunction.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ WarpXOpenPMDFileType ()
1717
std::string openPMDFileType;
1818
#ifdef WARPX_USE_OPENPMD
1919
#if openPMD_HAVE_ADIOS2==1
20-
openPMDFileType = "bp";
20+
openPMDFileType = "bp5";
2121
#elif openPMD_HAVE_ADIOS1==1
22-
openPMDFileType = "bp";
22+
openPMDFileType = "bp"; // bp3
2323
#elif openPMD_HAVE_HDF5==1
2424
openPMDFileType = "h5";
2525
#else

Source/Diagnostics/WarpXOpenPMD.H

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public:
8282
/** Initialize openPMD I/O routines
8383
*
8484
* @param ie iteration encoding from openPMD: "group, file, variable"
85-
* @param filetype file backend, e.g. "bp" or "h5"
85+
* @param filetype file backend, e.g. "bp5", "bp4", or "h5"
8686
* @param operator_type openPMD-api backend operator (compressor) for ADIOS2
8787
* @param operator_parameters openPMD-api backend operator parameters for ADIOS2
8888
* @param engine_type ADIOS engine for output
@@ -149,7 +149,7 @@ public:
149149
bool isBTD = false,
150150
const amrex::Geometry& full_BTD_snapshot=amrex::Geometry() ) const;
151151

152-
/** Return OpenPMD File type ("bp" or "h5" or "json")*/
152+
/** Return OpenPMD File type ("bp5", "bp4", "h5" or "json")*/
153153
std::string OpenPMDFileType () { return m_OpenPMDFileType; }
154154

155155
private:
@@ -350,7 +350,7 @@ private:
350350
int m_MPISize = 1;
351351

352352
openPMD::IterationEncoding m_Encoding = openPMD::IterationEncoding::fileBased;
353-
std::string m_OpenPMDFileType = "bp"; //! MPI-parallel openPMD backend: bp or h5
353+
std::string m_OpenPMDFileType = "bp5"; //! MPI-parallel openPMD backend: bp5, bp4 or h5
354354
std::string m_OpenPMDoptions = "{}"; //! JSON option string for openPMD::Series constructor
355355
int m_CurrentStep = -1;
356356

0 commit comments

Comments
 (0)