Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# FIXME: all performance-* reports
# FIXME: all cert-* reports
# FIXME: all bugprone-* reports
Checks: -*,bugprone-*,-bugprone-unhandled-self-assignment,-bugprone-parent-virtual-call,-bugprone-narrowing-conversions,-bugprone-exception-escape,-bugprone-string-literal-with-embedded-nul,cppcoreguidelines-slicing,mpi-*,readability-non-const-parameter,performance-*,modernize-*,-modernize-use-trailing-return-type,-modernize-use-bool-literals,-modernize-avoid-c-arrays,-modernize-use-auto,-modernize-return-braced-init-list,-bugprone-easily-swappable-parameters
Checks: -*,bugprone-*,-bugprone-unhandled-self-assignment,-bugprone-parent-virtual-call,-bugprone-narrowing-conversions,-bugprone-exception-escape,-bugprone-string-literal-with-embedded-nul,cppcoreguidelines-slicing,mpi-*,readability-non-const-parameter,performance-*,-performance-avoid-endl,modernize-*,-modernize-use-trailing-return-type,-modernize-use-bool-literals,-modernize-avoid-c-arrays,-modernize-use-auto,-modernize-return-braced-init-list,-bugprone-easily-swappable-parameters,-bugprone-chained-comparison
HeaderFilterRegex: '((^(?!\/share\/openPMD\/).*)*include\/openPMD\/.+\.hpp|src\/^(?!binding).+\.cpp$)'
66 changes: 45 additions & 21 deletions .github/ci/spack-envs/clangtidy_nopy_ompi_h5_ad2/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,54 +14,78 @@ spack:
packages:
adios2:
variants: ~zfp ~sz ~png ~dataman ~python ~fortran ~ssc ~shared ~bzip2 ~mgard

c-blosc2:
# snappy broken on CMake 4.0
# fixed snappy not yet deployed to a Spack release
variants: ~snappy

cmake:
externals:
- spec: [email protected].5
prefix: /usr
- spec: [email protected].8
prefix: /usr/local
buildable: False

openmpi:
externals:
- spec: [email protected].2
- spec: [email protected].6
prefix: /usr
buildable: False

perl:
externals:
- spec: perl@5.34.0
- spec: perl@5.38.2
prefix: /usr
buildable: False

python:
externals:
- spec: python@3.10.12
- spec: python@3.12.3
prefix: /usr
buildable: False

all:
target: [x86_64]
variants: ~fortran
providers:
mpi: [openmpi]
compiler: [[email protected]]
cc: [llvm]
cxx: [llvm]
fortran: [gcc]

llvm:
externals:
- spec: [email protected]
prefix: /usr
paths:
cc: /usr/bin/clang-19
cxx: /usr/bin/clang++-19
modules: []
environment: {}
extra_rpaths: []
buildable: False

gcc:
externals:
- spec: [email protected]
prefix: /usr
paths:
cc: /usr/bin/gcc
cxx: /usr/bin/g++
fortran: /usr/bin/gfortran
modules: []
environment: {}
extra_rpaths: []
buildable: False

compilers:
- compiler:
environment: {}
extra_rpaths: []
flags: {}
modules: []
operating_system: ubuntu22.04
paths:
cc: /usr/bin/clang-14
cxx: /usr/bin/clang++-14
f77: /usr/bin/gfortran
fc: /usr/bin/gfortran
spec: [email protected]
target: x86_64
gcc-runtime:
buildable: false
externals:
- spec: [email protected]
prefix: /usr

config:
build_jobs: 2

mirrors:
E4S: https://cache.e4s.io
spack-public: https://mirror.spack.io
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the change of mirror URL, cache.e4s.io is outdated

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, perfect! :)

2 changes: 1 addition & 1 deletion .github/workflows/dependencies/install_spack
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

set -eu -o pipefail

spack_ver="0.22.3"
spack_ver="${SPACK_VER:-0.22.3}"

cd /opt
if [[ -d spack && ! -f spack_${spack_ver} ]]
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/tooling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ concurrency:
cancel-in-progress: true

jobs:
clangtidy14_nopy_ompi_h5_ad2:
clangtidy19_nopy_ompi_h5_ad2:
name: clang-tidy w/o py
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
- name: Spack Cache
uses: actions/cache@v3
with: {path: /opt/spack, key: clangtidy14_nopy_ompi_h5_ad2 }
with: {path: /opt/spack, key: clangtidy19_nopy_ompi_h5_ad2 }
- name: Install
run: |
sudo apt-get update
sudo apt-get install clang clang-tidy gfortran libopenmpi-dev python-is-python3
sudo .github/workflows/dependencies/install_spack
SPACK_VER=1.0.1 sudo -E .github/workflows/dependencies/install_spack
echo "SPACK VERSION: $(spack --version)"
- name: Build
env: {CC: clang, CXX: clang++}
run: |
Expand All @@ -36,32 +37,31 @@ jobs:
cat build/clang-tidy.log
if [[ $(wc -m <build/clang-tidy.log) -gt 1 ]]; then exit 1; fi

clangsanitizer14_py38_ompi_h5_ad2:
clangsanitizer19_py38_ompi_h5_ad2:
name: Clang ASAN UBSAN
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
- name: Spack Cache
uses: actions/cache@v3
with: {path: /opt/spack, key: clang14_nopy_ompi_h5_ad2 }
with: {path: /opt/spack, key: clang19_nopy_ompi_h5_ad2 }
- name: Install
run: |
sudo apt-get update
sudo apt-get install clang-14 libc++-dev libc++abi-dev python3 gfortran libopenmpi-dev
python3 -m pip install -U pip
python3 -m pip install -U numpy
sudo .github/workflows/dependencies/install_spack
sudo apt-get install clang-19 libc++-dev libc++abi-dev python3 gfortran libopenmpi-dev python3-numpy
SPACK_VER=1.0.1 sudo -E .github/workflows/dependencies/install_spack
echo "SPACK VERSION: $(spack --version)"
- name: Build
env: {CC: mpicc, CXX: mpic++, OMPI_CC: clang-14, OMPI_CXX: clang++-14, CXXFLAGS: -Werror, OPENPMD_HDF5_CHUNKS: none, OPENPMD_TEST_NFILES_MAX: 100}
env: {CC: mpicc, CXX: mpic++, OMPI_CC: clang-19, OMPI_CXX: clang++-19, CXXFLAGS: -Werror, OPENPMD_HDF5_CHUNKS: none, OPENPMD_TEST_NFILES_MAX: 100}
run: |
sudo ln -s "$(which cmake)" /usr/bin/cmake
eval $(spack env activate --sh .github/ci/spack-envs/clangtidy_nopy_ompi_h5_ad2/)
spack install
SOURCEPATH="$(pwd)"
share/openPMD/download_samples.sh build
export LDFLAGS="${LDFLAGS} -fsanitize=address,undefined -shared-libsan"
export CXXFLAGS="${CXXFLAGS} -fsanitize=address,undefined -shared-libsan"
export CXXFLAGS="${CXXFLAGS} -fsanitize=address,undefined -shared-libsan -DOMPI_SKIP_MPICXX"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check -DOMPI_SKIP_MPICXX. For some reason, this run pulls in the C++ bindings of MPI and then fails. This can be avoided with this preprocessor define, but there might be a better solution. I see that we have some finicky config in CMakeLists.txt on whether we link with MPI::MPI_C or MPI::MPI_CXX. Changing one to the other made no difference in my tests.

Copy link
Member

@ax3l ax3l Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found in the past that surprisingly, the C API of MPI sometimes depends on the (outdated) C++ bindings (e.g., BullMPI, which is an OpenMPI variant)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a CMake option MPI_CXX_SKIP_MPICXX

Add some definitions that will disable the MPI-2 C++ bindings. Currently supported are MPICH, Open MPI, Platform MPI and derivatives thereof, for example MVAPICH or Intel MPI.

Let's add that! :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will do that in a follow-up PR, so we can patch it out if it causes issues after all.

cmake -S . -B build \
-DopenPMD_USE_MPI=ON \
-DopenPMD_USE_PYTHON=ON \
Expand All @@ -72,7 +72,7 @@ jobs:
cmake --build build --parallel 2
export ASAN_OPTIONS=detect_stack_use_after_return=1:detect_leaks=1:check_initialization_order=true:strict_init_order=true:detect_stack_use_after_scope=1:fast_unwind_on_malloc=0
export LSAN_OPTIONS=suppressions="$SOURCEPATH/.github/ci/sanitizer/clang/Leak.supp"
export LD_PRELOAD=/usr/lib/clang/14/lib/linux/libclang_rt.asan-x86_64.so
export LD_PRELOAD=/usr/lib/clang/19/lib/linux/libclang_rt.asan-x86_64.so
ctest --test-dir build -E 3b --output-on-failure
export OPENPMD_HDF5_CHUNKS="auto"
ctest --test-dir build -R 3b --output-on-failure
1 change: 0 additions & 1 deletion examples/8b_benchmark_read_parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ class Timer
~Timer()
{
MPI_Barrier(MPI_COMM_WORLD);
std::string tt = "~" + m_Tag;
// MemoryProfiler (m_Rank, tt.c_str());
m_End = std::chrono::system_clock::now();

Expand Down
2 changes: 2 additions & 0 deletions include/openPMD/IO/HDF5/HDF5IOHandlerImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ class HDF5IOHandlerImpl : public AbstractIOHandlerImpl
hid_t id;
};
std::optional<File> getFile(Writable *);
File
requireFile(std::string const &functionName, Writable *, bool checkParent);
}; // HDF5IOHandlerImpl
#else
class HDF5IOHandlerImpl
Expand Down
4 changes: 1 addition & 3 deletions include/openPMD/IO/JSON/JSONIOHandlerImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,7 @@ class JSONIOHandlerImpl : public AbstractIOHandlerImpl
};

template <typename T>
struct JsonToCpp<
T,
typename std::enable_if<std::is_floating_point<T>::value>::type>
struct JsonToCpp<T, typename std::enable_if_t<std::is_floating_point_v<T>>>
{
T operator()(nlohmann::json const &);
};
Expand Down
2 changes: 1 addition & 1 deletion include/openPMD/backend/BaseRecord.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class BaseRecord
template <class InputIt>
void insert(InputIt first, InputIt last);
void insert(std::initializer_list<value_type> ilist);
void swap(BaseRecord &other);
void swap(BaseRecord &other) noexcept;
bool contains(key_type const &key) const;
template <class... Args>
auto emplace(Args &&...args) -> std::pair<iterator, bool>;
Expand Down
5 changes: 3 additions & 2 deletions src/IO/ADIOS/ADIOS2File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "openPMD/auxiliary/Environment.hpp"
#include "openPMD/auxiliary/StringManip.hpp"

#include <cstdint>
#include <optional>
#include <stdexcept>

Expand Down Expand Up @@ -317,7 +318,7 @@ namespace
return false;
}

enum class PerstepParsing
enum class PerstepParsing : std::uint8_t
{
Supported,
Unsupported,
Expand Down Expand Up @@ -1086,7 +1087,7 @@ void ADIOS2File::flush_impl(ADIOS2FlushParams flushParams, bool writeLatePuts)
#if ADIOS2_VERSION_MAJOR * 1000000000 + ADIOS2_VERSION_MINOR * 100000000 + \
ADIOS2_VERSION_PATCH * 1000000 + ADIOS2_VERSION_TWEAK >= \
2701001223
enum class CleanedFlushTarget
enum class CleanedFlushTarget : std::uint8_t
{
Buffer,
Disk,
Expand Down
3 changes: 1 addition & 2 deletions src/IO/ADIOS/ADIOS2IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ namespace
*/
using rep = detail::AttributeTypes<bool>::rep;

if constexpr (std::is_same<T, rep>::value)
if constexpr (std::is_same_v<T, rep>)
{
auto attr = getAttribute.template call<rep>(name);
if (!attr)
Expand Down Expand Up @@ -2239,7 +2239,6 @@ namespace detail
auto file = impl->refreshFileFromParent(
writable, /* preferParentFile = */ false);
auto fullName = impl->nameOfAttribute(writable, parameters.name);
auto prefix = impl->filePositionToString(pos);

auto &filedata = impl->getFileData(
file, ADIOS2IOHandlerImpl::IfFileNotOpen::ThrowError);
Expand Down
8 changes: 4 additions & 4 deletions src/IO/AbstractIOHandlerHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ std::unique_ptr<AbstractIOHandler> createIOHandler<json::TracingJSON>(
return constructIOHandler<ParallelHDF5IOHandler, openPMD_HAVE_HDF5>(
"HDF5",
std::move(initialize_from),
path,
std::move(path),
access,
comm,
std::move(options));
Expand Down Expand Up @@ -139,7 +139,7 @@ std::unique_ptr<AbstractIOHandler> createIOHandler<json::TracingJSON>(
return constructIOHandler<JSONIOHandler, openPMD_HAVE_JSON>(
"JSON",
std::move(initialize_from),
path,
std::move(path),
access,
comm,
std::move(options),
Expand All @@ -149,7 +149,7 @@ std::unique_ptr<AbstractIOHandler> createIOHandler<json::TracingJSON>(
return constructIOHandler<JSONIOHandler, openPMD_HAVE_JSON>(
"JSON",
std::move(initialize_from),
path,
std::move(path),
access,
comm,
std::move(options),
Expand Down Expand Up @@ -181,7 +181,7 @@ std::unique_ptr<AbstractIOHandler> createIOHandler<json::TracingJSON>(
return constructIOHandler<HDF5IOHandler, openPMD_HAVE_HDF5>(
"HDF5",
std::move(initialize_from),
path,
std::move(path),
access,
std::move(options));
case Format::ADIOS2_BP:
Expand Down
Loading
Loading