Skip to content

Commit 2cb84c5

Browse files
committed
Various enhancements
* MPICH: Configure --with-device=ch4:ofi,ucx * Remove references to source/build directories * Strip binaries to reduce size
1 parent eaf7bc2 commit 2cb84c5

File tree

7 files changed

+327
-35
lines changed

7 files changed

+327
-35
lines changed

.github/workflows/cd-wheel.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ jobs:
117117
cd $(brew --prefix)/bin
118118
gfortran=$(ls gfortran-* | sort | head -n 1)
119119
sudo ln -s $gfortran gfortran
120+
# unlink libevent
121+
brew unlink libevent || true
120122
# install autotools
121123
brew install autoconf
122124
brew install automake
123125
brew install libtool
124-
# unlink libevent
125-
brew unlink libevent || true
126126
# install uv
127127
brew install uv
128128
@@ -174,7 +174,7 @@ jobs:
174174
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
175175
delocate-wheel
176176
--ignore-missing-dependencies
177-
--exclude libmpi --exclude libpmpi
177+
--exclude libmpi --exclude libpmpi --exclude libfabric
178178
--require-archs {delocate_archs}
179179
-w {dest_dir} -v {wheel}
180180

bootstrap.sh

+29
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,35 @@ if test ! -d "$SOURCE"; then
3838
if test -f "$patch"; then
3939
patch -p1 -i "$patch" -d "$SOURCE"
4040
fi
41+
if test "$mpiname" = "mpich"; then
42+
if test "${version}" \> "4.2.2"; then
43+
conf_args='s/\(ofi_subdir_args\)=\("--enable-embedded"\)/\1=""/'
44+
configure="$SOURCE"/configure
45+
sed -i.orig "$conf_args" "$configure"
46+
fi
47+
if test "${version}" \< "4.2.0"; then
48+
disable_doc='s/^\(install-data-local:\s\+\)\$/\1#\$/'
49+
Makefile="$SOURCE"/Makefile.in
50+
sed -i.orig "$disable_doc" "$Makefile"
51+
fi
52+
fi
53+
if test "$mpiname" = "openmpi"; then
54+
makefiles=(
55+
"$SOURCE"/3rd-party/openpmix/src/util/keyval/Makefile.in
56+
"$SOURCE"/3rd-party/prrte/src/mca/rmaps/rank_file/Makefile.in
57+
"$SOURCE"/3rd-party/prrte/src/util/hostfile/Makefile.in
58+
)
59+
variables=(
60+
PRTE_CFLAGS_BEFORE_PICKY
61+
PMIX_CFLAGS_BEFORE_PICKY
62+
)
63+
for makefile in "${makefiles[@]}"; do
64+
test -f "$makefile" || continue
65+
for variable in "${variables[@]}"; do
66+
echo "$variable = @CFLAGS@" >> "$makefile"
67+
done
68+
done
69+
fi
4170
if test "$mpiname-$(uname)" = "openmpi-Darwin"; then
4271
if test -d "$SOURCE"/3rd-party; then
4372
cd "$SOURCE"/3rd-party

build-wheel.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ export CIBW_ARCHS=$ARCHLIST
1313
export CIBW_BEFORE_ALL='bash {project}/cibw-build-mpi.sh'
1414
export CIBW_TEST_COMMAND='bash {project}/cibw-check-mpi.sh'
1515
export CIBW_ENVIRONMENT_PASS='MPINAME RELEASE SOURCE WORKDIR DESTDIR'
16-
export CIBW_REPAIR_WHEEL_COMMAND_MACOS='delocate-wheel --ignore-missing-dependencies --exclude libmpi --exclude libpmpi --require-archs {delocate_archs -w {dest_dir} -v {wheel}'
16+
export CIBW_REPAIR_WHEEL_COMMAND_MACOS='delocate-wheel --ignore-missing-dependencies --exclude libmpi --exclude libpmpi --exclude libfabric --require-archs {delocate_archs -w {dest_dir} -v {wheel}'
1717

1818
if test "$(uname)" = Linux; then
1919
containerengine=$(basename "$(command -v podman || command -v docker)")
2020
export CIBW_CONTAINER_ENGINE=$containerengine
2121
export SOURCE="/project/$SOURCE"
22-
export WORKDIR="/host/$PWD/$WORKDIR"
23-
export DESTDIR="/host/$PWD/$DESTDIR"
22+
export WORKDIR="/host$PWD/$WORKDIR"
23+
export DESTDIR="/host$PWD/$DESTDIR"
2424
platform=linux
2525
fi
2626
if test "$(uname)" = Darwin; then

check-wheel.sh

+26-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ unzip -qq "$wheelfile" -d "$workdir"
1616
cd "$workdir"
1717

1818
whlname=$(basename "$wheelfile")
19-
pkgname=${whlname%%-*}
19+
whlinfo=${whlname%%-py*}
20+
pkgname=${whlinfo%%-*}
21+
version=${whlinfo##*-}
2022
mpiname=${pkgname}
2123

2224
data=$(ls -d "$pkgname"-*.data/data)
@@ -29,6 +31,9 @@ if test "$(uname)" = Linux; then
2931
libsdir=.libs
3032
print-runpath() { patchelf --print-rpath "$1"; }
3133
print-needed() { patchelf --print-needed "$1"; }
34+
if test -f "$data"/lib/libfabric.so; then
35+
runlibs=$runlibs'|libfabric'$soregex
36+
fi
3237
if test -f "$data"/lib/libucp.so; then
3338
runlibs=$runlibs'|libuc(m|p|s|t)'$soregex
3439
fi
@@ -41,6 +46,9 @@ if test "$(uname)" = Darwin; then
4146
libsdir=.dylibs
4247
print-runpath() { otool -l "$1" | sed -n '/RPATH/{n;n;p;}'; }
4348
print-needed() { otool -L "$1" | sed 1,1d; }
49+
if test -f "$data"/lib/libfabric.dylib; then
50+
runlibs=$runlibs'|libfabric'$soregex
51+
fi
4452
if test -f "$data"/lib/libucp.dylib; then
4553
runlibs=$runlibs'|libuc(m|p|s|t)'$soregex
4654
fi
@@ -67,7 +75,12 @@ if test "$mpiname" = "mpich"; then
6775
libraries=(
6876
"$data"/lib/libmpi.*
6977
)
70-
if test -d "$data"/lib/ucx; then
78+
if ls "$data"/lib/libfabric.* > /dev/null 2>&1; then
79+
libraries+=(
80+
"$data"/lib/libfabric.*
81+
)
82+
fi
83+
if ls "$data"/lib/libuct.* > /dev/null 2>&1; then
7184
libraries+=(
7285
"$data"/lib/libuc[mpst]*.*
7386
"$data"/lib/ucx/libuc*.*
@@ -96,14 +109,22 @@ if test "$mpiname" = "openmpi"; then
96109
"$data"/lib/libmpi.*
97110
"$data"/lib/libopen-*.*
98111
)
112+
if test "${version%%.*}" -ge 5; then
113+
libraries+=(
114+
"$data"/lib/libevent*.*
115+
"$data"/lib/libhwloc.*
116+
"$data"/lib/libpmix.*
117+
"$data"/lib/libprrte.*
118+
)
119+
fi
99120
runlibs+='|lib(z|util|event.*|hwloc)'$soregex
100121
runlibs+='|lib(open-(pal|rte)|pmix|prrte)'$soregex
101122
fi
102123

103124
check-binary() {
104125
local dso=$1 out1="" out2=""
105126
echo checking "$dso"...
106-
test -f "$dso" || printf "ERROR: file not found\n"
127+
test -f "$dso" || (printf "ERROR: file not found\n"; exit 1)
107128
out1="$(print-runpath "$dso" | grep -vE "$runpath" || true)"
108129
test -z "$out1" || printf "ERROR: RUNPATH\n%s\n" "$out1"
109130
out2="$(print-needed "$dso" | grep -vE "$runlibs" || true)"
@@ -114,15 +135,15 @@ check-binary() {
114135
for header in "${headers[@]-}"; do
115136
test -n "$header" || break
116137
echo checking "$header"...
117-
test -f "$header"
138+
test -f "$header" || (printf "ERROR: file not found\n"; exit 1)
118139
out=$(grep -E '^#include\s+"mpicxx\.h"' "$header" || true)
119140
test -z "$out" || printf "ERROR: include\n%s\n" "$out"
120141
test -z "$out"
121142
done
122143
for script in "${scripts[@]-}"; do
123144
test -n "$script" || break
124145
echo checking "$script"...
125-
test -f "$script"
146+
test -f "$script" || (printf "ERROR: file not found\n"; exit 1)
126147
out=$(grep -E "/opt/$mpiname" "$script" || true)
127148
test -z "$out" || printf "ERROR: prefix\n%s\n" "$out"
128149
test -z "$out"

0 commit comments

Comments
 (0)