-
Notifications
You must be signed in to change notification settings - Fork 229
95 lines (80 loc) · 2.72 KB
/
pytest-core-mpi.yml
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
name: CI-mpi
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
# Trigger the workflow on push or pull request,
# but only for the master branch
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test-mpi-basic:
name: pytest-mpi
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.9', '3.11']
env:
DEVITO_LANGUAGE: "openmp"
DEVITO_ARCH: "gcc-9"
OMP_NUM_THREADS: "1"
CC: "gcc-9"
CXX: "g++-9"
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Checkout devito
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update && sudo apt install mpich -y
pip3 install --upgrade pip
pip3 install -e .[extras,mpi,tests]
- name: Test with pytest
run: |
python3 scripts/clear_devito_cache.py
python3 -m pytest --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 examples/seismic/acoustic
DEVITO_MPI=1 mpirun -n 2 python3 -m pytest examples/seismic/tti
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: pytest-mpi
test-mpi-docker:
name: pytest-mpi
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [gcc, icx]
include:
- name: gcc
arch: gcc
os: ubuntu-latest
mpiflag: ""
- name: icx
arch: icx
os: ubuntu-latest
# Need safe math for icx due to inaccuracy with mpi+sinc interpolation
mpiflag: "-e DEVITO_SAFE_MATH=1"
steps:
- name: Checkout devito
uses: actions/checkout@v4
- name: Build docker image
run: |
docker build . --file docker/Dockerfile.devito --tag devito_img --build-arg base=devitocodes/bases:cpu-${{ matrix.arch }}
- name: Test with pytest
run: |
docker run --rm -t -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} -e OMP_NUM_THREADS=1 --name testrun devito_img pytest tests/test_mpi.py
- name: Test examples with MPI
run: |
docker run --rm -t ${{ matrix.mpiflag }} -e DEVITO_MPI=1 -e OMP_NUM_THREADS=1 --name examplerun devito_img mpiexec -n 2 pytest examples/seismic/acoustic
docker run --rm -t -e DEVITO_MPI=1 -e OMP_NUM_THREADS=1 --name examplerun devito_img mpiexec -n 2 pytest examples/seismic/tti