Skip to content

Commit 56c37c8

Browse files
committed
Support for Open MPI
1 parent 9fc9988 commit 56c37c8

File tree

10 files changed

+368
-31
lines changed

10 files changed

+368
-31
lines changed

.codespellrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# https://github.com/codespell-project/codespell #-*- mode: conf -*-
2+
3+
[codespell]
4+
ignore-words-list = pevent

.github/workflows/cd-wheel.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ on: # yamllint disable-line rule:truthy
77
workflow_call:
88
inputs:
99
mpiname:
10-
description: 'MPI'
10+
description: 'MPI Name'
1111
default: 'mpich'
1212
required: false
1313
type: string
1414
version:
15-
description: 'Version'
15+
description: 'MPI Version'
1616
default: ''
1717
required: false
1818
type: string
@@ -39,6 +39,7 @@ on: # yamllint disable-line rule:truthy
3939
type: choice
4040
options:
4141
- mpich
42+
- openmpi
4243
version:
4344
description: 'Version'
4445
default: ''
@@ -122,6 +123,11 @@ jobs:
122123
- id: checkout
123124
uses: actions/checkout@v4
124125

126+
- id: setup-autotools
127+
if: ${{ runner.os == 'macOS' && runner.arch == 'ARM64' }}
128+
run: |
129+
brew install autoconf automake libtool
130+
125131
- id: setup-gfortran
126132
if: ${{ runner.os == 'macOS' }}
127133
run: |

.github/workflows/cd.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ on: # yamllint disable-line rule:truthy
77
workflow_dispatch:
88
inputs:
99
mpiname:
10-
description: 'MPI'
10+
description: 'MPI Name'
1111
default: 'mpich'
1212
type: choice
1313
options:
1414
- mpich
15+
- openmpi
1516
version:
16-
description: 'Version'
17+
description: 'MPI Version'
1718
default: ''
1819
required: false
1920
type: string

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
1-
# mpich-publish
1+
# mpi-publish
22

3-
This repository builds and publishes [MPICH](https://mpich.org)
4-
Python wheels able to run in a variety of
3+
This repository builds and publishes [MPICH](https://www.mpich.org) and
4+
[Open MPI](https://www.open-mpi.org/) Python wheels able to run in
5+
a variety of
56

67
- operating systems: *Linux*, *macOS*;
78
- processor architectures: *AMD64*, *ARM64*, *PPC64*;
89
- Python implementations: *CPython*, *PyPy*.
910

10-
MPICH wheels are uploaded to the [Anaconda.org](https://anaconda.org/mpi4py)
11+
MPI wheels are uploaded to the [Anaconda.org](https://anaconda.org/mpi4py)
1112
package server. These wheels can be installed with `pip` specifying the
1213
alternative index URL:
1314

1415
```sh
1516
python -m pip install mpich -i https://pypi.anaconda.org/mpi4py/simple
1617
```
1718

19+
```sh
20+
python -m pip install openmpi -i https://pypi.anaconda.org/mpi4py/simple
21+
```
22+
1823
> [!CAUTION]
19-
> MPICH wheels are distributed with a focus on ease of use, compatibility,
20-
> and interoperability. The Linux MPICH wheels are built in somewhat
21-
> constrained environments with relatively dated Linux distributions
24+
> MPI wheels are distributed with a focus on ease of use, compatibility, and
25+
> interoperability. The Linux wheels are built in somewhat constrained
26+
> environments with relatively dated Linux distributions
2227
> ([manylinux](https://github.com/pypa/manylinux) container images).
2328
> Therefore, they may lack support for high-performance features like
2429
> cross-memory attach (XPMEM/CMA). In production scenarios, it is recommended
25-
> to use external (either custom-built or system-provided) MPICH
26-
> installations.
30+
> to use external (either custom-built or system-provided) MPI installations.
2731
2832
> [!TIP]
2933
> [Intel MPI](https://software.intel.com/intel-mpi-library) distributes [Linux

bootstrap.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,24 @@ set -euo pipefail
33

44
mpiname=${MPINAME:-mpich}
55

6+
PROJECT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
7+
PACKAGE=$PROJECT/package
8+
SOURCE=$PACKAGE/source
9+
610
if test "$mpiname" = "mpich"; then
711
version=${VERSION:-4.2.0}
812
urlbase="https://www.mpich.org/static/downloads/$version"
913
tarball="$mpiname-$version.tar.gz"
1014
license=COPYRIGHT
1115
fi
1216

13-
SOURCE=package/source
17+
if test "$mpiname" = "openmpi"; then
18+
version=${VERSION:-5.0.2}
19+
urlbase=https://download.open-mpi.org/release/open-mpi/v${version%.*}
20+
tarball="$mpiname-$version.tar.gz"
21+
license=LICENSE
22+
fi
23+
1424
if test ! -d "$SOURCE"; then
1525
if test ! -f "$tarball"; then
1626
echo downloading "$urlbase"/"$tarball"...
@@ -21,6 +31,15 @@ if test ! -d "$SOURCE"; then
2131
echo extracting "$tarball" to "$SOURCE"...
2232
tar xf "$tarball"
2333
mv "$mpiname-$version" "$SOURCE"
34+
if test "$mpiname-$(uname)" = "openmpi-Darwin"; then
35+
if test -d "$SOURCE"/3rd-party; then
36+
cd "$SOURCE"/3rd-party
37+
tar xf libevent-*.tar.gz && cd libevent-*
38+
echo running autogen.sh on "$(basename "$(pwd)")"
39+
./autogen.sh
40+
cd "$PROJECT"
41+
fi
42+
fi
2443
else
2544
echo reusing directory "$SOURCE"...
2645
fi

check-wheel.sh

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ if test "$mpiname" = "mpich"; then
5656
"$data"/bin/mpic++
5757
"$data"/bin/mpicxx
5858
)
59+
wrappers=()
5960
programs=(
6061
"$data"/bin/mpichversion
6162
"$data"/bin/mpivars
@@ -74,7 +75,32 @@ if test "$mpiname" = "mpich"; then
7475
fi
7576
fi
7677

77-
check-dso() {
78+
if test "$mpiname" = "openmpi"; then
79+
headers=(
80+
"$data"/include/mpi.h
81+
)
82+
scripts=()
83+
wrappers=(
84+
"$data"/bin/mpicc
85+
"$data"/bin/mpic++
86+
"$data"/bin/mpicxx
87+
"$data"/bin/mpiCC
88+
"$data"/bin/mpirun
89+
"$data"/bin/mpiexec
90+
)
91+
programs=(
92+
"$data"/bin/*_info
93+
"$data"/bin/*_wrapper
94+
)
95+
libraries=(
96+
"$data"/lib/libmpi.*
97+
"$data"/lib/libopen-*.*
98+
)
99+
runlibs+='|lib(z|util|event.*|hwloc)'$soregex
100+
runlibs+='|lib(open-(pal|rte)|pmix|prrte)'$soregex
101+
fi
102+
103+
check-binary() {
78104
local dso=$1 out1="" out2=""
79105
echo checking "$dso"...
80106
test -f "$dso" || printf "ERROR: file not found\n"
@@ -85,25 +111,33 @@ check-dso() {
85111
test -z "$out1" -a -z "$out2"
86112
}
87113

88-
for header in "${headers[@]}"; do
114+
for header in "${headers[@]-}"; do
115+
test -n "$header" || break
89116
echo checking "$header"...
90117
test -f "$header"
91118
out=$(grep -E '^#include\s+"mpicxx\.h"' "$header" || true)
92119
test -z "$out" || printf "ERROR: include\n%s\n" "$out"
93120
test -z "$out"
94121
done
95-
for script in "${scripts[@]}"; do
122+
for script in "${scripts[@]-}"; do
123+
test -n "$script" || break
96124
echo checking "$script"...
97125
test -f "$script"
98126
out=$(grep -E "/opt/$mpiname" "$script" || true)
99127
test -z "$out" || printf "ERROR: prefix\n%s\n" "$out"
100128
test -z "$out"
101129
done
102-
for bin in "${programs[@]}"; do
103-
check-dso "$bin"
130+
for bin in "${wrappers[@]-}"; do
131+
test -n "$bin" || break
132+
check-binary "$bin"
133+
done
134+
for bin in "${programs[@]-}"; do
135+
test -n "$bin" || break
136+
check-binary "$bin"
104137
done
105-
for lib in "${libraries[@]}"; do
106-
check-dso "$lib"
138+
for lib in "${libraries[@]-}"; do
139+
test -n "$lib" || break
140+
check-binary "$lib"
107141
done
108142
if test "$(uname)" = Linux; then
109143
echo checking "$pkgname".libs...

0 commit comments

Comments
 (0)