Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Commit ae438b4

Browse files
committed
populate OpenBLAS cache, unset -ex in scripts
1 parent 068927c commit ae438b4

File tree

3 files changed

+55
-22
lines changed

3 files changed

+55
-22
lines changed

.travis/linux/ATLAS/install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ go get github.com/gonum/matrix/mat64
1414
pushd cgo/clapack
1515
go install -v -x
1616
popd
17+
18+
set +ex

.travis/linux/OpenBLAS/install.sh

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,58 @@
11
set -ex
22

3+
CACHE_DIR=${TRAVIS_BUILD_DIR}/.travis/${BLAS_LIB}.cache
4+
35
# fetch fortran to build OpenBLAS
4-
sudo apt-get update -qq
5-
sudo apt-get install -qq gfortran
6-
7-
# fetch OpenBLAS
8-
pushd ~
9-
sudo git clone --depth=1 git://github.com/xianyi/OpenBLAS
10-
11-
# make OpenBLAS
12-
pushd OpenBLAS
13-
echo OpenBLAS $(git rev-parse HEAD)
14-
sudo make FC=gfortran &> /dev/null
15-
sudo make PREFIX=/usr install
16-
popd
6+
sudo apt-get update -qq && sudo apt-get install -qq gfortran
177

18-
# fetch cblas reference lib
19-
curl http://www.netlib.org/blas/blast-forum/cblas.tgz | tar -zx
8+
# check if cache exists
9+
if [ -e ${CACHE_DIR}/last_commit_id ]; then
10+
echo "Cache $CACHE_DIR hit"
11+
LAST_COMMIT="$(git ls-remote git://github.com/xianyi/OpenBLAS HEAD | grep -o '^\S*')"
12+
CACHED_COMMIT="$(cat ${CACHE_DIR}/last_commit_id)"
13+
# determine current OpenBLAS master commit id and compare
14+
# with commit id in cache directory
15+
if [ "$LAST_COMMIT" != "$CACHED_COMMIT" ]; then
16+
echo "Cache Directory $CACHE_DIR has stale commit"
17+
# if commit is different, delete the cache
18+
rm -rf ${CACHE_DIR}
19+
fi
20+
fi
2021

21-
# make and install cblas
22-
pushd CBLAS
23-
sudo mv Makefile.LINUX Makefile.in
24-
sudo BLLIB=/usr/lib/libopenblas.a make alllib
25-
sudo mv lib/cblas_LINUX.a /usr/lib/libcblas.a
26-
popd
27-
popd
22+
# check if cache directory exists
23+
if [ ! -e ${CACHE_DIR}/last_commit_id ]; then
24+
if [ -d ${CACHE_DIR} ]; then
25+
# Travis automatically creates the cache directory if it does not exist,
26+
# so this is needed for initialization.
27+
rm -rf ${CACHE_DIR}
28+
fi
29+
30+
# cache generation
31+
echo "Building cache at $CACHE_DIR"
32+
mkdir ${CACHE_DIR}
33+
sudo git clone --depth=1 git://github.com/xianyi/OpenBLAS
34+
35+
pushd OpenBLAS
36+
echo OpenBLAS $(git rev-parse HEAD)
37+
# write commit id to cache location
38+
echo $(git rev-parse HEAD) > ${CACHE_DIR}/last_commit_id
39+
sudo make FC=gfortran &> /dev/null && sudo make PREFIX=${CACHE_DIR} install
40+
popd
2841

42+
curl http://www.netlib.org/blas/blast-forum/cblas.tgz | tar -zx
43+
44+
pushd CBLAS
45+
sudo mv Makefile.LINUX Makefile.in
46+
sudo BLLIB=${CACHE_DIR}/lib/libopenblas.a make alllib
47+
sudo mv lib/cblas_LINUX.a ${CACHE_DIR}/lib/libcblas.a
48+
popd
49+
50+
fi
51+
52+
# copy the cache files into /usr
53+
sudo cp -r ${CACHE_DIR}/* /usr/
54+
55+
# install gonum/blas against OpenBLAS
2956
# fetch and install gonum/blas and gonum/matrix
3057
export CGO_LDFLAGS="-L/usr/lib -lopenblas"
3158
go get github.com/gonum/blas
@@ -35,3 +62,5 @@ go get github.com/gonum/matrix/mat64
3562
pushd cgo/clapack
3663
go install -v -x
3764
popd
65+
66+
set +ex

.travis/linux/gonum/install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ set -ex
33
# fetch gonum/blas and gonum/matrix
44
go get github.com/gonum/blas
55
go get github.com/gonum/matrix/mat64
6+
7+
set +ex

0 commit comments

Comments
 (0)