-# Use a build matrix to do two builds in parallel:
-# one using CMake, and one using make.
+dist: trusty
+sudo: required
+
+language: cpp
+compiler: gcc
+
env:
+ global:
+ - NUM_THREADS=4
matrix:
- - WITH_CUDA=false WITH_CMAKE=false WITH_IO=true
- - WITH_CUDA=false WITH_CMAKE=true WITH_IO=true PYTHON_VERSION=3
- - WITH_CUDA=true WITH_CMAKE=false WITH_IO=true
- - WITH_CUDA=true WITH_CMAKE=true WITH_IO=true
- - WITH_CUDA=false WITH_CMAKE=false WITH_IO=false
- - WITH_CUDA=false WITH_CMAKE=true WITH_IO=false PYTHON_VERSION=3
+ # Use a build matrix to test many builds in parallel
+ # envvar defaults:
+ # WITH_CMAKE: false
+ # WITH_PYTHON3: false
+ # WITH_IO: true
+ # WITH_CUDA: false
+ # WITH_CUDNN: false
+ - BUILD_NAME="default-make"
+# - BUILD_NAME="python3-make" WITH_PYTHON3=true
+ - BUILD_NAME="no-io-make" WITH_IO=false
+ - BUILD_NAME="cuda-make" WITH_CUDA=true
+ - BUILD_NAME="cudnn-make" WITH_CUDA=true WITH_CUDNN=true
-language: cpp
+ - BUILD_NAME="default-cmake" WITH_CMAKE=true
+ - BUILD_NAME="python3-cmake" WITH_CMAKE=true WITH_PYTHON3=true
+ - BUILD_NAME="no-io-cmake" WITH_CMAKE=true WITH_IO=false
+ - BUILD_NAME="cuda-cmake" WITH_CMAKE=true WITH_CUDA=true
+ - BUILD_NAME="cudnn-cmake" WITH_CMAKE=true WITH_CUDA=true WITH_CUDNN=true
-# Cache Ubuntu apt packages.
cache:
apt: true
- directories:
- - /home/travis/miniconda
- - /home/travis/miniconda2
- - /home/travis/miniconda3
-
-compiler: gcc
before_install:
- - export NUM_THREADS=4
- - export SCRIPTS=./scripts/travis
- - export CONDA_DIR="/home/travis/miniconda$PYTHON_VERSION"
+ - source ./scripts/travis/defaults.sh
install:
- - sudo -E $SCRIPTS/travis_install.sh
+ - sudo -E ./scripts/travis/install-deps.sh
+ - ./scripts/travis/setup-venv.sh ~/venv
+ - source ~/venv/bin/activate
+ - ./scripts/travis/install-python-deps.sh
before_script:
- - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/cuda/lib64:$CONDA_DIR/lib
- - export PATH=$CONDA_DIR/bin:$PATH
- - if ! $WITH_CMAKE; then $SCRIPTS/travis_setup_makefile_config.sh; fi
+ - ./scripts/travis/configure.sh
-script: $SCRIPTS/travis_build_and_test.sh
+script:
+ - ./scripts/travis/build.sh
+ - ./scripts/travis/test.sh
notifications:
# Emails are sent to the committer's git-configured email address by default,
--- /dev/null
+#!/bin/bash
+# build the project
+
+BASEDIR=$(dirname $0)
+source $BASEDIR/defaults.sh
+
+if ! $WITH_CMAKE ; then
+ make --jobs $NUM_THREADS all test pycaffe warn
+else
+ cd build
+ make --jobs $NUM_THREADS all test.testbin
+fi
+make lint
--- /dev/null
+# CMake configuration
+
+mkdir -p build
+cd build
+
+ARGS="-DCMAKE_BUILD_TYPE=Release -DBLAS=Open"
+
+if $WITH_PYTHON3 ; then
+ ARGS="$ARGS -Dpython_version=3"
+fi
+
+if $WITH_IO ; then
+ ARGS="$ARGS -DUSE_OPENCV=On -DUSE_LMDB=On -DUSE_LEVELDB=On"
+else
+ ARGS="$ARGS -DUSE_OPENCV=Off -DUSE_LMDB=Off -DUSE_LEVELDB=Off"
+fi
+
+if $WITH_CUDA ; then
+ # Only build SM50
+ ARGS="$ARGS -DCPU_ONLY=Off -DCUDA_ARCH_NAME=Manual -DCUDA_ARCH_BIN=\"50\" -DCUDA_ARCH_PTX=\"\""
+else
+ ARGS="$ARGS -DCPU_ONLY=On"
+fi
+
+if $WITH_CUDNN ; then
+ ARGS="$ARGS -DUSE_CUDNN=On"
+else
+ ARGS="$ARGS -DUSE_CUDNN=Off"
+fi
+
+cmake .. $ARGS
+
--- /dev/null
+# raw Makefile configuration
+
+LINE () {
+ echo "$@" >> Makefile.config
+}
+
+cp Makefile.config.example Makefile.config
+
+LINE "BLAS := open"
+LINE "WITH_PYTHON_LAYER := 1"
+
+if $WITH_PYTHON3 ; then
+ # TODO(lukeyeager) this path is currently disabled because of test errors like:
+ # ImportError: dynamic module does not define init function (PyInit__caffe)
+ LINE "PYTHON_LIBRARIES := python3.4m boost_python-py34"
+ LINE "PYTHON_INCLUDE := /usr/include/python3.4 /usr/lib/python3/dist-packages/numpy/core/include"
+ LINE "INCLUDE_DIRS := \$(INCLUDE_DIRS) \$(PYTHON_INCLUDE)"
+fi
+
+if ! $WITH_IO ; then
+ LINE "USE_OPENCV := 0"
+ LINE "USE_LEVELDB := 0"
+ LINE "USE_LMDB := 0"
+fi
+
+if $WITH_CUDA ; then
+ # Only build SM50
+ LINE "CUDA_ARCH := -gencode arch=compute_50,code=sm_50"
+else
+ LINE "CPU_ONLY := 1"
+fi
+
+if $WITH_CUDNN ; then
+ LINE "USE_CUDNN := 1"
+fi
+
--- /dev/null
+#!/bin/bash
+# configure the project
+
+BASEDIR=$(dirname $0)
+source $BASEDIR/defaults.sh
+
+if ! $WITH_CMAKE ; then
+ source $BASEDIR/configure-make.sh
+else
+ source $BASEDIR/configure-cmake.sh
+fi
--- /dev/null
+#!/bin/bash
+# set default environment variables
+
+set -e
+
+WITH_CMAKE=${WITH_CMAKE:-false}
+WITH_PYTHON3=${WITH_PYTHON3:-false}
+WITH_IO=${WITH_IO:-true}
+WITH_CUDA=${WITH_CUDA:-false}
+WITH_CUDNN=${WITH_CUDNN:-false}
--- /dev/null
+#!/bin/bash
+# install dependencies
+# (this script must be run as root)
+
+BASEDIR=$(dirname $0)
+source $BASEDIR/defaults.sh
+
+apt-get -y update
+apt-get install -y --no-install-recommends \
+ build-essential \
+ libboost-filesystem-dev \
+ libboost-python-dev \
+ libboost-system-dev \
+ libboost-thread-dev \
+ libgflags-dev \
+ libgoogle-glog-dev \
+ libhdf5-serial-dev \
+ libopenblas-dev \
+ python-virtualenv \
+ wget
+
+if $WITH_CMAKE ; then
+ apt-get install -y --no-install-recommends cmake
+fi
+
+if ! $WITH_PYTHON3 ; then
+ # Python2
+ apt-get install -y --no-install-recommends \
+ libprotobuf-dev \
+ protobuf-compiler \
+ python-dev \
+ python-numpy \
+ python-protobuf \
+ python-skimage
+else
+ # Python3
+ apt-get install -y --no-install-recommends \
+ python3-dev \
+ python3-numpy \
+ python3-skimage
+
+ # build Protobuf3 since it's needed for Python3
+ echo "Building protobuf3 from source ..."
+ pushd .
+ PROTOBUF3_DIR=~/protobuf3-build
+ rm -rf $PROTOBUF3_DIR
+ mkdir $PROTOBUF3_DIR
+
+ # install some more dependencies required to build protobuf3
+ apt-get install -y --no-install-recommends \
+ curl \
+ dh-autoreconf \
+ unzip
+
+ wget https://github.com/google/protobuf/archive/v3.0.0-beta-3.tar.gz -O protobuf3.tar.gz
+ tar -xzf protobuf3.tar.gz -C $PROTOBUF3_DIR --strip 1
+ rm protobuf3.tar.gz
+ cd $PROTOBUF3_DIR
+ ./autogen.sh
+ ./configure --prefix=/usr
+ make --jobs=$NUM_THREADS
+ make install
+ popd
+fi
+
+if $WITH_IO ; then
+ apt-get install -y --no-install-recommends \
+ libleveldb-dev \
+ liblmdb-dev \
+ libopencv-dev \
+ libsnappy-dev
+fi
+
+if $WITH_CUDA ; then
+ # install repo packages
+ CUDA_REPO_PKG=cuda-repo-ubuntu1404_7.5-18_amd64.deb
+ wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/$CUDA_REPO_PKG
+ dpkg -i $CUDA_REPO_PKG
+ rm $CUDA_REPO_PKG
+
+ if $WITH_CUDNN ; then
+ ML_REPO_PKG=nvidia-machine-learning-repo_4.0-2_amd64.deb
+ wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/$ML_REPO_PKG
+ dpkg -i $ML_REPO_PKG
+ fi
+
+ # update package lists
+ apt-get -y update
+
+ # install packages
+ CUDA_PKG_VERSION="7-5"
+ CUDA_VERSION="7.5"
+ apt-get install -y --no-install-recommends \
+ cuda-core-$CUDA_PKG_VERSION \
+ cuda-cudart-dev-$CUDA_PKG_VERSION \
+ cuda-cublas-dev-$CUDA_PKG_VERSION \
+ cuda-curand-dev-$CUDA_PKG_VERSION
+ # manually create CUDA symlink
+ ln -s /usr/local/cuda-$CUDA_VERSION /usr/local/cuda
+
+ if $WITH_CUDNN ; then
+ apt-get install -y --no-install-recommends libcudnn5-dev
+ fi
+fi
+
--- /dev/null
+#!/bin/bash
+# install extra Python dependencies
+# (must come after setup-venv)
+
+BASEDIR=$(dirname $0)
+source $BASEDIR/defaults.sh
+
+if ! $WITH_PYTHON3 ; then
+ # Python2
+ :
+else
+ # Python3
+ pip install --pre protobuf==3.0.0b3
+fi
--- /dev/null
+#!/bin/bash
+# setup a Python virtualenv
+# (must come after install-deps)
+
+BASEDIR=$(dirname $0)
+source $BASEDIR/defaults.sh
+
+VENV_DIR=${1:-~/venv}
+
+# setup our own virtualenv
+if $WITH_PYTHON3; then
+ PYTHON_EXE='/usr/bin/python3'
+else
+ PYTHON_EXE='/usr/bin/python2'
+fi
+
+# use --system-site-packages so that Python will use deb packages
+virtualenv $VENV_DIR -p $PYTHON_EXE --system-site-packages
--- /dev/null
+#!/bin/bash
+# test the project
+
+BASEDIR=$(dirname $0)
+source $BASEDIR/defaults.sh
+
+if $WITH_CUDA ; then
+ echo "Skipping tests for CUDA build"
+ exit 0
+fi
+
+if ! $WITH_CMAKE ; then
+ make runtest
+ make pytest
+else
+ cd build
+ make runtest
+ make pytest
+fi
+++ /dev/null
-#!/bin/bash
-# Script called by Travis to build and test Caffe.
-# Travis CI tests are CPU-only for lack of compatible hardware.
-
-set -e
-MAKE="make --jobs=$NUM_THREADS --keep-going"
-
-if $WITH_CMAKE; then
- mkdir build
- cd build
- CPU_ONLY=" -DCPU_ONLY=ON"
- if ! $WITH_CUDA; then
- CPU_ONLY=" -DCPU_ONLY=OFF"
- fi
- PYTHON_ARGS=""
- if [ "$PYTHON_VERSION" = "3" ]; then
- PYTHON_ARGS="$PYTHON_ARGS -Dpython_version=3 -DBOOST_LIBRARYDIR=$CONDA_DIR/lib/"
- fi
- if $WITH_IO; then
- IO_ARGS="-DUSE_OPENCV=ON -DUSE_LMDB=ON -DUSE_LEVELDB=ON"
- else
- IO_ARGS="-DUSE_OPENCV=OFF -DUSE_LMDB=OFF -DUSE_LEVELDB=OFF"
- fi
- cmake -DBUILD_python=ON -DCMAKE_BUILD_TYPE=Release $CPU_ONLY $PYTHON_ARGS -DCMAKE_INCLUDE_PATH="$CONDA_DIR/include/" -DCMAKE_LIBRARY_PATH="$CONDA_DIR/lib/" $IO_ARGS ..
- $MAKE
- $MAKE pytest
- if ! $WITH_CUDA; then
- $MAKE runtest
- $MAKE lint
- fi
- $MAKE clean
- cd -
-else
- if ! $WITH_CUDA; then
- export CPU_ONLY=1
- fi
- if $WITH_IO; then
- export USE_LMDB=1
- export USE_LEVELDB=1
- export USE_OPENCV=1
- fi
- $MAKE all test pycaffe warn lint || true
- if ! $WITH_CUDA; then
- $MAKE runtest
- fi
- $MAKE all
- $MAKE test
- $MAKE pycaffe
- $MAKE pytest
- $MAKE warn
- if ! $WITH_CUDA; then
- $MAKE lint
- fi
-fi
+++ /dev/null
-#!/bin/bash
-# This script must be run with sudo.
-
-set -e
-
-MAKE="make --jobs=$NUM_THREADS"
-# Install apt packages where the Ubuntu 12.04 default and ppa works for Caffe
-
-# This ppa is for gflags and glog
-add-apt-repository -y ppa:tuleu/precise-backports
-apt-get -y update
-apt-get install \
- wget git curl \
- python-dev python-numpy python3-dev\
- libleveldb-dev libsnappy-dev libopencv-dev \
- libprotobuf-dev protobuf-compiler \
- libatlas-dev libatlas-base-dev \
- libhdf5-serial-dev libgflags-dev libgoogle-glog-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
- # cmake 3 will make sure that the python interpreter and libraries match
- wget --no-check-certificate http://www.cmake.org/files/v3.2/cmake-3.2.3-Linux-x86_64.sh -O cmake3.sh
- chmod +x cmake3.sh
- ./cmake3.sh --prefix=/usr/ --skip-license --exclude-subdir
-fi
-
-# Install CUDA, if needed
-if $WITH_CUDA; then
- CUDA_URL=http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/x86_64/cuda-repo-ubuntu1204_6.5-14_amd64.deb
- CUDA_FILE=/tmp/cuda_install.deb
- curl $CUDA_URL -o $CUDA_FILE
- dpkg -i $CUDA_FILE
- rm -f $CUDA_FILE
- 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.
- apt-get -y install cuda-core-6-5 cuda-cublas-6-5 cuda-cublas-dev-6-5 cuda-cudart-6-5 cuda-cudart-dev-6-5 cuda-curand-6-5 cuda-curand-dev-6-5
- # 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.)
- ln -s /usr/local/cuda-6.5 /usr/local/cuda
-fi
-
-# Install LMDB
-LMDB_URL=https://github.com/LMDB/lmdb/archive/LMDB_0.9.14.tar.gz
-LMDB_FILE=/tmp/lmdb.tar.gz
-pushd .
-wget $LMDB_URL -O $LMDB_FILE
-tar -C /tmp -xzvf $LMDB_FILE
-cd /tmp/lmdb*/libraries/liblmdb/
-$MAKE
-$MAKE install
-popd
-rm -f $LMDB_FILE
-
-# Install the Python runtime dependencies via miniconda (this is much faster
-# than using pip for everything).
-export PATH=$CONDA_DIR/bin:$PATH
-# clear any cached conda (see #3786)
-rm -rf $CONDA_DIR
-if [ ! -d $CONDA_DIR ]; then
- if [ "$PYTHON_VERSION" -eq "3" ]; then
- wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
- else
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
- fi
- chmod +x miniconda.sh
- ./miniconda.sh -b -p $CONDA_DIR
-
- conda update --yes conda
- # The version of boost we're using for Python 3 depends on 3.4 for now.
- if [ "$PYTHON_VERSION" -eq "3" ]; then
- conda install --yes python=3.4
- fi
- conda install --yes numpy scipy matplotlib scikit-image pip
- # Let conda install boost (so that boost_python matches)
- conda install --yes -c https://conda.binstar.org/menpo boost=1.56.0
-fi
-
-# install protobuf 3 (just use the miniconda3 directory to avoid having to setup the path again)
-if [ "$PYTHON_VERSION" -eq "3" ] && [ ! -e "$CONDA_DIR/bin/protoc" ]; then
- pushd .
- wget https://github.com/google/protobuf/archive/v3.0.0-alpha-3.1.tar.gz -O protobuf-3.tar.gz
- tar -C /tmp -xzvf protobuf-3.tar.gz
- cd /tmp/protobuf-3*/
- ./autogen.sh
- ./configure --prefix=$CONDA_DIR
- $MAKE
- $MAKE install
- popd
-fi
-
-if [ "$PYTHON_VERSION" -eq "3" ]; then
- pip install --pre protobuf==3.0.0b2
-else
- pip install protobuf
-fi
+++ /dev/null
-#!/bin/bash
-
-set -e
-
-mv Makefile.config.example Makefile.config
-
-if $WITH_CUDA; then
- # Only generate compute_50.
- GENCODE="-gencode arch=compute_50,code=sm_50"
- GENCODE="$GENCODE -gencode arch=compute_50,code=compute_50"
- echo "CUDA_ARCH := $GENCODE" >> Makefile.config
-fi
-
-# Remove IO library settings from Makefile.config
-# to avoid conflicts with CI configuration
-sed -i -e '/USE_LMDB/d' Makefile.config
-sed -i -e '/USE_LEVELDB/d' Makefile.config
-sed -i -e '/USE_OPENCV/d' Makefile.config
-
-cat << 'EOF' >> Makefile.config
-# Travis' nvcc doesn't like newer boost versions
-NVCCFLAGS := -Xcudafe --diag_suppress=cc_clobber_ignored -Xcudafe --diag_suppress=useless_using_declaration -Xcudafe --diag_suppress=set_but_not_used
-ANACONDA_HOME := $(CONDA_DIR)
-PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
- $(ANACONDA_HOME)/include/python2.7 \
- $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include
-PYTHON_LIB := $(ANACONDA_HOME)/lib
-INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
-LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
-WITH_PYTHON_LAYER := 1
-EOF