-
Notifications
You must be signed in to change notification settings - Fork 256
144 lines (125 loc) · 3.36 KB
/
pytest-core-mpi.yaml
File metadata and controls
144 lines (125 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: CI-mpi
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
# Trigger the workflow on push or pull request, but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test-mpi-basic:
name: pytest-mpi
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.10', '3.11']
env:
DEVITO_LANGUAGE: "openmp"
DEVITO_ARCH: "gcc"
OMP_NUM_THREADS: "1"
RDMAV_FORK_SAFE: 1
steps:
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Checkout devito
uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo apt-get update && sudo apt install mpich -y
pip3 install --upgrade pip
pip3 install -e ".[extras,mpi,tests]" --no-binary=mpi4py
- name: Test with pytest
run: |
python3 scripts/clear_devito_cache.py
python3 -m pytest \
-v \
--cov \
--cov-config=.coveragerc \
--cov-report=xml \
-m parallel \
tests/
- name: Test examples with MPI
run: |
python3 scripts/clear_devito_cache.py
DEVITO_MPI=1 mpirun -n 2 \
python3 -m pytest \
-v \
examples/seismic/acoustic \
examples/seismic/tti
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: pytest-mpi
test-mpi-docker:
name: pytest-mpi
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [
pytest-mpi-docker-gcc,
pytest-mpi-docker-gcc-arm,
pytest-mpi-docker-icx
]
include:
- name: pytest-mpi-docker-gcc
arch: gcc
os: ubuntu-latest
- name: pytest-mpi-docker-gcc-arm
arch: gcc
os: ubuntu-24.04-arm
- name: pytest-mpi-docker-icx
arch: icx
os: ubuntu-latest
steps:
- name: Checkout devito
uses: actions/checkout@v6
- id: build
name: Build docker image
uses: ./.github/actions/docker-build
with:
file: docker/Dockerfile.devito
tag: ${{ matrix.name }}
base: devitocodes/bases:cpu-${{ matrix.arch }}
- name: Test with pytest
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}
OMP_NUM_THREADS=1
command: |
pytest \
-v \
--cov \
--cov-config=.coveragerc \
--cov-report=xml \
tests/test_mpi.py
- name: Test acoustic and TTI examples with MPI
uses: ./.github/actions/docker-run
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}
env: |
DEVITO_MPI=1
OMP_NUM_THREADS=1
command: |
mpiexec -n 2 \
pytest \
-v \
examples/seismic/acoustic \
examples/seismic/tti
- name: Cleanup docker image
if: always()
uses: ./.github/actions/docker-clean
with:
uid: ${{ steps.build.outputs.unique }}
tag: ${{ matrix.name }}