Skip to content

💾 C++ & 🐍 API for writing & reading (H5, BP, ...), serial & parallel (MPI)

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
Notifications You must be signed in to change notification settings

eucall-software/openPMD-api

 
 

Repository files navigation

openPMD - API for Developers

Supported openPMD Standard Documentation Status Code Status dev Language Language Development Phase License

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.

Usage

C++

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';
    }
}

// ...

Python

not yet implemented

More!

Curious? Our manual shows full read & write examples, both serial an MPI-parallel!

Dependencies

Required:

  • CMake 3.10.0+
  • Boost 1.62.0+: filesystem, system, unit_test_framework

Shipped internally:

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+

Installation

Spack Package Conda Package

Choose one of the install methods below to get started:

Spack

not yet implemented

spack install openpmd-api
spack load openpmd-api

Conda

not yet implemented

From Source

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.

Linking to your project

The install will contain header files and libraries in the path set with -DCMAKE_INSTALL_PREFIX.

CMake

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()

About

💾 C++ & 🐍 API for writing & reading (H5, BP, ...), serial & parallel (MPI)

Resources

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 94.6%
  • CMake 5.3%
  • Shell 0.1%