Skip to content

Commit 5f80479

Browse files
committed
ci: Test new actions in the MPI workflow
1 parent 40876ac commit 5f80479

1 file changed

Lines changed: 74 additions & 85 deletions

File tree

.github/workflows/pytest-core-mpi.yaml

Lines changed: 74 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ on:
1212
# but only for the main branch
1313
push:
1414
branches:
15-
- main
15+
- main
1616
pull_request:
1717
branches:
18-
- main
18+
- main
1919

2020
jobs:
2121
test-mpi-basic:
@@ -63,86 +63,75 @@ jobs:
6363
name: pytest-mpi
6464

6565
test-mpi-docker:
66-
name: pytest-mpi
67-
runs-on: ${{ matrix.os }}
68-
outputs:
69-
unique : ${{ steps.uniquetag.outputs.unique }}
70-
strategy:
71-
matrix:
72-
name: [gcc, gcc-arm, icx]
73-
include:
74-
- name: gcc
75-
arch: gcc
76-
os: ubuntu-latest
77-
mpiflag: ""
78-
79-
- name: gcc-arm
80-
arch: gcc
81-
os: ubuntu-24.04-arm
82-
mpiflag: ""
83-
84-
- name: icx
85-
arch: icx
86-
os: ubuntu-latest
87-
# Need safe math for icx due to inaccuracy with mpi+sinc interpolation
88-
mpiflag: "-e DEVITO_SAFE_MATH=1"
89-
90-
steps:
91-
- name: Checkout devito
92-
uses: actions/checkout@v6
93-
94-
- name: Generate unique CI tag
95-
id: uniquetag
96-
run: |
97-
UNIQUE=$(echo "${GITHUB_RUN_ID}_${GITHUB_RUN_ATTEMPT}" | cksum | cut -f 1 -d " ")
98-
echo "Unique ID: ${UNIQUE}"
99-
echo "unique=${UNIQUE}" >> "$GITHUB_OUTPUT"
100-
101-
- name: Build docker image
102-
env:
103-
UNIQUE: ${{ steps.uniquetag.outputs.unique }}
104-
run: |
105-
docker build \
106-
--file docker/Dockerfile.devito \
107-
--tag "devito_img${UNIQUE}" \
108-
--build-arg base=devitocodes/bases:cpu-${{ matrix.arch }} \
109-
.
110-
111-
- name: Test with pytest
112-
env:
113-
UNIQUE: ${{ steps.uniquetag.outputs.unique }}
114-
run: |
115-
docker run \
116-
--init -t --rm \
117-
--env CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} \
118-
--env OMP_NUM_THREADS=1 \
119-
--name testrun \
120-
"devito_img${UNIQUE}" \
121-
pytest tests/test_mpi.py
122-
123-
- name: Test examples with MPI
124-
env:
125-
UNIQUE: ${{ steps.uniquetag.outputs.unique }}
126-
run: |
127-
docker run \
128-
--init -t --rm \
129-
${{ matrix.mpiflag }} \
130-
--env DEVITO_MPI=1 \
131-
--env OMP_NUM_THREADS=1 \
132-
--name examplerun \
133-
"devito_img${UNIQUE}" \
134-
mpiexec -n 2 pytest examples/seismic/acoustic
135-
#
136-
docker run \
137-
--init -t --rm \
138-
--env DEVITO_MPI=1 \
139-
--env OMP_NUM_THREADS=1 \
140-
--name examplerun \
141-
"devito_img${UNIQUE}" \
142-
mpiexec -n 2 pytest examples/seismic/tti
143-
144-
- name: Cleanup
145-
env:
146-
UNIQUE: ${{ steps.uniquetag.outputs.unique }}
147-
run: |
148-
docker image rm -f "devito_img${UNIQUE}"
66+
name: pytest-mpi
67+
runs-on: ${{ matrix.os }}
68+
strategy:
69+
matrix:
70+
name: [gcc, gcc-arm, icx]
71+
include:
72+
- name: gcc
73+
arch: gcc
74+
os: ubuntu-latest
75+
mpiflag: ""
76+
77+
- name: gcc-arm
78+
arch: gcc
79+
os: ubuntu-24.04-arm
80+
mpiflag: ""
81+
82+
- name: icx
83+
arch: icx
84+
os: ubuntu-latest
85+
# Need safe math for icx due to inaccuracy with mpi+sinc interpolation
86+
mpiflag: "-e DEVITO_SAFE_MATH=1"
87+
88+
steps:
89+
- name: Checkout devito
90+
uses: actions/checkout@v6
91+
92+
- id: build
93+
name: Build docker image
94+
uses: ./.github/actions/docker-build
95+
with:
96+
file: docker/Dockerfile.devito
97+
tag: devito_img
98+
base: devitocodes/bases:cpu-${{ matrix.arch }}
99+
100+
- name: Test with pytest
101+
uses: ./.github/actions/docker-run
102+
with:
103+
id: ${{ steps.build.outputs.unique }}
104+
env: |
105+
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
106+
OMP_NUM_THREADS=1
107+
tag: devito_img
108+
command: "pytest tests/test_mpi.py"
109+
110+
- name: Test acoustic example with MPI
111+
uses: ./.github/actions/docker-run
112+
with:
113+
id: ${{ steps.build.outputs.unique }}
114+
args: ${{ matrix.mpiflag }}
115+
env: |
116+
DEVITO_MPI=1
117+
OMP_NUM_THREADS=1
118+
tag: devito_img
119+
command: "mpiexec -n 2 pytest examples/seismic/acoustic"
120+
121+
- name: Test tti example with MPI
122+
uses: ./.github/actions/docker-run
123+
with:
124+
# --name examplerun
125+
id: ${{ steps.build.outputs.unique }}
126+
args: ${{ matrix.mpiflag }}
127+
env: |
128+
DEVITO_MPI=1
129+
OMP_NUM_THREADS=1
130+
tag: devito_img
131+
command: "mpiexec -n 2 pytest examples/seismic/tti"
132+
133+
- name: Cleanup docker image
134+
uses: ./.github/actions/docker-clean
135+
with:
136+
id: ${{ steps.build.outputs.unique }}
137+
tag: devito_img

0 commit comments

Comments
 (0)