summaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2020-08-21 14:16:47 +0200
committerJoel Rosdahl <joel@rosdahl.net>2020-08-22 20:05:32 +0200
commit928c5948bdc5ab1fde76c77021e31a0b2204d2f9 (patch)
tree03f2cc44bcb26de2f9fa044d258a8480f485f438 /ci
parent38cee3117f9d12f31b35d5f5ddd05851858e37f0 (diff)
downloadccache-928c5948bdc5ab1fde76c77021e31a0b2204d2f9.tar.gz
build.yaml: Make installation of CUDA actually work
Diffstat (limited to 'ci')
-rwxr-xr-xci/install-cuda32
1 files changed, 32 insertions, 0 deletions
diff --git a/ci/install-cuda b/ci/install-cuda
new file mode 100755
index 00000000..97f098df
--- /dev/null
+++ b/ci/install-cuda
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# Version is given in the CUDA variable.
+
+set -eu
+
+retry() {
+ local i=0
+ while [ $i -lt 3 ]; do
+ if "$@"; then
+ return 0
+ fi
+ i=$((i + 1))
+ done
+ return 1
+}
+
+echo "Installing CUDA support"
+
+retry wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_${CUDA}_amd64.deb
+retry sudo dpkg -i cuda-repo-ubuntu1804_${CUDA}_amd64.deb
+retry sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
+retry sudo apt-get update -qq
+
+cuda_prefix=${CUDA:0:4}
+cuda_prefix=${cuda_prefix/./-}
+retry sudo apt-get install --allow-unauthenticated -y cuda-command-line-tools-${cuda_prefix}
+retry sudo apt-get clean
+
+cuda_home=/usr/local/cuda-${CUDA:0:4}
+$cuda_home/bin/nvcc --version
+echo "::set-env name=PATH::${cuda_home}/bin:${PATH}"