Skip to content

Commit 47cdd1c

Browse files
szagoruykosoumith
authored andcommitted
Test CUDA builds (#104)
* add travis script
1 parent 9dfb31b commit 47cdd1c

File tree

3 files changed

+27
-8
lines changed

3 files changed

+27
-8
lines changed

.travis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ compiler:
55
cache:
66
directories:
77
- $HOME/OpenBlasInstall
8-
sudo: false
8+
sudo: required
99
env:
1010
- TORCH_LUA_VERSION=LUAJIT21
1111
- TORCH_LUA_VERSION=LUA51
@@ -48,7 +48,9 @@ before_script:
4848
- export INSTALL_PREFIX=~/torch/install
4949
- 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)
5050
- git clone https://github.com/torch/distro.git ~/torch --recursive
51+
- sudo -E $ROOT_TRAVIS_DIR/travis_cuda_install.sh
5152
script:
53+
- export PATH=/usr/local/cuda/bin/:$PATH
5254
- cd ~/torch && ./install.sh -b
5355
- source ~/torch/install/bin/torch-activate
5456
- ./test.sh

test.sh

+1-7
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,7 @@ then
4242
$LUA -laudio -e "print('audio loaded succesfully')"
4343
fi
4444

45-
# CUDA tests
46-
set +e
47-
path_to_nvcc=$(which nvcc)
48-
path_to_nvidiasmi=$(which nvidia-smi)
49-
set -e
50-
51-
if [ -x "$path_to_nvcc" ] || [ -x "$path_to_nvidiasmi" ]
45+
if `$LUA -lcutorch -e ""`
5246
then
5347
$LUA -lcutorch -e "print('cutorch loaded succesfully')"
5448
$LUA -lcunn -e "print('cunn loaded succesfully')"

travis_cuda_install.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env sh
2+
3+
if [[ `uname` == 'Linux' ]]; then
4+
CUDA_VERSION=6-5
5+
CUDA_URL=http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/x86_64/cuda-repo-ubuntu1204_6.5-14_amd64.deb
6+
CUDA_FILE=/tmp/cuda_install.deb
7+
8+
curl $CUDA_URL -o $CUDA_FILE
9+
dpkg -i $CUDA_FILE
10+
rm -f $CUDA_FILE
11+
apt-get -y update
12+
apt-get -y install \
13+
cuda-core-${CUDA_VERSION} \
14+
cuda-cublas-${CUDA_VERSION} \
15+
cuda-cublas-dev-${CUDA_VERSION} \
16+
cuda-cudart-${CUDA_VERSION} \
17+
cuda-cudart-dev-${CUDA_VERSION} \
18+
cuda-curand-${CUDA_VERSION} \
19+
cuda-curand-dev-${CUDA_VERSION} \
20+
cuda-cusparse-${CUDA_VERSION} \
21+
cuda-cusparse-dev-${CUDA_VERSION}
22+
ln -s /usr/local/cuda-6.5 /usr/local/cuda
23+
fi

0 commit comments

Comments
 (0)