Skip to content

Commit 49ecbba

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 49ecbba

1 file changed

Lines changed: 33 additions & 3 deletions

File tree

.github/workflows/ompi_mpi4py.yaml

Lines changed: 33 additions & 3 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
@@ -145,6 +154,28 @@ jobs:
145154
if: ${{ true }}
146155
timeout-minutes: 10
147156

157+
- name: Setting up ASAN environment
158+
run: |
159+
echo LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.8 >> $GITHUB_ENV
160+
echo ASAN_OPTIONS=detect_odr_violation=0,abort_on_error=1 >> $GITHUB_ENV
161+
echo LSAN_OPTIONS=detect_leaks=1,exitcode=0 >> $GITHUB_ENV
162+
163+
- name: Test mpi4py ASAN (np=1)
164+
run: mpiexec -n 1 python test/main.py -v -x TestExcErrhandlerNull
165+
if: ${{ true }}
166+
timeout-minutes: 10
167+
168+
- name: Test mpi4py ASAN (np=4)
169+
run: mpiexec -n 4 python test/main.py -v -f -x TestExcErrhandlerNull
170+
if: ${{ true }}
171+
timeout-minutes: 10
172+
173+
- name: Disabling ASAN environment
174+
run: |
175+
echo LD_PRELOAD= >> $GITHUB_ENV
176+
echo ASAN_OPTIONS=verify_asan_link_order=0,detect_odr_violation=0,abort_on_error=0 >> $GITHUB_ENV
177+
echo LSAN_OPTIONS=detect_leaks=0,exitcode=0 >> $GITHUB_ENV
178+
148179
- name: Relocate Open MPI installation
149180
run: mv /opt/openmpi /opt/ompi
150181
- name: Update PATH and set OPAL_PREFIX and LD_LIBRARY_PATH
@@ -157,4 +188,3 @@ jobs:
157188
run: python test/main.py -v -x TestExcErrhandlerNull
158189
if: ${{ true }}
159190
timeout-minutes: 10
160-

0 commit comments

Comments
 (0)