Forked from whizzzkid/XPS-15 9560 Getting Nvidia To Work on KDE Neon
Created
January 15, 2018 16:20
-
-
Save keopx/fefe445c03e057b584d5134af6ee9543 to your computer and use it in GitHub Desktop.
Making Nvidia Drivers + CUDA 8 + Bumblebee work together on XPS 15 Early 2017 9560 kabylake. Ubuntu, KDE Neon, Linux Mint, debian.
This file contains 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
# Instructions for 4.13 and cuda 9.0 RC | |
# If upgrading from 4.11 and cuda 8.0 | |
$ sudo apt-get purge --auto-remove libcud* | |
$ sudo apt-get purge --auto-remove cuda* | |
$ sudo apt-get purge --auto-remove nvidia* | |
# also remove the container directory direcotory at /usr/local/cuda-8.0/ | |
# Install Intel Graphics Patch Firmwares (This should reboot your system): | |
bash -c "$(curl -fsSL http://bit.ly/IGFWL-install)" | |
# Update to 4.13 kernel. nvidia-384 compiles fine with this. | |
cd /tmp | |
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-headers-4.13.0-041300_4.13.0-041300.201709031731_all.deb | |
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-headers-4.13.0-041300-generic_4.13.0-041300.201709031731_amd64.deb | |
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-image-4.13.0-041300-generic_4.13.0-041300.201709031731_amd64.deb | |
sudo dpkg -i *.deb | |
# Add Nvidia repository | |
sudo add-apt-repository ppa:graphics-drivers/ppa | |
sudo apt update | |
# Install via ubuntu drivers | |
sudo ubuntu-drivers autoinstall | |
# <optional for ML Folks> Install CUDA 8 (if you're interested in using gpu for ML) ~> requires nvidia stable drivers | |
# This acts as repo so install it somewhere safe and do not delete | |
# cuda is now available with membership only, download from https://developer.nvidia.com/cuda-release-candidate-download | |
sudo dpkg -i cuda-repo-ubuntu1604-9-0-local-rc_9.0.103-1_amd64.deb | |
sudo apt-key add /var/cuda-repo-<version>/7fa2af80.pub | |
sudo apt-get update | |
sudo apt-get install cuda | |
# Update Path to have /usr/local/cuda/bin incase using dotfiles. | |
# <optional for ML Folks> Install CuDNN for running things like tensorflow | |
# Download cudnn7 for cuda9 from nvidia https://developer.nvidia.com/cudnn | |
sudo dpkg -i libcudnn7_7.0.2.43-1+cuda9.0_amd64.deb | |
# Testing cuda. | |
$ sudo prime-select intel | |
$ nvidia-smi | |
# This should give an error, no drivers found | |
# Try this | |
$ sudo prime-select nvidia | |
# displays CUDA info. | |
# At this point the nvidia drivers work well enough. Search for "nvidia x server settings" | |
# in your applications menu and you can switch between intel and nvidia PRIME profiles. | |
# But the nvidia card is still ON (bbswitch will report it off, but the battery consumption is (20 +- 5) Watts | |
# You can leave it here if you're not worried about battery but if you are then continue with this. | |
# Install powertop and tlp | |
sudo apt install tlp powertop | |
# Run powertop: | |
sudo powertop | |
# You should see battery discharge around 20w +/- 5W, this eats up my battery 4 times faster. | |
# Add command line params: | |
sudo nano /etc/default/grub | |
# Make the following look like this, do not ask why. | |
GRUB_CMDLINE_LINUX_DEFAULT='pcie_port_pm=off acpi_backlight=none acpi_osi=Linux acpi_osi=! acpi_osi="Windows 2009"' | |
sudo update-grub2 | |
# Install bumblebee - now this is the danger zone, this software has not been updated in a while and I am not sure when will this available. | |
# Avoid updating your system if you're fine with this. | |
sudo add-apt-repository ppa:bumblebee/testing | |
sudo apt update | |
sudo apt install bumblebee bumblebee-nvidia | |
# at the time of writing this, the latest is nvidia-381 but cuda 8 requires the stable, which is nvidia-375 | |
# add them to bumblebee config file. | |
sudo nano /etc/bumblebee/bumblebee.conf | |
# Change 'Driver=' to 'Driver=nvidia' | |
# Change all occurences of 'nvidia-current' to 'nvidia-xxx' | |
# Change KernelDriver=nvidia-384 | |
# save and run | |
sudo service bumblebeed restart | |
# this should give you daemon already running | |
sudo bumblebeed | |
# Since the driver load will now be handled by bumblebee, we need to stop the OS from loading it. | |
sudo nano /etc/modprobe.d/bumblebee.conf | |
# Make the following section look like this (the drm line will be added): | |
#375 | |
blacklist nvidia-384 | |
blacklist nvidia-384-drm | |
blacklist nvidia-384-updates | |
blacklist nvidia-experimental-384 | |
# once that is done, you'll need bbswitch dkms module | |
sudo apt-get install bbswitch-dkms | |
# Load this with the kernel. | |
sudo nano /etc/modules-load.d/modules.conf | |
# add following | |
i915 | |
bbswitch | |
# now make sure nvidia-settings has nvidia prime profile selected. | |
# So what actually happened: | |
# The control for switching between graphics has been moved from nvidia's driver to bumblebee. This helps | |
# maximize battery life because now you can selectively switch between which graphics card to use. In case | |
# you want to provide access to nvidia gpu for the current application run it using optirun. | |
# e.g. if you want to run steam with nvidia gpu, run something like: $ optirun steam | |
# or if you're using gpu to run ml tasks, just run them with optirun and they would work just fine. | |
# Additional | |
# TLP is known to interfere with bumblebee, make it avoid using this https://wiki.archlinux.org/index.php/Talk:Bumblebee#Bumblebee_and_TLP_interferening | |
# Run powertop to see if battery consumption is in check: 10w +/- 5W | |
# Testing bumblebee | |
cat /proc/acpi/bbswitch # Ouput:0000:01:00.0 OFF | |
optirun glxgears -info # Runs the Gears demo | |
optirun nvidia-smi # Should give an error | |
sudo prime-select nvidia # Should select nvidia hardware for cuda | |
optirun nvidia-smi # Outputs: | |
+-----------------------------------------------------------------------------+ | |
| NVIDIA-SMI 384.98 Driver Version: 384.98 | | |
|-------------------------------+----------------------+----------------------+ | |
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | |
|===============================+======================+======================| | |
| 0 GeForce GTX 1050 Off | 00000000:01:00.0 Off | N/A | | |
| N/A 45C P0 N/A / N/A | 6MiB / 4041MiB | 2% Default | | |
+-------------------------------+----------------------+----------------------+ | |
+-----------------------------------------------------------------------------+ | |
| Processes: GPU Memory | | |
| GPU PID Type Process name Usage | | |
|=============================================================================| | |
| 0 13778 G /usr/lib/xorg/Xorg 6MiB | | |
+-----------------------------------------------------------------------------+ | |
cat /proc/acpi/bbswitch # Still Outputs:0000:01:00.0 OFF which means, we're using nvida hardware only when we run applications using optirun | |
# Getting mouse freezes, random misses? | |
dmesg -w | grep psmouse #check if your trackpad is out of sync frequently | |
# Add this boot flag: | |
"psmouse.resetafter=0" | |
# Other Helpful links: | |
http://en.community.dell.com/techcenter/os-applications/f/4613/t/19629103 | |
https://karlgrz.com/dell-xps-15-ubuntu-tweaks/ | |
https://hemenkapadia.github.io/blog/2016/05/07/Ubuntu-with-Nvidia-Bumblebee.html | |
https://askubuntu.com/questions/879856/nvidia-prime-cant-switch-to-intel/885487 | |
http://www.webupd8.org/2016/08/how-to-install-and-configure-bumblebee.html | |
#Benchmarks | |
================================== | |
GpuTest 0.7.0 | |
http://www.geeks3d.com | |
Module: TessMark X64 | |
Score: 5243 points (FPS: 87) | |
Settings: | |
- 1920x1080 windowed | |
- antialiasing: Off | |
- duration: 60000 ms | |
Renderer: | |
- GeForce GTX 1050/PCIe/SSE2 | |
- OpenGL: 4.5.0 NVIDIA 384.98 | |
================================== | |
================================== | |
GpuTest 0.7.0 | |
http://www.geeks3d.com | |
Module: Plot3D | |
Score: 11340 points (FPS: 189) | |
Settings: | |
- 1920x1080 windowed | |
- antialiasing: Off | |
- duration: 60000 ms | |
Renderer: | |
- GeForce GTX 1050/PCIe/SSE2 | |
- OpenGL: 4.5.0 NVIDIA 384.98 | |
================================== | |
================================= | |
GpuTest 0.7.0 | |
http://www.geeks3d.com | |
Module: FurMark | |
Score: 2670 points (FPS: 44) | |
Settings: | |
- 1920x1080 windowed | |
- antialiasing: Off | |
- duration: 60000 ms | |
Renderer: | |
- GeForce GTX 1050/PCIe/SSE2 | |
- OpenGL: 4.5.0 NVIDIA 384.98 | |
================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment