Skip to content

Commit 3d1c98f

Browse files
committed
Add mpirun wrapper to scrub OpenMPI 5 env vars
Disables shared memory communication to prevent signal 7 bus errors, and scrubs leaked PMIX/PRTE/OMPI variables from Python singletons to prevent double-initialization crashes in subprocesses on Fedora.
1 parent ca7f68e commit 3d1c98f

1 file changed

Lines changed: 47 additions & 25 deletions

File tree

.ci_fedora.sh

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,53 @@ fi
3434
test . != ".$1" && mpi="$1" || mpi=openmpi
3535

3636
## If we are called as normal user, run test
37-
cp -a /tmp/BOUT-dev /home/test/
38-
. /etc/profile.d/modules.sh
39-
module load mpi/${1}-x86_64
40-
export OMPI_MCA_rmaps_base_oversubscribe=yes
41-
export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe
42-
export TRAVIS=true
43-
# Try limiting openmp threads
44-
export FLEXIBLAS=NETLIB
45-
export MKL_NUM_THREADS=1
46-
export NUMEXPR_NUM_THREADS=1
47-
export OMP_NUM_THREADS=1
48-
cd
49-
cd BOUT-dev
37+
cp -a /tmp/BOUT-dev /home/test/
38+
. /etc/profile.d/modules.sh
39+
module load mpi/${1}-x86_64
40+
export OMPI_MCA_rmaps_base_oversubscribe=yes
41+
export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe
42+
export TRAVIS=true
43+
# Try limiting openmp threads
44+
export FLEXIBLAS=NETLIB
45+
export MKL_NUM_THREADS=1
46+
export NUMEXPR_NUM_THREADS=1
47+
export OMP_NUM_THREADS=1
5048

51-
echo "Installing Python requirements inside Fedora container..."
52-
# Install pytest and dependencies for the user inside the container
53-
sudo dnf install -y python3-pip
54-
python3 -m pip install --user -r requirements.txt
49+
# --- NEW FIXES FOR OPENMPI 5 IN DOCKER ---
5550

56-
echo "starting configure"
57-
time cmake -S . -B build -DBOUT_USE_PETSC=ON \
58-
-DBOUT_UPDATE_GIT_SUBMODULE=OFF \
59-
-DBOUT_USE_SYSTEM_FMT=ON \
60-
-DBOUT_USE_SYSTEM_MPARK_VARIANT=ON \
61-
-DBOUT_USE_SUNDIALS=ON
51+
# 1. Disable shared memory communication to prevent Signal 7 Bus Errors
52+
export OMPI_MCA_btl="tcp,self"
6253

63-
time make -C build build-check -j 2
64-
time make -C build check
54+
# 2. Create an mpirun wrapper to scrub leaked environment variables
55+
# from Python singletons before they poison the subprocesses.
56+
mkdir -p "$HOME/bin"
57+
58+
cat << 'EOF' > "$HOME/bin/mpirun"
59+
#!/bin/bash
60+
vars=$(env | cut -d= -f1 | grep -E '^(OMPI_|PMIX_|PRTE_)')
61+
if [ -n "$vars" ]; then
62+
unset $vars
63+
fi
64+
exec /usr/lib64/openmpi/bin/mpirun "$@"
65+
EOF
66+
67+
chmod +x "$HOME/bin/mpirun"
68+
export PATH="$HOME/bin:$PATH"
69+
70+
cd
71+
cd BOUT-dev
72+
73+
echo "Installing Python requirements inside Fedora container..."
74+
# Install pytest and dependencies for the user inside the container
75+
sudo dnf install -y python3-pip
76+
python3 -m pip install --user -r requirements.txt
77+
78+
echo "starting configure"
79+
time cmake -S . -B build -DBOUT_USE_PETSC=ON \
80+
-DBOUT_UPDATE_GIT_SUBMODULE=OFF \
81+
-DBOUT_USE_SYSTEM_FMT=ON \
82+
-DBOUT_USE_SYSTEM_MPARK_VARIANT=ON \
83+
-DBOUT_USE_SUNDIALS=ON
84+
85+
time make -C build build-check -j 2
86+
time make -C build check

0 commit comments

Comments
 (0)