Last active
June 28, 2017 22:04
-
-
Save sozercan/135246ab6c36ceb4ced7c60a24739d7a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
content=`cat /var/lib/dcos/mesos-slave-common | grep gpu -c` | |
if [ $content -gt 0 ]; then | |
apt-get update | |
apt-get install -y gcc | |
apt-get install -y make | |
apt-get install -qqy linux-headers-`uname -r` | |
apt-get upgrade | |
wget -P /tmp http://us.download.nvidia.com/XFree86/Linux-x86_64/381.09/NVIDIA-Linux-x86_64-381.09.run | |
chmod +x /tmp/NVIDIA-Linux-x86_64-381.09.run | |
# unbind the vtconsole from the nouveau module | |
sh -c 'echo 0 > /sys/class/vtconsole/vtcon1/bind' | |
# unload nouveau and the direct rendering modules | |
rmmod nouveau | |
rmmod ttm | |
rmmod drm_kms_helper | |
rmmod drm | |
sh /tmp/NVIDIA-Linux-x86_64-381.09.run -a -s | |
nvidia-smi | |
# load the nvidia and direct rendering modules | |
modprobe nvidia | |
modprobe ttm | |
modprobe drm_kms_helper | |
modprobe drm | |
# tell linux to rescan the pci bus. The cards will be added using the nvida modules | |
sh -c 'echo 1 > /sys/bus/pci/rescan' | |
sudo wget https://gist.githubusercontent.com/brianmingus/5497756754bfbcdaac34d39c2b0f0d71/raw/98e84806716d34bf514d73dbc957b35a709d9f73/nvidia_dev.bash -O /etc/init.d/nvidia | |
sudo chmod +x /etc/init.d/nvidia | |
sudo update-rc.d nvidia defaults | |
sudo service nvidia start | |
systemctl enable nvidia-driver-install.service | |
rm -f /var/lib/mesos/slave/meta/slaves/latest | |
systemctl restart dcos-mesos-slave | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment