-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
build.sh
executable file
·168 lines (147 loc) · 6.15 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/bash
set -ex
export LIBRARY_PATH="${PREFIX}/lib"
# Get an updated config.sub and config.guess
cp $BUILD_PREFIX/share/libtool/build-aux/config.* ./bin
# hdf5 autogen.sh doesn't find libtool on mac correctly
export HDF5_LIBTOOL=$BUILD_PREFIX/bin/libtool
HDF5_OPTIONS=
if [[ "$target_platform" == linux-* ]]; then
# Direct Virtual File System (O_DIRECT)
# is only valid for linux
HDF5_OPTIONS="${HDF5_OPTIONS} --enable-direct-vfd"
fi
if [[ ! -z "$mpi" && "$mpi" != "nompi" ]]; then
export HDF5_OPTIONS="${HDF5_OPTIONS} --enable-parallel"
export CC=$PREFIX/bin/mpicc
export CXX=$PREFIX/bin/mpic++
export FC=$PREFIX/bin/mpifort
if [[ "$CONDA_BUILD_CROSS_COMPILATION" == "1" ]]; then
export CC_FOR_BUILD=$BUILD_PREFIX/bin/mpicc
export CXX_FOR_BUILD=$BUILD_PREFIX/bin/mpic++
export FC_FOR_BUILD=$BUILD_PREFIX/bin/mpifort
if [[ "$mpi" == "openmpi" ]]; then
# openmpi compilers are binaries, so always need to use build prefix
# linking is governed by environment variables
# openmpi env enables cross-compile by default in conda-build
export CC=$CC_FOR_BUILD
export CXX=$CXX_FOR_BUILD
export FC=$FC_FOR_BUILD
fi
else
export CC_FOR_BUILD=$PREFIX/bin/mpicc
export CXX_FOR_BUILD=$PREFIX/bin/mpic++
export FC_FOR_BUILD=$PREFIX/bin/mpifort
fi
if [[ "$target_platform" == linux-* ]]; then
# --as-needed appears to cause problems with fortran compiler detection
# due to missing libquadmath
# unclear why required libs are stripped but still linked
export FFLAGS="${FFLAGS:-} -Wl,--no-as-needed -Wl,--disable-new-dtags"
export LDFLAGS="${LDFLAGS} -Wl,--no-as-needed -Wl,--disable-new-dtags"
fi
else
export CC=$(basename ${CC})
export CXX=$(basename ${CXX})
export F95=$(basename ${F95})
export FC=$(basename ${FC})
fi
if [[ "$CONDA_BUILD_CROSS_COMPILATION" == 1 && $target_platform == "osx-arm64" ]]; then
export ac_cv_sizeof_long_double=8
export hdf5_cv_ldouble_to_long_special=no
export hdf5_cv_long_to_ldouble_special=no
export hdf5_cv_ldouble_to_llong_accurate=yes
export hdf5_cv_llong_to_ldouble_correct=yes
export hdf5_cv_disable_some_ldouble_conv=no
export hdf5_cv_system_scope_threads=yes
export hdf5_cv_printf_ll="l"
export PAC_FC_MAX_REAL_PRECISION=15
export PAC_C_MAX_REAL_PRECISION=17
export PAC_FC_ALL_INTEGER_KINDS="{1,2,4,8,16}"
export PAC_FC_ALL_REAL_KINDS="{4,8}"
export H5CONFIG_F_NUM_RKIND="INTEGER, PARAMETER :: num_rkinds = 2"
export H5CONFIG_F_NUM_IKIND="INTEGER, PARAMETER :: num_ikinds = 5"
export H5CONFIG_F_RKIND="INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/4,8/)"
export H5CONFIG_F_IKIND="INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/1,2,4,8,16/)"
export PAC_FORTRAN_NATIVE_INTEGER_SIZEOF=" 4"
export PAC_FORTRAN_NATIVE_INTEGER_KIND=" 4"
export PAC_FORTRAN_NATIVE_REAL_SIZEOF=" 4"
export PAC_FORTRAN_NATIVE_REAL_KIND=" 4"
export PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF=" 8"
export PAC_FORTRAN_NATIVE_DOUBLE_KIND=" 8"
export PAC_FORTRAN_NUM_INTEGER_KINDS="5"
export PAC_FC_ALL_REAL_KINDS_SIZEOF="{4,8}"
export PAC_FC_ALL_INTEGER_KINDS_SIZEOF="{1,2,4,8,16}"
# Do we need this below?
export hdf5_cv_szlib_can_encode=yes
HDF5_OPTIONS="${HDF5_OPTIONS} --enable-tests=no"
fi
# regen config after patches to configure.ac
./autogen.sh
./configure --prefix="${PREFIX}" \
--with-pic \
--host="${HOST}" \
--build="${BUILD}" \
--with-zlib="${PREFIX}" \
--with-szlib="${PREFIX}" \
--with-pthread=yes \
${HDF5_OPTIONS} \
--enable-cxx \
--enable-fortran \
--with-default-plugindir="${PREFIX}/lib/hdf5/plugin" \
--enable-threadsafe \
--enable-build-mode=production \
--enable-unsupported \
--enable-hlgiftools=yes \
--enable-using-memchecker \
--enable-static=no \
--enable-ros3-vfd \
|| (cat config.log; false)
# allow oversubscribing with openmpi in make check
export OMPI_MCA_rmaps_base_oversubscribe=yes
# also allow oversubscribing with mvapich
export MVP_ENABLE_AFFINITY=0
if [[ "$CONDA_BUILD_CROSS_COMPILATION" == 1 ]]; then
# parentheses ( make this a sub-shell, so env and cwd changes don't persist
# and we can safely unset env vars temporarily
(
# Make a native build of the hdetect and H5make_libsettings executables
mkdir -p native-build/bin
pushd native-build/bin
# MACOSX_DEPLOYMENT_TARGET is for the target_platform and not for build_platform
unset MACOSX_DEPLOYMENT_TARGET
# openmpi sets up env for cross-compilation by default
# clear it all so it's back to native builds
export OPAL_PREFIX=$BUILD_PREFIX
unset ${!OMPI_@}
$CC_FOR_BUILD ${SRC_DIR}/fortran/src/H5match_types.c -I ${SRC_DIR}/src/ -o H5match_types
$FC_FOR_BUILD ${SRC_DIR}/fortran/src/H5_buildiface.F90 -I ${SRC_DIR}/fortran/src/ -L $BUILD_PREFIX/lib -o H5_buildiface
$FC_FOR_BUILD ${SRC_DIR}/hl/fortran/src/H5HL_buildiface.F90 -I ${SRC_DIR}/hl/fortran/src -I ${SRC_DIR}/fortran/src -L $BUILD_PREFIX/lib -o H5HL_buildiface
)
export PATH=`pwd`/native-build/bin:$PATH
fi
make -j "${CPU_COUNT}" ${VERBOSE_AT}
make install V=1
if [[ ${mpi} == "mpich" || (${mpi} == "openmpi" && "$(uname)" == "Darwin") ]]; then
# ph5diff hangs on darwin with openmpi, skip the test
# ph5diff also crashes on mpich 4.1
echo <<EOF > tools/test/h5diff/testph5diff.sh
#!/bin/sh
exit 0
EOF
fi
if [[ ${mpi} == "mvapich" ]]; then
# Setting environment variables to allow oversubscription
export MV2_ENABLE_AFFINITY=0
# Run tests excluding specific ones using ctest
ctest -E "(t_bigio|t_pmulti_dset|t_filters_parallel|t_cache_image)"
else
# Run parallel tests for other platforms, but exclude specific platforms
if [[ ("$target_platform" != "linux-ppc64le") && \
("$target_platform" != "linux-aarch64") && \
("$target_platform" != "osx-arm64") ]]; then
# https://github.com/h5py/h5py/issues/817
# https://forum.hdfgroup.org/t/hdf5-1-10-long-double-conversions-tests-failed-in-ppc64le/4077
make check RUNPARALLEL="mpiexec -n 2"
fi
fi