-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
executable file
·43 lines (38 loc) · 1017 Bytes
/
configure
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
#!/bin/sh
R_HOME=$(R RHOME)
# Function to detect BLAS library
detect_blas() {
blas_info=$(${R_HOME}/bin/R --slave -e "si <- sessionInfo(); cat(si\$BLAS, '\n', si\$LAPACK)")
if echo "$blas_info" | grep -iq "mkl"; then
echo "mkl"
elif echo "$blas_info" | grep -iq "openblas"; then
echo "openblas"
else
echo "default"
fi
}
# Detect BLAS
BLAS_TYPE=$(detect_blas)
# OPENBLAS seems sub-optimal
case $BLAS_TYPE in
mkl)
echo "Using MKL"
BLAS_LAPACK_LIBS="-lmkl_rt"
USE_MKL=true
USE_OPENBLAS=false
USE_LAPACKE=true
;;
*)
echo "Using default BLAS and LAPACK"
BLAS_LAPACK_LIBS="-lblas -llapack"
USE_MKL=false
USE_OPENBLAS=false
USE_LAPACKE=false
;;
esac
# Create Makevars
sed -e "s|@BLAS_LAPACK_LIBS@|$BLAS_LAPACK_LIBS|" \
-e "s|@USE_MKL@|$USE_MKL|" \
-e "s|@USE_OPENBLAS@|$USE_OPENBLAS|" \
-e "s|@USE_LAPACKE@|$USE_LAPACKE|" \
src/Makevars.in > src/Makevars