Merge ~bladernr/plainbox-provider-certification-server:gpu-setup-update into plainbox-provider-certification-server:master

Proposed by Jeff Lane 
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 75afc5fff4d88679c39bf761aa24ffbdd272a097
Merged at revision: d736e32afbc5b975cb419ab0d2e1ca78fe24ccac
Proposed branch: ~bladernr/plainbox-provider-certification-server:gpu-setup-update
Merge into: plainbox-provider-certification-server:master
Diff against target: 126 lines (+48/-42)
1 file modified
tools/gpu-setup.sh (+48/-42)
Reviewer Review Type Date Requested Status
Jeff Lane  Approve
Review via email: mp+374244@code.launchpad.net

Commit message

Multiple improvements to gpu-setup.sh

Description of the change

Multiple improvements to gpu-setup.sh

To post a comment you must log in.
Revision history for this message
Jeff Lane  (bladernr) wrote :

Self=approved to get this in and fix the issues discuvered when really using the original version of the script.

This version has been tested with Xenial and Bionic on my local test machine as well as a multiple GPU box hosted at a partner lab remotely.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tools/gpu-setup.sh b/tools/gpu-setup.sh
2index c6909ca..22a8430 100755
3--- a/tools/gpu-setup.sh
4+++ b/tools/gpu-setup.sh
5@@ -1,73 +1,79 @@
6 #!/bin/bash
7
8 if [[ $EUID -ne 0 ]]; then
9- echo "This script must be run as root"
10+ echo "ERROR: This script must be run as root"
11 exit 1
12 fi
13
14 echo "Configuring system for GPU Testing"
15 echo "**********************************"
16-echo
17+echo "*"
18
19 # For now we need internet access for this to work. Future versions will
20 # remove this necessity
21+echo "* Testing network connectivity"
22 [[ ! `ping -c 1 www.ubuntu.com` ]] \
23- && echo "This script requires internet access to function correctly" \
24+ && echo "ERROR: This script requires internet access to function correctly" \
25 && exit 1
26-
27-# Disable Nouveau and reset initramfs
28-if lsmod |grep -q nouveau; then
29- echo "* Disabling nouveau driver"
30- echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf
31- echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf
32- echo "* Updating initramfs"
33- update-initramfs -u
34- echo "* Finished disabling nouveau driver"
35-else
36- echo "* nouveau not detected, proceeding..."
37-fi
38-
39 echo "*"
40 echo "**********************************"
41+echo "*"
42+echo "* Adding nVidia package repository"
43+## Leave the following bits for now, it's useful code to template if we sort
44+## out local hosting in the future.
45+#file_pattern="cuda-repo-ubuntu$(lsb_release -r | cut -f 2 | sed -es/\\.//)*.deb"
46+#gw_ip=`ip route | awk '/default/ { print $3 }'`
47
48-# Add required PPAs
49-echo "* Adding Canonical graphis-drivers PPA"
50-add-apt-repository -y ppa:graphics-drivers/ppa
51+# attempt a download from our MAAS server (presume the SUT's gw IP is MAAS)
52+#wget -r -l1 -nd --no-parent -A "$file_pattern" http://$gw_ip/nvidia/
53+#nvidia_pkg=`find / -name $file_pattern`
54
55-echo "* Adding nVidia package repository"
56+#if [ -z "$nvidia_pkg" ]; then
57+# echo "* No local package found, installing remote installer"
58+# wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
59+# dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
60+# apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
61+#else
62+# echo "* Local package detected at $nvidia_pkg... installing"
63+# key_cmd=`dpkg -i $nvidia_pkg |awk '/To install the key, run this command/{getline; print}'`
64+# $key_cmd
65+#fi
66
67-file_pattern="cuda-repo-ubuntu$(lsb_release -r | cut -f 2 | sed -es/\\.//)*.deb"
68-gw_ip=`ip route | awk '/default/ { print $3 }'`
69+## For now, require internet access and installing directly from nVidia
70+# SAUCE: https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=debnetwork
71
72-# attempt a download from our MAAS server (presume the SUT's gw IP is MAAS)
73-wget -r -l1 -nd --no-parent -A "$file_pattern" http://$gw_ip/nvidia/
74-nvidia_pkg=`find / -name $file_pattern`
75+OSRELEASE=ubuntu`lsb_release -r | cut -f2 |sed -e 's/\.//'`
76
77-if [ -z "$nvidia_pkg" ]; then
78- echo "* No local package found, installing remote installer"
79- wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
80- dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
81- apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
82-else
83- echo "* Local package detected at $nvidia_pkg... installing"
84- key_cmd=`dpkg -i $nvidia_pkg |awk '/To install the key, run this command/{getline; print}'`
85- $key_cmd
86-fi
87+wget https://developer.download.nvidia.com/compute/cuda/repos/$OSRELEASE/x86_64/cuda-$OSRELEASE.pin
88+mv cuda-$OSRELEASE.pin /etc/apt/preferences.d/cuda-repository-pin-600
89+# Ran into a case where the 16.04 repo uses http while 18.04 uses https :/
90+KEYSERVER_URL_TAIL="://developer.download.nvidia.com/compute/cuda/repos/$OSRELEASE/x86_64/7fa2af80.pub"
91+SUCCESS=1
92+for KEYSERVER_URL_HEAD in https http; do
93+ KEYSERVER_URL=$KEYSERVER_URL_HEAD$KEYSERVER_URL_TAIL
94+ apt-key adv --fetch-keys $KEYSERVER_URL
95+ SUCCESS=$?
96+ [ $SUCCESS == 0 ] && break
97+done
98
99-echo "* Updating apt cache"
100-apt update
101+add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/$OSRELEASE/x86_64/ /"
102
103 # Install necessary files
104+apt update
105 echo "* Installing necessary pacakges"
106-apt install -y cuda nvidia-cuda-toolkit build-essential git
107+apt install -y build-essential git cuda
108
109+#fix the path to get nvcc from the cuda package
110+CUDA_PATH=$(find /usr/local -maxdepth 1 -type d -iname "cuda*")/bin
111+export PATH=$PATH:$CUDA_PATH
112
113 # get the gpu-burn repo and build it
114 echo "* Cloning gpu-burn repo"
115-git clone https://github.com/wilicc/gpu-burn.git
116-cd gpu-burn
117+GPU_BURN_DIR=/opt/gpu-burn
118+git clone https://github.com/wilicc/gpu-burn.git $GPU_BURN_DIR
119+cd $GPU_BURN_DIR
120 echo "* Building gpu-burn"
121 make && echo "* Build completed..."
122-
123-echo "* Completed installatiion. Please reboot the machine now"
124+echo "*"
125+echo "* Completed installation. Please reboot the machine now"
126 echo "* to load the nVidia proprietary drivers"

Subscribers

People subscribed via source and target branches