Skip to content

Commit c2eeee3

Browse files
committed
Enable ASAN for mpi4py in CI
Run mpi4py with ASAN, with a separate step that aborts on errors. The existing steps should run to completion even if an error is detected. Signed-off-by: Joseph Schuchart <joseph.schuchart@stonybrook.edu>
1 parent 3e00498 commit c2eeee3

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

.github/workflows/ompi_mpi4py.yaml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,22 @@ jobs:
2424
timeout-minutes: 30
2525
env:
2626
MPI4PY_TEST_SPAWN: true
27+
# ASAN needs to come first
28+
#LD_PRELOAD: /usr/lib/x86_64-linux-gnu/libasan.so.8
29+
# disable ODR violation detection until #13469 is fixed
30+
# and don't abort on error by default
31+
ASAN_OPTIONS: verify_asan_link_order=0,detect_odr_violation=0,abort_on_error=0
32+
# disable leak detection and make sure we do not fail on leaks
33+
LSAN_OPTIONS: detect_leaks=0,exitcode=0
34+
2735
steps:
2836
- name: Configure hostname
2937
run: echo 127.0.0.1 `hostname` | sudo tee -a /etc/hosts > /dev/null
3038
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
3139

3240
- name: Install depencencies
3341
run: sudo apt-get install -y -q
34-
libnuma-dev
42+
libnuma-dev libasan8
3543
if: ${{ runner.os == 'Linux' }}
3644

3745
- name: Checkout Open MPI
@@ -59,7 +67,8 @@ jobs:
5967
--disable-oshmem
6068
--disable-silent-rules
6169
--prefix=/opt/openmpi
62-
LDFLAGS=-Wl,-rpath,/opt/openmpi/lib
70+
CFLAGS="-fno-omit-frame-pointer -g -O1 -fsanitize=address"
71+
LDFLAGS="-Wl,-rpath,/opt/openmpi/lib -fsanitize=address"
6372
working-directory: mpi-build
6473

6574
- name: Build MPI
@@ -158,3 +167,24 @@ jobs:
158167
if: ${{ true }}
159168
timeout-minutes: 10
160169

170+
- name: Test mpi4py ASAN (np=1)
171+
env:
172+
LD_PRELOAD: /usr/lib/x86_64-linux-gnu/libasan.so.8
173+
# run again and abort if ASAN detects an error
174+
ASAN_OPTIONS: detect_odr_violation=0,abort_on_error=1
175+
# enable leak detection but do not fail on leaks
176+
LSAN_OPTIONS: detect_leaks=1,exitcode=0
177+
run: mpiexec -n 1 python test/main.py -v -x TestExcErrhandlerNull
178+
if: ${{ true }}
179+
timeout-minutes: 10
180+
181+
- name: Test mpi4py ASAN (np=4)
182+
env:
183+
LD_PRELOAD: /usr/lib/x86_64-linux-gnu/libasan.so.8
184+
# run again and abort if ASAN detects an error
185+
ASAN_OPTIONS: detect_odr_violation=0,abort_on_error=1
186+
# enable leak detection but do not fail on leaks
187+
LSAN_OPTIONS: detect_leaks=1,exitcode=0
188+
run: mpiexec -n 4 python test/main.py -v -f -x TestExcErrhandlerNull
189+
if: ${{ true }}
190+
timeout-minutes: 10

0 commit comments

Comments
 (0)