Skip to content

Commit

Permalink
Merge branch 'dev' into clang_tidy_all_performance_checks
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Nov 9, 2023
2 parents d92d69a + 9ad33b0 commit 55976fc
Show file tree
Hide file tree
Showing 36 changed files with 432 additions and 128 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exclude: '^share/openPMD/thirdParty'
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
Expand Down Expand Up @@ -66,7 +66,7 @@ repos:
# clang-format v13
# to run manually, use .github/workflows/clang-format/clang-format.sh
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
rev: v17.0.4
hooks:
- id: clang-format
# By default, the clang-format hook configures:
Expand All @@ -80,7 +80,7 @@ repos:

# Autoremoves unused Python imports
- repo: https://github.com/hadialqattan/pycln
rev: v2.2.2
rev: v2.3.0
hooks:
- id: pycln
name: pycln (python)
Expand Down
12 changes: 8 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,6 @@ if(openPMD_HAVE_PYTHON)
src/binding/python/BaseRecord.cpp
src/binding/python/BaseRecordComponent.cpp
src/binding/python/ChunkInfo.cpp
src/binding/python/Container.cpp
src/binding/python/Dataset.cpp
src/binding/python/Datatype.cpp
src/binding/python/Error.cpp
Expand Down Expand Up @@ -1356,17 +1355,22 @@ if(openPMD_BUILD_TESTING)
add_test(NAME CLI.pipe.py
COMMAND sh -c
"${MPI_TEST_EXE} ${Python_EXECUTABLE} \
${openPMD_RUNTIME_OUTPUT_DIRECTORY}/openpmd-pipe \
${openPMD_RUNTIME_OUTPUT_DIRECTORY}/openpmd-pipe \
--infile ../samples/git-sample/data%T.h5 \
--outfile ../samples/git-sample/data%T.bp && \
\
${MPI_TEST_EXE} ${Python_EXECUTABLE} \
${openPMD_RUNTIME_OUTPUT_DIRECTORY}/openpmd-pipe \
${openPMD_RUNTIME_OUTPUT_DIRECTORY}/openpmd-pipe \
--infile ../samples/git-sample/data00000100.h5 \
--outfile ../samples/git-sample/single_iteration.bp && \
\
${MPI_TEST_EXE} ${Python_EXECUTABLE} \
${openPMD_RUNTIME_OUTPUT_DIRECTORY}/openpmd-pipe \
--infile ../samples/git-sample/thetaMode/data%T.h5 \
--outfile ../samples/git-sample/thetaMode/data.bp && \
\
${Python_EXECUTABLE} \
${openPMD_RUNTIME_OUTPUT_DIRECTORY}/openpmd-pipe \
${openPMD_RUNTIME_OUTPUT_DIRECTORY}/openpmd-pipe \
--infile ../samples/git-sample/thetaMode/data.bp \
--outfile ../samples/git-sample/thetaMode/data%T.json \
"
Expand Down
21 changes: 18 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ FROM quay.io/pypa/manylinux2010_x86_64 as build-env
# FROM quay.io/pypa/manylinux1_x86_64 as build-env
ENV DEBIAN_FRONTEND noninteractive

# Python 3.8-3.11 via "38 39 311"
ARG PY_VERSIONS="38 39 310 311"
# Python 3.8-3.12 via "38 39 311 312"
ARG PY_VERSIONS="38 39 310 311 312"

# static libs need relocatable symbols for linking to shared python lib
ENV CFLAGS="-fPIC ${CFLAGS}"
Expand Down Expand Up @@ -162,7 +162,7 @@ FROM debian:bullseye
ENV DEBIAN_FRONTEND noninteractive
COPY --from=build-env /wheelhouse/openPMD_api-*-cp311-cp311-manylinux2010_x86_64.whl .
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3.10 python3-distutils ca-certificates curl \
&& apt-get install -y --no-install-recommends python3.11 python3-distutils ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
RUN python3.11 --version \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
Expand All @@ -172,6 +172,21 @@ RUN python3.11 -c "import openpmd_api as io; print(io.__version__); print
RUN python3.11 -m openpmd_api.ls --help
RUN openpmd-ls --help

# test in fresh env: Debian:Bullseye + Python 3.12
FROM debian:bullseye
ENV DEBIAN_FRONTEND noninteractive
COPY --from=build-env /wheelhouse/openPMD_api-*-cp312-cp312-manylinux2010_x86_64.whl .
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3.12 python3-distutils ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
RUN python3.12 --version \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3.12 get-pip.py \
&& python3.12 -m pip install openPMD_api-*-cp312-cp312-manylinux2010_x86_64.whl
RUN python3.12 -c "import openpmd_api as io; print(io.__version__); print(io.variants)"
RUN python3.12 -m openpmd_api.ls --help
RUN openpmd-ls --help

# copy binary artifacts (wheels)
FROM quay.io/pypa/manylinux2010_x86_64
MAINTAINER Axel Huebl <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ while those can be built either with or without:

Optional language bindings:
* Python:
* Python 3.8 - 3.11
* Python 3.8 - 3.12
* pybind11 2.11.1+
* numpy 1.15+
* mpi4py 2.1+ (optional, for MPI)
Expand Down Expand Up @@ -195,7 +195,7 @@ python3 -m pip install openpmd-api
If MPI-support shall be enabled, we always have to recompile:
```bash
# optional: --user
python3 -m pip install -U pip setuptools wheel
python3 -m pip install -U pip packaging setuptools wheel
python3 -m pip install -U cmake

# optional: --user
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ numpy>=1.15
pygments
recommonmark
scipy
sphinx>=5.3
sphinx>=5.3,<7.2
sphinx-copybutton
sphinx-design
sphinx_rtd_theme>=1.1.1
Expand Down
7 changes: 6 additions & 1 deletion docs/source/citation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The most general reference to openPMD is:

.. tip::

Axel Huebl, Remi Lehe, Jean-Luc Vay, David P. Grote, Ivo F. Sbalzarini, Stephan Kuschel, David Sagan, Christopher Mayes, Frederic Perez, Fabian Koller, and Michael Bussmann.
Axel Huebl, Remi Lehe, Jean-Luc Vay, David P. Grote, Ivo F. Sbalzarini, Stephan Kuschel, David Sagan, Christopher Mayes, Frederic Perez, Fabian Koller, Franz Poeschel, Carsten Fortmann-Grote, Angel Ferran Pousa, Juncheng E, Maxence Thevenet and Michael Bussmann.
*"openPMD: A meta data standard for particle and mesh based data,"*
`DOI:10.5281/zenodo.591699 <https://doi.org/10.5281/zenodo.591699>`_ (2015)

Expand All @@ -33,6 +33,11 @@ The equivalent BibTeX code is:
Mayes, Christopher and
P{\'e}rez, Fr{\'e}d{\'e}ric and
Koller, Fabian and
Poeschel, Franz and
Fortmann-Grote, Carsten and
Ferran Pousa, Angel and
E, Juncheng and
Th{\'e}venet, Maxence and
Bussmann, Michael},
title = {{openPMD: A meta data standard for particle and mesh based data}},
year = 2015,
Expand Down
7 changes: 4 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import subprocess

from recommonmark.parser import CommonMarkParser
import sphinx_rtd_theme

# import sys
# sys.path.insert(0, os.path.abspath('.'))
Expand Down Expand Up @@ -58,8 +59,6 @@
shell=True)

if not on_rtd:
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -117,7 +116,9 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'

numfig = True

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
2 changes: 1 addition & 1 deletion docs/source/dev/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Optional: language bindings

* Python:

* Python 3.8 - 3.11
* Python 3.8 - 3.12
* pybind11 2.11.1+
* numpy 1.15+
* mpi4py 2.1+ (optional, for MPI)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/install/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ If MPI-support shall be enabled, we always have to recompile:
.. code-block:: bash
# optional: --user
python3 -m pip install -U pip setuptools wheel
python3 -m pip install -U pip packaging setuptools wheel
python3 -m pip install -U cmake
# optional: --user
Expand Down
113 changes: 113 additions & 0 deletions include/openPMD/DatatypeMacros.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/* Copyright 2023 Franz Poeschel
*
* This file is part of openPMD-api.
*
* openPMD-api is free software: you can redistribute it and/or modify
* it under the terms of of either the GNU General Public License or
* the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* openPMD-api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License and the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* and the GNU Lesser General Public License along with openPMD-api.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once

#include <array>
#include <complex>
#include <vector>

// Need to alias this to avoid the comma
// Cannot use a namespace, otherwise the macro will work either only within
// or outside the namespace
// Defining macros means polluting the global namespace anyway
using openpmd_array_double_7 = std::array<double, 7>;

#define OPENPMD_FOREACH_DATATYPE(MACRO) \
MACRO(char) \
MACRO(unsigned char) \
MACRO(signed char) \
MACRO(short) \
MACRO(int) \
MACRO(long) \
MACRO(long long) \
MACRO(unsigned short) \
MACRO(unsigned int) \
MACRO(unsigned long) \
MACRO(unsigned long long) \
MACRO(float) \
MACRO(double) \
MACRO(long double) \
MACRO(std::complex<float>) \
MACRO(std::complex<double>) \
MACRO(std::complex<long double>) \
MACRO(std::string) \
MACRO(std::vector<char>) \
MACRO(std::vector<short>) \
MACRO(std::vector<int>) \
MACRO(std::vector<long>) \
MACRO(std::vector<long long>) \
MACRO(std::vector<unsigned char>) \
MACRO(std::vector<unsigned short>) \
MACRO(std::vector<unsigned int>) \
MACRO(std::vector<unsigned long>) \
MACRO(std::vector<unsigned long long>) \
MACRO(std::vector<float>) \
MACRO(std::vector<double>) \
MACRO(std::vector<long double>) \
MACRO(std::vector<std::complex<float>>) \
MACRO(std::vector<std::complex<double>>) \
MACRO(std::vector<std::complex<long double>>) \
MACRO(std::vector<signed char>) \
MACRO(std::vector<std::string>) \
MACRO(openpmd_array_double_7) \
MACRO(bool)

#define OPENPMD_FOREACH_NONVECTOR_DATATYPE(MACRO) \
MACRO(char) \
MACRO(unsigned char) \
MACRO(signed char) \
MACRO(short) \
MACRO(int) \
MACRO(long) \
MACRO(long long) \
MACRO(unsigned short) \
MACRO(unsigned int) \
MACRO(unsigned long) \
MACRO(unsigned long long) \
MACRO(float) \
MACRO(double) \
MACRO(long double) \
MACRO(std::complex<float>) \
MACRO(std::complex<double>) \
MACRO(std::complex<long double>) \
MACRO(std::string) \
MACRO(array_double_7) \
MACRO(bool)

#define OPENPMD_FOREACH_DATASET_DATATYPE(MACRO) \
MACRO(char) \
MACRO(unsigned char) \
MACRO(signed char) \
MACRO(short) \
MACRO(int) \
MACRO(long) \
MACRO(long long) \
MACRO(unsigned short) \
MACRO(unsigned int) \
MACRO(unsigned long) \
MACRO(unsigned long long) \
MACRO(float) \
MACRO(double) \
MACRO(long double) \
MACRO(std::complex<float>) \
MACRO(std::complex<double>) \
MACRO(std::complex<long double>) \
MACRO(std::array<double, 7>)
24 changes: 24 additions & 0 deletions include/openPMD/UndefDatatypeMacros.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Copyright 2023 Franz Poeschel
*
* This file is part of openPMD-api.
*
* openPMD-api is free software: you can redistribute it and/or modify
* it under the terms of of either the GNU General Public License or
* the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* openPMD-api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License and the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* and the GNU Lesser General Public License along with openPMD-api.
* If not, see <http://www.gnu.org/licenses/>.
*/

#undef OPENPMD_FOREACH_DATATYPE
#undef OPENPMD_FOREACH_NONVECTOR_DATATYPE
#undef OPENPMD_FOREACH_DATASET_DATATYPE
Loading

0 comments on commit 55976fc

Please sign in to comment.