From dfe5d616c534c15fa08570583cf5ad31b5cb7d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Tue, 5 Dec 2023 15:18:56 +0100 Subject: [PATCH] Try working around current CI issues with clang14 on MacOS --- .github/workflows/macos.yml | 3 +- .github/workflows/mpirun_workaround.sh | 46 ++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100755 .github/workflows/mpirun_workaround.sh diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index bfc70bf508..f317f55ff2 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -40,7 +40,8 @@ jobs: -DopenPMD_USE_MPI=ON \ -DopenPMD_USE_HDF5=ON \ -DopenPMD_USE_ADIOS2=ON \ - -DopenPMD_USE_INVASIVE_TESTS=ON + -DopenPMD_USE_INVASIVE_TESTS=ON \ + -DMPIEXEC_EXECUTABLE=./.github/workflows/mpirun_workaround.sh cmake --build build --parallel 3 ctest --test-dir build --verbose diff --git a/.github/workflows/mpirun_workaround.sh b/.github/workflows/mpirun_workaround.sh new file mode 100755 index 0000000000..cf9d47bb62 --- /dev/null +++ b/.github/workflows/mpirun_workaround.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +# mpiexec currently seems to have a bug where it tries to parse parameters +# of the launched application when they start with a dash, e.g. +# `mpiexec python ./openpmd-pipe --infile in.bp --outfile out.bp` +# leads to: +# > An unrecognized option was included on the mpiexec command line: +# > +# > Option: --infile +# > +# > Please use the "mpiexec --help" command to obtain a list of all +# > supported options. +# +# This script provides a workaround by putting the called sub-command into +# a script in a temporary file. + +mpirun_args=() + +script_file="$(mktemp -p .)" + +cleanup() { + rm "$script_file" +} +trap cleanup EXIT + +while true; do + case "$1" in + -c | -np | --np | -n | --n ) + mpirun_args+=("$1" "$2") + shift + shift + ;; + *) + break + ;; + esac +done + +echo -e '#!/usr/bin/env bash\n' > "$script_file" +for item in "$@"; do + echo -n "'$item' " >> "$script_file" +done + +chmod +x "$script_file" + +mpirun "${mpirun_args[@]}" "$script_file"