-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathbuild.sh
99 lines (87 loc) · 3.49 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
#!/bin/bash
set -ex
# Fix ctest not automatically discovering tests
LDFLAGS=$(echo "${LDFLAGS}" | sed "s/-Wl,--gc-sections//g")
# See this workaround
# ( https://github.com/xianyi/OpenBLAS/issues/818#issuecomment-207365134 ).
CF="${CFLAGS}"
unset CFLAGS
if [[ "$USE_OPENMP" == "1" ]]; then
# Run the the fork test
sed -i.bak 's/test_potrs.o/test_potrs.o test_fork.o/g' utest/Makefile
fi
if [ ! -z "$FFLAGS" ]; then
export FFLAGS="${FFLAGS/-fopenmp/ }";
fi
export FFLAGS="${FFLAGS} -frecursive"
# Because -Wno-missing-include-dirs does not work with gfortran:
[[ -d "${PREFIX}"/include ]] || mkdir "${PREFIX}"/include
[[ -d "${PREFIX}"/lib ]] || mkdir "${PREFIX}"/lib
# Set CPU Target
if [[ "${target_platform}" == linux-aarch64 ]]; then
TARGET="ARMV8"
BINARY="64"
DYNAMIC_ARCH=1
elif [[ "${target_platform}" == linux-ppc64le ]]; then
TARGET="POWER8"
BUILD_BFLOAT16=1
BINARY="64"
DYNAMIC_ARCH=1
elif [[ "${target_platform}" == linux-64 ]]; then
TARGET="PRESCOTT"
BUILD_BFLOAT16=1
BINARY="64"
DYNAMIC_ARCH=1
elif [[ "${target_platform}" == osx-64 ]]; then
TARGET="CORE2"
BUILD_BFLOAT16=1
BINARY="64"
DYNAMIC_ARCH=1
elif [[ "${target_platform}" == osx-arm64 ]]; then
TARGET="VORTEX"
BINARY="64"
DYNAMIC_ARCH=0
fi
QUIET_MAKE=0
if [[ "$CI" == "travis" ]]; then
QUIET_MAKE=1
fi
export HOSTCC=$CC_FOR_BUILD
OBJCONV=""
if [[ "${target_platform}" == "osx-arm64" && "${build_platform}" != "osx-arm64" ]]; then
OBJCONV="OBJCONV=objconv"
fi
if [[ "${CROSSCOMPILING_EMULATOR}" != "" ]]; then
# We'd like to set CROSS=0 for builds with an emulator in order to run tests,
# but as of 0.3.29 aarch64/ppc64 run into spurious emulation errors
CROSS=1
elif [[ "${CONDA_BUILD_CROSS_COMPILATION:-}" != "1" ]]; then
CROSS=0
else
CROSS=1
fi
# Build all CPU targets and allow dynamic configuration
# Build LAPACK.
# Enable threading. This can be controlled to a certain number by
# setting OPENBLAS_NUM_THREADS before loading the library.
# Tests are run as part of build
make QUIET_MAKE=${QUIET_MAKE} DYNAMIC_ARCH=${DYNAMIC_ARCH} BINARY=${BINARY} NO_LAPACK=0 CFLAGS="${CF}" \
HOST=${HOST} TARGET=${TARGET} CROSS_SUFFIX="${HOST}-" \
NO_AFFINITY=1 USE_THREAD=1 NUM_THREADS=128 USE_OPENMP="${USE_OPENMP}" \
INTERFACE64=${INTERFACE64} SYMBOLSUFFIX=${SYMBOLSUFFIX} ${OBJCONV} CROSS=${CROSS}
make install PREFIX="${PREFIX}" \
QUIET_MAKE=${QUIET_MAKE} DYNAMIC_ARCH=${DYNAMIC_ARCH} BINARY=${BINARY} NO_LAPACK=0 CFLAGS="${CF}" \
HOST=${HOST} TARGET=${TARGET} CROSS_SUFFIX="${HOST}-" \
NO_AFFINITY=1 USE_THREAD=1 NUM_THREADS=128 USE_OPENMP="${USE_OPENMP}" \
INTERFACE64=${INTERFACE64} SYMBOLSUFFIX=${SYMBOLSUFFIX} ${OBJCONV} CROSS=${CROSS}
if [[ "${target_platform}" == osx-arm64 ]]; then
TARGET_LOWER=$(echo "$TARGET" | tr '[:upper:]' '[:lower:]')
ls -alh $PREFIX/lib/libopenblas*
# Make sure the concrete library is libopenblas.0.dylib and there's a link for
# libopenblas_vortexp-r${PKG_VERSION}.dylib for backwards compatibility
rm $PREFIX/lib/libopenblas${SYMBOLSUFFIX}.0.dylib
mv $PREFIX/lib/libopenblas${SYMBOLSUFFIX}_${TARGET_LOWER}p-r${PKG_VERSION}.dylib $PREFIX/lib/libopenblas${SYMBOLSUFFIX}.0.dylib
ln -sf $PREFIX/lib/libopenblas${SYMBOLSUFFIX}.0.dylib $PREFIX/lib/libopenblas${SYMBOLSUFFIX}p-r${PKG_VERSION}.dylib
ln -sf $PREFIX/lib/libopenblas${SYMBOLSUFFIX}.0.dylib $PREFIX/lib/libopenblas${SYMBOLSUFFIX}_vortexp-r${PKG_VERSION}.dylib
ln -sf $PREFIX/lib/libopenblas${SYMBOLSUFFIX}.0.dylib $PREFIX/lib/libopenblas${SYMBOLSUFFIX}_armv8p-r${PKG_VERSION}.dylib
fi