diff options
author | Jeff Donahue <jeff.donahue@gmail.com> | 2014-08-17 03:11:59 -0700 |
---|---|---|
committer | Jeff Donahue <jeff.donahue@gmail.com> | 2014-08-17 06:44:53 -0700 |
commit | a909f916e2e9e89674498459f83b0e851a5d1e15 (patch) | |
tree | c93f588575592055968d6256229a61983bee8b67 /scripts | |
parent | db66a0c343597611c89e5dd00c605d159c9810c9 (diff) | |
download | caffeonacl-a909f916e2e9e89674498459f83b0e851a5d1e15.tar.gz caffeonacl-a909f916e2e9e89674498459f83b0e851a5d1e15.tar.bz2 caffeonacl-a909f916e2e9e89674498459f83b0e851a5d1e15.zip |
Travis build matrix to do parallel builds for make and CMake; CUDA-less
and CUDA-ful. Move bits of functionality into scripts under scripts/travis
for readability. Only generate CUDA compute_50 for perfomance.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/travis/travis_build.sh | 18 | ||||
-rwxr-xr-x | scripts/travis/travis_build_and_test.sh | 22 | ||||
-rwxr-xr-x | scripts/travis/travis_install.sh | 79 | ||||
-rwxr-xr-x | scripts/travis/travis_setup_makefile_config.sh | 12 |
4 files changed, 131 insertions, 0 deletions
diff --git a/scripts/travis/travis_build.sh b/scripts/travis/travis_build.sh new file mode 100755 index 00000000..06b4e24b --- /dev/null +++ b/scripts/travis/travis_build.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Script called by Travis to do a full build of Caffe, +# including CUDA functionality. + +if $WITH_CMAKE; then + mkdir build + cd build + cmake -DBUILD_PYTHON=ON -DBUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release .. + make --keep-going + cd - +else + export CPU_ONLY=0 + make --keep-going all test pycaffe warn + make all + make test + make pycaffe + make warn +fi diff --git a/scripts/travis/travis_build_and_test.sh b/scripts/travis/travis_build_and_test.sh new file mode 100755 index 00000000..6b7c85e9 --- /dev/null +++ b/scripts/travis/travis_build_and_test.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Script called by Travis to do a CPU-only build of and test Caffe. + +if $WITH_CMAKE; then + mkdir build + cd build + cmake -DBUILD_PYTHON=ON -DBUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release -DCPU_ONLY=ON .. + make --keep-going + make runtest + make lint + make clean + cd - +else + export CPU_ONLY=1 + make --keep-going all test pycaffe warn lint + make runtest + make all + make test + make pycaffe + make warn + make lint +fi diff --git a/scripts/travis/travis_install.sh b/scripts/travis/travis_install.sh new file mode 100755 index 00000000..f6a357b5 --- /dev/null +++ b/scripts/travis/travis_install.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +# Install apt packages where the Ubuntu 12.04 default works for Caffe +sudo apt-get -y update +sudo apt-get install \ + wget git curl \ + python-dev python-numpy \ + libleveldb-dev libsnappy-dev libopencv-dev \ + libboost-dev libboost-system-dev libboost-python-dev \ + libprotobuf-dev protobuf-compiler \ + libatlas-dev libatlas-base-dev \ + libhdf5-serial-dev \ + bc + +# Add a special apt-repository to install CMake 2.8.9 for CMake Caffe build, +# if needed. By default, Aptitude in Ubuntu 12.04 installs CMake 2.8.7, but +# Caffe requires a minimum CMake version of 2.8.8. +if $WITH_CMAKE; then + sudo add-apt-repository -y ppa:ubuntu-sdk-team/ppa + sudo apt-get -y update + sudo apt-get -y install cmake || (echo "CMake install failed"; exit 1) +fi + +# Install glog +GLOG_URL=https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz +GLOG_FILE=/tmp/glog-0.3.3.tar.gz +pushd . +wget $GLOG_URL -O $GLOG_FILE && \ + tar -C /tmp -xzvf $GLOG_FILE && \ + rm $GLOG_FILE && \ + cd /tmp/glog-0.3.3 && \ + ./configure && make && sudo make install || \ + (echo "glog install failed"; exit 1) +popd + +# Install gflags +GFLAGS_URL=https://github.com/schuhschuh/gflags/archive/master.zip +GFLAGS_FILE=/tmp/gflags-master.zip +pushd . +wget $GFLAGS_URL -O $GFLAGS_FILE && \ + cd /tmp/ && unzip gflags-master.zip && \ + cd gflags-master && \ + mkdir build && \ + cd build && \ + export CXXFLAGS="-fPIC" && \ + cmake .. && make VERBOSE=1 && sudo make install || \ + (echo "gflags install failed"; exit 1) +popd + +# Install CUDA, if needed +CUDA_URL=http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/x86_64/cuda-repo-ubuntu1204_6.0-37_amd64.deb +CUDA_FILE=/tmp/cuda_install.deb +if $WITH_CUDA; then + curl $CUDA_URL -o $CUDA_FILE && \ + sudo dpkg -i $CUDA_FILE || + (echo "CUDA install failed"; exit 1) + rm -f $CUDA_FILE + sudo apt-get -y update + # Install the minimal CUDA subpackages required to test Caffe build. + # For a full CUDA installation, add 'cuda' to the list of packages. + sudo apt-get -y install cuda-core-6-0 cuda-extra-libs-6-0 + # Create CUDA symlink at /usr/local/cuda + # (This would normally be created by the CUDA installer, but we create it + # manually since we did a partial installation.) + sudo ln -s /usr/local/cuda-6.0 /usr/local/cuda || + (echo "CUDA symlink creation failed"; exit 1) +fi + +# Install LMDB +LMDB_URL=https://gitorious.org/mdb/mdb/archive/7f038d0f15bec57b4c07aa3f31cd5564c88a1897.tar.gz +LMDB_FILE=/tmp/mdb.tar.gz +pushd . +curl $LMDB_URL -o $LMDB_FILE && \ + tar -C /tmp -xzvf $LMDB_FILE && \ + cd /tmp/mdb-mdb/libraries/liblmdb/ && \ + make && sudo make install || \ + (echo "LMDB install failed"; exit 1) +popd +rm -f $LMDB_FILE diff --git a/scripts/travis/travis_setup_makefile_config.sh b/scripts/travis/travis_setup_makefile_config.sh new file mode 100755 index 00000000..fa86e92a --- /dev/null +++ b/scripts/travis/travis_setup_makefile_config.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +mv Makefile.config.example Makefile.config + +if $WITH_CUDA; then + # Remove default gencode set; only generate compute_50. + sed -i 's/-gencode arch=.*\\//' Makefile.config + sed -i 's/CUDA_ARCH :=//' Makefile.config + GENCODE="-gencode arch=compute_50,code=sm_50" + GENCODE="$GENCODE -gencode arch=compute_50,code=compute_50" + echo "CUDA_ARCH := $GENCODE" >> Makefile.config +fi |