This is project is in development.
It will provide a C++ and Python API for openPMD writing and reading, both in serial and parallel (MPI). Initial backends will include ADIOS and HDF5.
Syntax not yet implemented as shown below
#include <openPMD/openPMD.hpp>
#include <iostream>
// ...
auto s = openPMD::Series::read("output_files/data%T.h5");
std::cout << "Read iterations...";
for( auto const& i : s.iterations )
{
// mesh records
for( auto const& m : i.second.meshes )
{
std::cout << "Read attributes for mesh " << m.first
<< " in iteration " << i.first << ":\n";
for( auto const& val : m.second.attributes() )
std::cout << '\t' << val << '\n';
std::cout << '\n';
}
// particle records
for( auto const& p : i.second.particles )
{
std::cout << "Read attributes for particle species " << p.first
<< " in iteration " << i.first << ":\n";
for( auto const& val : p.second.attributes() )
std::cout << '\t' << val << '\n';
std::cout << '\n';
}
}
// ...
not yet implemented
Curious? Our manual shows full read & write examples, both serial an MPI-parallel!
Required:
- CMake 3.10.0+
- Boost 1.62.0+:
filesystem
,system
,unit_test_framework
Shipped internally:
- MPark.Variant 1.3.0+
Optional I/O backends:
- HDF5 1.8.6+
- ADIOS 1.10+ (not yet implemented)
- ADIOS 2.1+ (not yet implemented)
while those can be build either with or without:
- MPI 2.3+, e.g. OpenMPI or MPICH2
Optional language bindings:
- Python: (not yet implemented)
- pybind11 2.3.0+
- xtensor-python 0.17.0+
Choose one of the install methods below to get started:
not yet implemented
spack install openpmd-api
spack load openpmd-api
not yet implemented
openPMD can then be installed using CMake:
git clone https://github.com/openPMD/openPMD-api.git
mkdir -p openPMD-api-build
cd openPMD-api-build
# for own install prefix append:
# -DCMAKE_INSTALL_PREFIX=$HOME/somepath
# for options append:
# -DopenPMD_USE_...=...
cmake ../openPMD-api
make -j
# optional
make test
# sudo is only required for system paths
sudo make install
The following options can be added to the cmake
call to control features.
CMake controls options with prefixed -D
, e.g. -DopenPMD_USE_MPI=OFF
:
CMake Option | Values | Description |
---|---|---|
openPMD_USE_MPI |
AUTO/ON/OFF | Enable MPI support |
openPMD_USE_HDF5 |
AUTO/ON/OFF | Enable support for HDF5 |
openPMD_USE_ADIOS1 |
AUTO/ON/OFF | Enable support for ADIOS1 1 |
openPMD_USE_ADIOS2 |
AUTO/ON/OFF | Enable support for ADIOS2 1 |
openPMD_USE_PYTHON |
AUTO/ON/OFF | Enable Python bindings 1 |
1 not yet implemented
Additionally, the following libraries are shipped internally. The following options allow to switch to external installs:
CMake Option | Values | Library | Version |
---|---|---|---|
openPMD_USE_INTERNAL_VARIANT |
ON/OFF | MPark.Variant | 1.3.0+ |
By default, this will build as a static library (libopenPMD.a
) and installs also its headers.
In order to build a static library, append -DBUILD_SHARED_LIBS=ON
to the cmake
command.
You can only build a static or a shared library at a time.
By default, the Release
version is built.
In order to build with debug symbols, pass -DCMAKE_BUILD_TYPE=Debug
to your cmake
command.
The install will contain header files and libraries in the path set with -DCMAKE_INSTALL_PREFIX
.
If your project is using CMake for its build, one can conveniently use our provided Config.cmake
package which is installed alongside the library.
First set the following environment hint if openPMD-api was not installed in a system path:
# optional: only needed if installed outside of system paths
export CMAKE_PREFIX_PATH=$HOME/somepath:$CMAKE_PREFIX_PATH
Use the following lines in your projects CMakeLists.txt
:
# supports: COMPONENTS MPI HDF5 ADIOS1 ADIOS2
find_package(openPMD 0.1.0 CONFIG)
if(openPMD_FOUND)
target_link_libraries(YourTarget PRIVATE openPMD::openPMD)
endif()