Skip to content

Commit 621e433

Browse files
committed
mpich: Support for multiple versions
1 parent 9ddf5c3 commit 621e433

File tree

6 files changed

+57
-33
lines changed

6 files changed

+57
-33
lines changed

.github/workflows/cd-wheel.yml

+14-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ permissions:
66
on: # yamllint disable-line rule:truthy
77
workflow_call:
88
inputs:
9+
mpiname:
10+
description: 'MPI'
11+
default: 'mpich'
12+
required: false
13+
type: string
914
variant:
1015
description: 'Variant'
1116
default: ''
1217
required: false
1318
type: string
1419
version:
1520
description: 'Version'
16-
default: '4.1.2'
21+
default: ''
1722
required: false
1823
type: string
1924
release:
@@ -28,6 +33,12 @@ on: # yamllint disable-line rule:truthy
2833
type: string
2934
workflow_dispatch:
3035
inputs:
36+
mpiname:
37+
description: 'MPI'
38+
default: 'mpich'
39+
type: choice
40+
options:
41+
- mpich
3142
variant:
3243
description: 'Variant'
3344
default: ''
@@ -38,7 +49,7 @@ on: # yamllint disable-line rule:truthy
3849
- ucx
3950
version:
4051
description: 'Version'
41-
default: '4.1.2'
52+
default: ''
4253
required: false
4354
type: string
4455
release:
@@ -62,7 +73,7 @@ on: # yamllint disable-line rule:truthy
6273
- macOS-x86_64
6374

6475
env:
65-
MPINAME: 'mpich'
76+
MPINAME: '${{ inputs.mpiname }}'
6677
VARIANT: '${{ inputs.variant }}'
6778
VERSION: '${{ inputs.version }}'
6879
RELEASE: '${{ inputs.release }}'

.github/workflows/cd.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ permissions:
66
on: # yamllint disable-line rule:truthy
77
workflow_dispatch:
88
inputs:
9+
mpiname:
10+
description: 'MPI'
11+
default: 'mpich'
12+
type: choice
13+
options:
14+
- mpich
915
variant:
1016
description: 'Variant'
1117
default: ''
@@ -16,7 +22,7 @@ on: # yamllint disable-line rule:truthy
1622
- ucx
1723
version:
1824
description: 'Version'
19-
default: '4.1.2'
25+
default: ''
2026
required: false
2127
type: string
2228
release:
@@ -48,6 +54,7 @@ jobs:
4854
wheel:
4955
uses: ./.github/workflows/cd-wheel.yml
5056
with:
57+
mpiname: ${{ inputs.mpiname }}
5158
variant: ${{ inputs.variant }}
5259
version: ${{ inputs.version }}
5360
release: ${{ inputs.release }}
@@ -59,7 +66,7 @@ jobs:
5966
runs-on: ubuntu-latest
6067
environment:
6168
name: anaconda
62-
url: https://anaconda.org/mpi4py/mpich
69+
url: https://anaconda.org/mpi4py/${{ inputs.mpiname }}
6370

6471
steps:
6572

bootstrap.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44
mpiname=${MPINAME:-mpich}
55

66
if test "$mpiname" = "mpich"; then
7-
version=${VERSION:-4.1.2}
7+
version=${VERSION:-4.2.0}
88
urlbase="https://www.mpich.org/static/downloads/$version"
99
tarball="$mpiname-$version.tar.gz"
1010
license=COPYRIGHT
@@ -14,7 +14,7 @@ SOURCE=package/source
1414
if test ! -d "$SOURCE"; then
1515
if test ! -f "$tarball"; then
1616
echo downloading "$urlbase"/"$tarball"...
17-
curl -sO "$urlbase"/"$tarball"
17+
curl -fsO "$urlbase"/"$tarball"
1818
else
1919
echo reusing "$tarball"...
2020
fi

check-wheel.sh

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ if test "$(uname)" = Darwin; then
3838
runpath='@executable_path/../lib/|@loader_path/'
3939
soregex='\..*\.dylib'
4040
runlibs='lib(mpi|pmpi|System)'$soregex
41+
runlibs=$runlibs'|(Foundation|IOKit)\.framework'
4142
print-runpath() { otool -l "$1" | sed -n '/RPATH/{n;n;p;}'; }
4243
print-needed() { otool -L "$1" | sed 1,1d; }
4344
if test -f "$data"/lib/libucp.dylib; then

cibw-build-mpi.sh

+29-24
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ DESTDIR=${DESTDIR:-$PWD/package/install}
1010
PREFIX=${PREFIX:-"/opt/$mpiname"}
1111

1212
if test "$mpiname" = "mpich"; then
13+
version=$(sed -n 's/MPICH_VERSION=\(.*\)/\1/p' "$SOURCE"/maint/Version)
1314
options=(
1415
CC=cc
1516
CXX=c++
@@ -24,7 +25,13 @@ if test "$mpiname" = "mpich"; then
2425
--disable-static
2526
--disable-doc
2627
)
28+
if test "${version%%.*}" -lt 4; then
29+
options=("${options[@]/--disable-cxx}")
30+
export FCFLAGS=-fallow-argument-mismatch
31+
export FFLAGS=-fallow-argument-mismatch
32+
fi
2733
if test "$(uname)" = Darwin; then
34+
options+=(--disable-opencl --disable-libxml2)
2835
export MPICH_MPICC_LDFLAGS="-Wl,-rpath,$PREFIX/lib"
2936
export MPICH_MPICXX_LDFLAGS="-Wl,-rpath,$PREFIX/lib"
3037
export MPICH_MPIFORT_LDFLAGS="-Wl,-rpath,$PREFIX/lib"
@@ -65,6 +72,7 @@ cd "${DESTDIR}${PREFIX}"
6572
rm -f include/*cxx.h
6673
rm -f include/*.mod
6774
rm -f include/*f.h
75+
rm -fr include/rdma
6876
rm -f bin/mpif77
6977
rm -f bin/mpif90
7078
rm -f bin/mpifort
@@ -86,22 +94,33 @@ rm -f lib/libuc[mpst]*.la
8694
rm -f lib/ucx/libuct_*.la
8795
rm -fr lib/cmake
8896

97+
headers=(mpi.h)
98+
scripts=(mpicc mpicxx)
99+
executables=(mpichversion mpivars)
100+
101+
cd "${DESTDIR}${PREFIX}/include"
102+
for header in "${headers[@]}"; do
103+
sed -i.orig 's:^#include "mpicxx.h"::g' "$header"
104+
rm "$header".orig
105+
done
106+
89107
cd "${DESTDIR}${PREFIX}/bin"
90-
for script in mpicc mpicxx; do
108+
for script in "${scripts[@]}"; do
91109
# shellcheck disable=SC2016
92110
topdir='$(CDPATH= cd -- "$(dirname -- "$0")/.." \&\& pwd -P)'
93-
sed -i.orig s:^prefix=.*:prefix="$topdir": $script
94-
sed -i.orig s:"$PREFIX":\"\$\{prefix\}\":g $script
95-
sed -i.orig s:-Wl,-commons,use_dylibs::g $script
96-
sed -i.orig s:/usr/bin/bash:/bin/bash:g $script
97-
rm $script.orig
111+
sed -i.orig s:^prefix=.*:prefix="$topdir": "$script"
112+
sed -i.orig s:"$PREFIX":\"\$\{prefix\}\":g "$script"
113+
sed -i.orig s:-Wl,-commons,use_dylibs::g "$script"
114+
sed -i.orig s:/usr/bin/bash:/bin/bash:g "$script"
115+
sed -i.orig s:-lmpicxx::g "$script"
116+
rm "$script".orig
98117
done
99118

100119
if test "$(uname)" = Linux; then
101120
libmpi="libmpi.so.12"
102121
cd "${DESTDIR}${PREFIX}/bin"
103-
for exe in mpichversion mpivars; do
104-
patchelf --set-rpath "\$ORIGIN/../lib" $exe
122+
for exe in "${executables[@]}"; do
123+
patchelf --set-rpath "\$ORIGIN/../lib" "$exe"
105124
done
106125
cd "${DESTDIR}${PREFIX}/lib"
107126
if test -f "$libmpi".*.*; then
@@ -116,7 +135,7 @@ if test "$(uname)" = Linux; then
116135
ln -sf "$lib" "${lib%.*}"
117136
fi
118137
patchelf --set-rpath "\$ORIGIN" "$lib"
119-
for exe in mpichversion mpivars; do
138+
for exe in "${executables[@]}"; do
120139
patchelf --remove-needed "$lib" "../bin/$exe"
121140
done
122141
done
@@ -136,7 +155,7 @@ if test "$(uname)" = Darwin; then
136155
libmpi="libmpi.12.dylib"
137156
libpmpi="libpmpi.12.dylib"
138157
cd "${DESTDIR}${PREFIX}/bin"
139-
for exe in mpichversion mpivars; do
158+
for exe in "${executables[@]}"; do
140159
install_name_tool -change "$libdir/$libmpi" "@rpath/$libmpi" "$exe"
141160
install_name_tool -change "$libdir/$libpmpi" "@rpath/$libpmpi" "$exe"
142161
install_name_tool -add_rpath "@executable_path/../lib/" "$exe"
@@ -147,20 +166,6 @@ if test "$(uname)" = Darwin; then
147166
install_name_tool -add_rpath "@loader_path/" "$lib"
148167
done
149168
install_name_tool -change "$libdir/$libpmpi" "@rpath/$libpmpi" "$libmpi"
150-
if test -f libucp.dylib; then # TODO: UCX is not supported on macOS
151-
for lib in libuc[mpst]*.?.dylib; do
152-
install_name_tool -id "@rpath/$lib" "$lib"
153-
install_name_tool -add_rpath "@loader_path/" "$lib"
154-
for dep in libuc[mst].?.dylib; do
155-
install_name_tool -change "$libdir/$dep" "@rpath/$dep" "$lib"
156-
done
157-
done
158-
for exe in mpichversion mpivars; do
159-
for dep in libuc[mpst].?.dylib; do
160-
install_name_tool -change "$libdir/$dep" "/" "../bin/$exe"
161-
done
162-
done
163-
fi
164169
fi
165170

166171
} # fixup-mpich()

cibw-check-mpi.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ ln -s helloworld.c helloworld.cxx
2929

3030
RUN() { echo + "$@"; "$@"; }
3131

32-
if test "$mpiname" == "mpich"; then
32+
if test "$mpiname" = "mpich"; then
3333
RUN command -v mpichversion
3434
RUN mpichversion
3535
fi
3636

37-
if test "$mpiname" == "mpich"; then
37+
if test "$mpiname" = "mpich"; then
3838
RUN command -v mpivars
3939
RUN mpivars -nodesc | grep 'Category .* has'
4040
fi

0 commit comments

Comments
 (0)