Skip to content

Commit

Permalink
Test CUDA builds (torch#104)
Browse files Browse the repository at this point in the history
* add travis script
  • Loading branch information
szagoruyko authored and soumith committed May 1, 2016
1 parent 9dfb31b commit 47cdd1c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ compiler:
cache:
directories:
- $HOME/OpenBlasInstall
sudo: false
sudo: required
env:
- TORCH_LUA_VERSION=LUAJIT21
- TORCH_LUA_VERSION=LUA51
Expand Down Expand Up @@ -48,7 +48,9 @@ before_script:
- export INSTALL_PREFIX=~/torch/install
- ls $HOME/OpenBlasInstall/lib || (cd /tmp/ && git clone https://github.com/xianyi/OpenBLAS.git -b master && cd OpenBLAS && (make NO_AFFINITY=1 -j$(getconf _NPROCESSORS_ONLN) 2>/dev/null >/dev/null) && make PREFIX=$HOME/OpenBlasInstall install)
- git clone https://github.com/torch/distro.git ~/torch --recursive
- sudo -E $ROOT_TRAVIS_DIR/travis_cuda_install.sh
script:
- export PATH=/usr/local/cuda/bin/:$PATH
- cd ~/torch && ./install.sh -b
- source ~/torch/install/bin/torch-activate
- ./test.sh
8 changes: 1 addition & 7 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ then
$LUA -laudio -e "print('audio loaded succesfully')"
fi

# CUDA tests
set +e
path_to_nvcc=$(which nvcc)
path_to_nvidiasmi=$(which nvidia-smi)
set -e

if [ -x "$path_to_nvcc" ] || [ -x "$path_to_nvidiasmi" ]
if `$LUA -lcutorch -e ""`
then
$LUA -lcutorch -e "print('cutorch loaded succesfully')"
$LUA -lcunn -e "print('cunn loaded succesfully')"
Expand Down
23 changes: 23 additions & 0 deletions travis_cuda_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env sh

if [[ `uname` == 'Linux' ]]; then
CUDA_VERSION=6-5
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
apt-get -y install \
cuda-core-${CUDA_VERSION} \
cuda-cublas-${CUDA_VERSION} \
cuda-cublas-dev-${CUDA_VERSION} \
cuda-cudart-${CUDA_VERSION} \
cuda-cudart-dev-${CUDA_VERSION} \
cuda-curand-${CUDA_VERSION} \
cuda-curand-dev-${CUDA_VERSION} \
cuda-cusparse-${CUDA_VERSION} \
cuda-cusparse-dev-${CUDA_VERSION}
ln -s /usr/local/cuda-6.5 /usr/local/cuda
fi

0 comments on commit 47cdd1c

Please sign in to comment.