Skip to content

Commit deb4bda

Browse files
committed
mpi4py: run the spawn and dynamic process tests
Split the mpi4py Github Action into 4 parts: 1. build: do everything to build, configure, and install Open MPI and mpi4py 2. run: run all the mpi4py tests with its defaults. As of March 2024, this disables the spawn and dynamic tests, which means that the entire block of tests should pass. 3. run_spawn: run all the mpi4py tests, including the spawn tests, but only if the "mpi4py" label is set on the PR. As of March 2024, we know some of these tests are failing. 4. run_dynamic: run all the mpi4py tests, including the dynamic tests, but only if the "mpi4py" label is set on the PR. As of March 2024, we know some of these tests are failing. The spawn and dynamic failures are different, so we split them up and run them separately. For steps 2, 3, and 4, we utilize a reusable Github workflow so that we don't have to duplicate the code. Signed-off-by: Jeff Squyres <[email protected]>
1 parent 2911d48 commit deb4bda

File tree

2 files changed

+138
-37
lines changed

2 files changed

+138
-37
lines changed

.github/workflows/ompi_mpi4py.yaml

Lines changed: 69 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
name: mpi4py
22

3-
on: [pull_request]
3+
on: [ pull_request ]
44

55
jobs:
6-
mpi4py:
6+
build:
77
runs-on: ubuntu-latest
8-
timeout-minutes: 60
9-
8+
timeout-minutes: 30
109
steps:
11-
1210
- name: Configure hostname
1311
run: echo 127.0.0.1 `hostname` | sudo tee -a /etc/hosts > /dev/null
1412
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
@@ -28,6 +26,11 @@ jobs:
2826
run: ./autogen.pl
2927
working-directory: mpi-build
3028

29+
# Install into a separate directory (/opt/openmpi) so that we can
30+
# bundle up that tree into an artifact to share with other jobs in
31+
# this github action. Specifically don't use /usr/local, because
32+
# there's a bunch of other stuff already installed in /usr/local,
33+
# and we don't need to include that in our artifact.
3134
- name: Configure Open MPI
3235
run: ./configure
3336
--disable-dependency-tracking
@@ -36,7 +39,8 @@ jobs:
3639
--disable-sphinx
3740
--disable-mpi-fortran
3841
--disable-oshmem
39-
LDFLAGS=-Wl,-rpath,/usr/local/lib
42+
--prefix=/opt/openmpi
43+
LDFLAGS=-Wl,-rpath,/opt/openmpi/lib
4044
working-directory: mpi-build
4145

4246
- name: Build MPI
@@ -47,6 +51,9 @@ jobs:
4751
run: sudo make install
4852
working-directory: mpi-build
4953

54+
- name: Add Open MPI to PATH
55+
run: echo /opt/openmpi/bin >> $GITHUB_PATH
56+
5057
- name: Tweak MPI
5158
run: |
5259
# Tweak MPI
@@ -84,37 +91,62 @@ jobs:
8491
with:
8592
repository: "mpi4py/mpi4py"
8693

87-
- name: Install mpi4py
88-
run: python -m pip install .
94+
- name: Build mpi4py wheel
95+
run: python -m pip wheel .
8996
env:
9097
CFLAGS: "-O0"
9198

92-
- name: Test mpi4py (singleton)
93-
run: python test/main.py -v
94-
if: ${{ true }}
95-
timeout-minutes: 10
96-
- name: Test mpi4py (np=1)
97-
run: mpiexec -n 1 python test/main.py -v
98-
if: ${{ true }}
99-
timeout-minutes: 10
100-
- name: Test mpi4py (np=2)
101-
run: mpiexec -n 2 python test/main.py -v -f
102-
if: ${{ true }}
103-
timeout-minutes: 10
104-
- name: Test mpi4py (np=3)
105-
run: mpiexec -n 3 python test/main.py -v -f
106-
if: ${{ true }}
107-
timeout-minutes: 10
108-
- name: Test mpi4py (np=4)
109-
run: mpiexec -n 4 python test/main.py -v -f
110-
if: ${{ true }}
111-
timeout-minutes: 10
112-
- name: Test mpi4py (np=5)
113-
run: mpiexec -n 5 python test/main.py -v -f
114-
if: ${{ true }}
115-
timeout-minutes: 10
116-
117-
- name: Test mpi4py.run
118-
run: python demo/test-run/test_run.py -v
119-
if: ${{ true }}
120-
timeout-minutes: 10
99+
- name: Save the artifacts for other jobs
100+
uses: actions/upload-artifact@v4
101+
with:
102+
path: |
103+
/opt/openmpi
104+
~/.openmpi
105+
~/.prte
106+
test
107+
demo
108+
mpi4py-*.whl
109+
retention-days: 2
110+
name: build-artifacts
111+
112+
#==============================================
113+
114+
run_defaults:
115+
# This whole set of tests run with mpi4py's defaults. As of March
116+
# 2024, this means disabling the spawn and dynamic tests. We want
117+
# this job of tests to pass.
118+
needs: [ build ]
119+
uses: ./.github/workflows/ompi_mpi4py_tests.yaml
120+
with:
121+
# This parameter is required, so send a meaningless
122+
# environment variable name that will not affect the tests at
123+
# all (i.e., the tests will be run with default values).
124+
env_name: MAKE_TODAY_AN_OMPI_DAY
125+
126+
#==============================================
127+
128+
run_spawn:
129+
# This whole set of tests runs explicitly with setting "enable the
130+
# spawn tests". As of March 2024, we know that Open MPI is
131+
# failing these tests.
132+
needs: [ build ]
133+
# Only run if the label "mpi4py" is set on this PR.
134+
if: ${{ contains(github.event.pull_request.labels.*.name, 'mpi4py-all') }}
135+
uses: ./.github/workflows/ompi_mpi4py_tests.yaml
136+
with:
137+
# Enable the spawn tests
138+
env_name: MPI4PY_TEST_SPAWN
139+
140+
#==============================================
141+
142+
run_dynamic:
143+
# This whole set of tests runs explicitly with setting "enable the
144+
# spawn tests". As of March 2024, we know that Open MPI is
145+
# failing these tests.
146+
needs: [ build ]
147+
# Only run if the label "mpi4py" is set on this PR.
148+
if: ${{ contains(github.event.pull_request.labels.*.name, 'mpi4py-all') }}
149+
uses: ./.github/workflows/ompi_mpi4py_tests.yaml
150+
with:
151+
# Enable the dynamic process tests
152+
env_name: MPI4PY_TEST_DYNPROC
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# This is a reusable workflow that is invoked from mpi4py.yaml.
2+
#
3+
# It expects a single parameter: env_name. This string sets an
4+
# environment variable of that name to value "1".
5+
6+
name: mpi4py-tests
7+
8+
on:
9+
workflow_call:
10+
inputs:
11+
env_name:
12+
required: true
13+
type: string
14+
15+
jobs:
16+
mpi4py-tests:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 30
19+
env:
20+
${{ inputs.env_name}}: 1
21+
steps:
22+
- name: Use Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: 3
26+
architecture: x64
27+
- name: Get artifacts
28+
uses: actions/download-artifact@v4
29+
with:
30+
path: /
31+
name: build-artifacts
32+
- name: Restore executable permissions
33+
run: chmod a+x /opt/openmpi/bin/*
34+
- name: Add Open MPI to PATH
35+
run: echo /opt/openmpi/bin >> $GITHUB_PATH
36+
- name: Install the mpi4py wheel
37+
run: python -m pip install mpi4py --no-index --find-links=.
38+
39+
#----------------------------------------------
40+
41+
- name: Test mpi4py (singleton)
42+
run: python test/main.py -v
43+
if: ${{ true }}
44+
timeout-minutes: 10
45+
- name: Test mpi4py (np=1)
46+
run: mpiexec -n 1 python test/main.py -v
47+
if: ${{ true }}
48+
timeout-minutes: 10
49+
- name: Test mpi4py (np=2)
50+
run: mpiexec -n 2 python test/main.py -v -f
51+
if: ${{ true }}
52+
timeout-minutes: 10
53+
- name: Test mpi4py (np=3)
54+
run: mpiexec -n 3 python test/main.py -v -f
55+
if: ${{ true }}
56+
timeout-minutes: 10
57+
- name: Test mpi4py (np=4)
58+
run: mpiexec -n 4 python test/main.py -v -f
59+
if: ${{ true }}
60+
timeout-minutes: 10
61+
- name: Test mpi4py (np=5)
62+
run: mpiexec -n 5 python test/main.py -v -f
63+
if: ${{ true }}
64+
timeout-minutes: 10
65+
66+
- name: Test mpi4py.run
67+
run: python demo/test-run/test_run.py -v
68+
if: ${{ true }}
69+
timeout-minutes: 10

0 commit comments

Comments
 (0)