@@ -11,13 +11,31 @@ WORKDIR=${WORKDIR:-$PACKAGE/workdir}
11
11
DESTDIR=${DESTDIR:- $PACKAGE / install}
12
12
PREFIX=${PREFIX:- " /opt/$mpiname " }
13
13
14
+ case $( uname) in
15
+ Linux) njobs=$( nproc) ;;
16
+ Darwin) njobs=$( sysctl -n hw.physicalcpu) ;;
17
+ esac
18
+
19
+ if test " $( uname) " = Darwin; then
20
+ export MACOSX_DEPLOYMENT_TARGET=" 11.0"
21
+ if test " $( uname -m) " = x86_64; then
22
+ export MACOSX_DEPLOYMENT_TARGET=" 10.9"
23
+ export ac_cv_func_aligned_alloc=" no" # macOS>=10.15
24
+ fi
25
+ fi
26
+
14
27
if test " $mpiname " = " mpich" ; then
15
28
version=$( sed -n ' s/MPICH_VERSION=\(.*\)/\1/p' " $SOURCE " /maint/Version)
29
+ case $( uname) -$( uname -m) in
30
+ Linux-x86_64) netmod=ofi,ucx ;;
31
+ Linux-aarch64) netmod=ofi,ucx ;;
32
+ * ) netmod=ofi ;;
33
+ esac
16
34
options=(
17
35
CC=cc
18
36
CXX=c++
19
37
--prefix=" $PREFIX "
20
- --with-device=ch4:" ${variant :- ofi} "
38
+ --with-device=" ch4:$netmod "
21
39
--with-pm=hydra:gforker
22
40
--with-libfabric=embedded
23
41
--with-ucx=embedded
@@ -40,11 +58,16 @@ if test "$mpiname" = "mpich"; then
40
58
export MPICH_MPICXX_LDFLAGS=" -Wl,-rpath,$PREFIX /lib"
41
59
export MPICH_MPIFORT_LDFLAGS=" -Wl,-rpath,$PREFIX /lib"
42
60
fi
43
- disable_doc=' s/^\(install-data-local:\s\+\)\$/\1#\$/'
44
- sed -i.orig " $disable_doc " " $SOURCE " /Makefile.in
61
+ generated_files+=(src/include/mpichinfo.h)
62
+ generated_files+=(src/pm/hydra/hydra_config.h)
63
+ file_prefix_map+=(" -ffile-prefix-map=$SOURCE =$mpiname -$version " )
64
+ file_prefix_map+=(" -ffile-prefix-map=$WORKDIR =$mpiname -$version " )
65
+ export MPICHLIB_CFLAGS=" ${file_prefix_map[*]} "
45
66
fi
46
67
47
68
if test " $mpiname " = " openmpi" ; then
69
+ # shellcheck disable=SC1091,SC2154
70
+ version=$( source " $SOURCE " /VERSION && echo " $major .$minor .$release " )
48
71
options=(
49
72
CC=cc
50
73
CXX=c++
@@ -67,27 +90,50 @@ if test "$mpiname" = "openmpi"; then
67
90
--enable-mpi-fortran=mpifh
68
91
--disable-dependency-tracking
69
92
)
93
+ generated_files+=(ompi/tools/ompi_info/Makefile)
94
+ generated_files+=(oshmem/tools/oshmem_info/Makefile)
95
+ generated_files+=(3rd-party/openpmix/src/tools/* /Makefile)
96
+ generated_files+=(3rd-party/prrte/src/tools/* /Makefile)
97
+ generated_files+=(opal/include/opal_config.h)
98
+ generated_files+=(3rd-party/openpmix/src/include/pmix_config.h)
99
+ generated_files+=(3rd-party/prrte/src/include/prte_config.h)
100
+ file_prefix_map+=(" -ffile-prefix-map=$SOURCE =$mpiname -$version " )
101
+ file_prefix_map+=(" -ffile-prefix-map=$WORKDIR =$mpiname -$version " )
102
+ export CFLAGS=" ${file_prefix_map[*]} "
70
103
fi
71
104
72
- if test " $( uname) " = Darwin; then
73
- export MACOSX_DEPLOYMENT_TARGET=" 11.0"
74
- if test " $( uname -m) " = x86_64; then
75
- export MACOSX_DEPLOYMENT_TARGET=" 10.9"
76
- export ac_cv_func_aligned_alloc=" no" # macOS>=10.15
77
- fi
78
- fi
79
-
80
- case $( uname) in
81
- Linux) njobs=$( nproc) ;;
82
- Darwin) njobs=$( sysctl -n hw.physicalcpu) ;;
83
- esac
84
-
85
- mkdir -p " $WORKDIR "
86
- cd " $WORKDIR "
105
+ mkdir -p " $WORKDIR " && cd " $WORKDIR "
87
106
88
107
echo running configure
89
108
" $SOURCE " /configure " ${options[@]} " || cat config.log
90
109
110
+ # shellcheck disable=SC2206
111
+ generated_files=(${generated_files[@]:- } )
112
+ for filename in " ${generated_files[@]} " ; do
113
+ test -n " $filename " || continue
114
+ test -f " $filename " || continue
115
+ cflags=" s|\s*${file_prefix_map[*]} \s*| |g"
116
+ source=" s|$SOURCE |$mpiname -$version |g"
117
+ workdir=" s|$WORKDIR |$mpiname -$version |g"
118
+ if test " $( basename " $filename " ) " = " Makefile" ; then
119
+ echo removing CFLAGS from " $filename "
120
+ sed -i.orig " /-D.*_BUILD_CFLAGS=/$cflags " " $filename "
121
+ echo replacing SOURCE in " $filename "
122
+ sed -i.orig " /-D.*_BUILD_CPPFLAGS=/$source " " $filename "
123
+ sed -i.orig " /-D.*_BUILD_LIBS=/$source " " $filename "
124
+ echo replacing WORKDIR in " $filename "
125
+ sed -i.orig " /-D.*_BUILD_CPPFLAGS=/$workdir " " $filename "
126
+ sed -i.orig " /-D.*_BUILD_LIBS=/$workdir " " $filename "
127
+ else
128
+ echo removing CFLAGS from " $filename "
129
+ sed -i.orig " $cflags " " $filename "
130
+ echo replacing SOURCE in " $filename "
131
+ sed -i.orig " $source " " $filename "
132
+ echo replacing WORKDIR in " $filename "
133
+ sed -i.orig " $workdir " " $filename "
134
+ fi
135
+ done
136
+
91
137
echo running make with " ${njobs:- 1} " jobs
92
138
make -j " ${njobs:- 1} " install DESTDIR=" $DESTDIR "
93
139
@@ -97,7 +143,6 @@ cd "${DESTDIR}${PREFIX}"
97
143
rm -f include/* cxx.h
98
144
rm -f include/* .mod
99
145
rm -f include/* f.h
100
- rm -fr include/rdma
101
146
rm -f bin/mpif77
102
147
rm -f bin/mpif90
103
148
rm -f bin/mpifort
@@ -112,6 +157,12 @@ rm -f lib/lib*mpifort.*
112
157
rm -fr lib/pkgconfig
113
158
rm -fr share
114
159
160
+ cd " ${DESTDIR}${PREFIX} "
161
+ rm -fr include/rdma
162
+ rm -f bin/fi_*
163
+ rm -f lib/libfabric.a
164
+ rm -f lib/libfabric.la
165
+
115
166
cd " ${DESTDIR}${PREFIX} "
116
167
rm -f bin/io_demo
117
168
rm -f bin/ucx_read_profile
@@ -134,6 +185,7 @@ for script in "${scripts[@]}"; do
134
185
test ! -L " $script " || continue
135
186
# shellcheck disable=SC2016
136
187
topdir=' $(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE:-$0}")/.." \&\& pwd)'
188
+ sed -i.orig s:" \s$WORKDIR /.*/lib\(.*\)\.la" :" -l\1" :g " $script "
137
189
sed -i.orig s@^prefix=.* @prefix=" $topdir " @ " $script "
138
190
sed -i.orig s:" $PREFIX " :\"\$\{ prefix\}\" :g " $script "
139
191
sed -i.orig s:-Wl,-commons,use_dylibs::g " $script "
@@ -153,6 +205,19 @@ if test "$(uname)" = Linux; then
153
205
mv " $( readlink " $libmpi " ) " " $libmpi "
154
206
ln -sf " $libmpi " " ${libmpi% .* } "
155
207
fi
208
+ if test -f libfabric.so; then
209
+ patchelf --set-rpath " \$ ORIGIN" " $libmpi "
210
+ for lib in libfabric.so.? ; do
211
+ if test -f " $lib " .* .* ; then
212
+ mv " $( readlink " $lib " ) " " $lib "
213
+ ln -sf " $lib " " ${lib% .* } "
214
+ fi
215
+ patchelf --set-rpath " \$ ORIGIN" " $lib "
216
+ for exe in " ${executables[@]} " ; do
217
+ patchelf --remove-needed " $lib " " ../bin/$exe "
218
+ done
219
+ done
220
+ fi
156
221
if test -f libucp.so; then
157
222
patchelf --set-rpath " \$ ORIGIN" " $libmpi "
158
223
for lib in libuc[mpst]* .so.? ; do
@@ -182,16 +247,31 @@ if test "$(uname)" = Darwin; then
182
247
libpmpi=" libpmpi.12.dylib"
183
248
cd " ${DESTDIR}${PREFIX} /bin"
184
249
for exe in " ${executables[@]} " ; do
185
- install_name_tool -change " $libdir /$libmpi " " @rpath/$libmpi " " $exe "
186
- install_name_tool -change " $libdir /$libpmpi " " @rpath/$libpmpi " " $exe "
187
250
install_name_tool -add_rpath " @executable_path/../lib/" " $exe "
251
+ for lib in " $libmpi " " $libpmpi " ; do
252
+ install_name_tool -change " $libdir /$lib " " @rpath/$lib " " $exe "
253
+ done
188
254
done
189
255
cd " ${DESTDIR}${PREFIX} /lib"
190
256
for lib in " $libmpi " " $libpmpi " ; do
191
257
install_name_tool -id " @rpath/$lib " " $lib "
192
258
install_name_tool -add_rpath " @loader_path/" " $lib "
193
259
done
194
260
install_name_tool -change " $libdir /$libpmpi " " @rpath/$libpmpi " " $libmpi "
261
+ libfabric=" libfabric.1.dylib"
262
+ if test -f " $libfabric " ; then
263
+ install_name_tool -id " @rpath/$libfabric " " $libfabric "
264
+ install_name_tool -add_rpath " @loader_path/" " $libfabric "
265
+ oldname=" $libdir /$libfabric " ; newname=" @rpath/$libfabric " ;
266
+ cd " ${DESTDIR}${PREFIX} /bin"
267
+ for exe in " ${executables[@]} " ; do
268
+ install_name_tool -change " $oldname " " $newname " " $exe "
269
+ done
270
+ cd " ${DESTDIR}${PREFIX} /lib"
271
+ for lib in " $libmpi " " $libpmpi " ; do
272
+ install_name_tool -change " $oldname " " $newname " " $lib "
273
+ done
274
+ fi
195
275
fi
196
276
197
277
} # fixup-mpich()
@@ -365,3 +445,10 @@ done
365
445
366
446
echo fixing install tree
367
447
fixup-" $mpiname "
448
+
449
+ echo checking install tree
450
+ cd " ${DESTDIR}${PREFIX} "
451
+ echo cheking files with SOURCE
452
+ ! grep -lr " $SOURCE "
453
+ echo cheking files with WORKDIR
454
+ ! grep -lr " $WORKDIR "
0 commit comments