Skip to content

Commit 32736ca

Browse files
committed
make MPI optional through julia extension
1 parent b3fd08a commit 32736ca

File tree

11 files changed

+598
-523
lines changed

11 files changed

+598
-523
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ jobs:
2222
- ubuntu-latest
2323
arch:
2424
- x64
25+
26+
env:
27+
DEVITO_LANGUAGE: "openmp"
28+
DEVITO_ARCH: "gcc"
29+
OMP_NUM_THREADS: "2"
30+
DEVITO_AUTOPADDING: "0"
31+
RDMAV_FORK_SAFE: 1
32+
2533
steps:
2634
- uses: actions/checkout@v4
2735
- uses: julia-actions/setup-julia@v2
@@ -30,43 +38,48 @@ jobs:
3038
arch: ${{ matrix.arch }}
3139
- uses: julia-actions/cache@v1
3240

33-
- name: install mpi
34-
run: sudo apt-get update
35-
- run: sudo apt-get install -y mpich libmpich-dev
41+
- name: Setup MPI
42+
uses: mpi4py/setup-mpi@v1
43+
with:
44+
mpi: 'mpich'
3645

3746
- name: download miniconda manually
3847
run: wget https://repo.anaconda.com/miniconda/Miniconda3-py312_24.5.0-0-Linux-x86_64.sh
39-
48+
4049
- name: run install
4150
run: bash Miniconda3-py312_24.5.0-0-Linux-x86_64.sh -b -p $HOME/miniconda
42-
51+
4352
- name: run path export
4453
run: |
4554
echo "$HOME/miniconda/bin:" >> $GITHUB_PATH
4655
echo "PYTHON=$HOME/miniconda/bin/python3" >> $GITHUB_ENV
4756
echo "PYCALL_JL_RUNTIME_PYTHON=$HOME/miniconda/bin/python3" >> $GITHUB_ENV
4857
echo "CONDA_EXE=$HOME/miniconda/bin/conda" >> $GITHUB_ENV
4958
50-
- name: use system MPI
51-
run: julia -e 'using Pkg; Pkg.add(["MPI", "MPIPreferences"]); using MPIPreferences; MPIPreferences.use_system_binary()'
52-
5359
- name: run build for devito/devitopro
5460
if: matrix.devitoversion == 'devitopro'
5561
run: julia --color=yes --project -e 'using Pkg; Pkg.build(verbose=true)'
5662
env:
5763
DEVITO_PRO: ${{ secrets.DEVITOPRO }}
58-
64+
5965
- name: run build for devito
6066
if: ! matrix.devitoversion != 'devitopro'
6167
run: julia --color=yes --project -e 'using Pkg; Pkg.build(verbose=true)'
6268
env:
6369
DEVITO_BRANCH: ${{ matrix.devitoversion }}
64-
70+
71+
- name: use system MPI
72+
run: |
73+
# https://juliaparallel.org/MPI.jl/latest/configuration/#Configuration-of-the-MPI.jl-testsuite
74+
julia --project -e 'using Pkg; Pkg.add(["MPI", "MPIPreferences"]); using MPIPreferences; MPIPreferences.use_system_binary()'
75+
6576
# note Pkg.test docs indicate --inline=no can improve coverage
66-
- run: julia --color=yes --check-bounds=yes --inline=no --project -e 'using Pkg; Pkg.test(coverage=true)'
67-
77+
- name: run tests
78+
run: |
79+
julia --color=yes --check-bounds=yes --inline=no --project -e 'using Pkg; Pkg.test(coverage=true)'
80+
6881
- uses: julia-actions/julia-processcoverage@v1
69-
82+
7083
- uses: codecov/codecov-action@v1
7184
with:
7285
file: lcov.info
@@ -79,29 +92,29 @@ jobs:
7992
- uses: julia-actions/setup-julia@v2
8093
with:
8194
version: '1'
82-
95+
8396
- name: install mpi
8497
run: sudo apt-get update
8598
- run: sudo apt-get install -y mpich
86-
99+
87100
- name: download miniconda manually
88101
run: wget https://repo.anaconda.com/miniconda/Miniconda3-py312_24.5.0-0-Linux-x86_64.sh
89-
102+
90103
- name: run install
91104
run: bash Miniconda3-py312_24.5.0-0-Linux-x86_64.sh -b -p ~/miniconda
92-
105+
93106
- name: run path export
94107
run: |
95108
echo "$HOME/miniconda/bin:" >> $GITHUB_PATH
96109
echo "PYTHON=$HOME/miniconda/bin/python3" >> $GITHUB_ENV
97110
echo "PYCALL_JL_RUNTIME_PYTHON=$HOME/miniconda/bin/python3" >> $GITHUB_ENV
98111
echo "CONDA_EXE=$HOME/miniconda/bin/conda" >> $GITHUB_ENV
99112
100-
- run: julia --color=yes --project -e 'using Pkg; if VERSION >= v"1.1.0-rc1"; Pkg.build(verbose=true); else Pkg.build(); end'
113+
- run: julia --color=yes --project -e 'using Pkg; Pkg.build()'
101114

102115
- name: Install dependencies
103116
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
104-
117+
105118
- run: |
106119
julia --project=docs -e '
107120
using Pkg

Project.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,24 @@ version = "1.0.0"
55

66
[deps]
77
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
8+
MPIPreferences = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267"
89
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
910
Strided = "5e0ebb24-38b0-5f93-81fe-25c709ecae67"
1011

12+
[extensions]
13+
MPIDevitoExt = "MPI"
14+
1115
[compat]
12-
MPI = "0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20"
16+
MPI = "0.20.23"
17+
MPIPreferences = "0.1.11"
1318
PyCall = "1"
1419
Strided = "1"
1520
julia = "1.9"
21+
22+
[extras]
23+
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
24+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
25+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
26+
27+
[targets]
28+
test = ["Random", "Test", "MPI"]

0 commit comments

Comments
 (0)