Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save gggauravgandhi/47dfa019108e251eaf6dd1bb327a2740 to your computer and use it in GitHub Desktop.

Select an option

Save gggauravgandhi/47dfa019108e251eaf6dd1bb327a2740 to your computer and use it in GitHub Desktop.

Revisions

  1. @whizzzkid whizzzkid revised this gist Jan 23, 2018. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -51,8 +51,11 @@ $ sudo prime-select nvidia
    # 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
    # Install powertop
    sudo apt install powertop

    # TLP interferes with bluetooth, better not install it, or remove it completely.
    sudo apt remove --purge tlp

    # Run powertop:
    sudo powertop
  2. @whizzzkid whizzzkid revised this gist Jan 18, 2018. No changes.
  3. @whizzzkid whizzzkid revised this gist Jan 18, 2018. 1 changed file with 25 additions and 15 deletions.
    40 changes: 25 additions & 15 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,21 @@
    # Instructions for 4.13 and cuda 9.0 RC
    # If upgrading from 4.11 and cuda 8.0
    # Instructions for 4.14 and cuda 9.1
    # If upgrading from 4.13 and cuda 9.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/
    # also remove the container directory direcotory at /usr/local/cuda-9.0/

    # Important libs required with 4.14.x with Cuda 9.X
    $ sudo apt install libelf1 libelf-dev

    # 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.
    # Update to 4.14 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
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14.13/linux-headers-4.14.13-041413_4.14.13-041413.201801101001_all.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14.13/linux-headers-4.14.13-041413-generic_4.14.13-041413.201801101001_amd64.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14.13/linux-image-4.14.13-041413-generic_4.14.13-041413.201801101001_amd64.deb
    sudo dpkg -i *.deb

    # Add Nvidia repository
    @@ -84,11 +87,11 @@ sudo bumblebeed
    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
    #387
    blacklist nvidia-387
    blacklist nvidia-387-drm
    blacklist nvidia-387-updates
    blacklist nvidia-experimental-387

    # once that is done, you'll need bbswitch dkms module
    sudo apt-get install bbswitch-dkms
    @@ -119,20 +122,20 @@ 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 |
    | NVIDIA-SMI 387.34 Driver Version: 387.34 |
    |-------------------------------+----------------------+----------------------+
    | 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 |
    | N/A 29C P0 N/A / N/A | 5MiB / 4041MiB | 2% Default |
    +-------------------------------+----------------------+----------------------+

    +-----------------------------------------------------------------------------+
    | Processes: GPU Memory |
    | GPU PID Type Process name Usage |
    |=============================================================================|
    | 0 13778 G /usr/lib/xorg/Xorg 6MiB |
    | 0 23052 G /usr/lib/xorg/Xorg 5MiB |
    +-----------------------------------------------------------------------------+

    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
    @@ -143,6 +146,13 @@ dmesg -w | grep psmouse #check if your trackpad is out of sync frequently
    # Add this boot flag:
    "psmouse.resetafter=0"

    # The system loads a blank screen with just a cursor on reboot?
    # I found that selecting nvidia and restarting the system would need nvidia to run again,
    # but unfortunately we disable nvidia on startup. A simple fix could be adding an alias in your ~/.(bash|zsh)rc
    # I always restart my system from the terminal so this makes sure I move back to intel always before restart.
    alias reboot="sudo prime-select intel; sudo reboot now"
    alias shutdown="sudo prime-select intel; sudo shutdown -h now"

    # Other Helpful links:
    http://en.community.dell.com/techcenter/os-applications/f/4613/t/19629103
    https://karlgrz.com/dell-xps-15-ubuntu-tweaks/
  4. @whizzzkid whizzzkid revised this gist Nov 3, 2017. 1 changed file with 57 additions and 6 deletions.
    63 changes: 57 additions & 6 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -118,22 +118,21 @@ 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:
    Mon Feb 20 21:51:18 2017
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 375.39 Driver Version: 375.39 |
    | 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 | 0000:01:00.0 Off | N/A |
    | N/A 41C P3 N/A / N/A | 6MiB / 4041MiB | 0% Default |
    | 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 |
    | GPU PID Type Process name Usage |
    |=============================================================================|
    | 0 3351 G /usr/lib/xorg/Xorg 6MiB |
    | 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
    @@ -150,3 +149,55 @@ 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
    ==================================
  5. @whizzzkid whizzzkid revised this gist Sep 8, 2017. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,9 @@
    # 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)"
  6. @whizzzkid whizzzkid revised this gist Sep 8, 2017. 1 changed file with 17 additions and 29 deletions.
    46 changes: 17 additions & 29 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,13 @@
    # As of writing this, 4.11 kernel fails, 4.10.15 fails, 4.11rc8 seems to be working. Apply the graphics patches first.
    # Instructions for 4.13 and cuda 9.0 RC

    # Install Intel Graphics Patch Firmwares (This should reboot your system):
    bash -c "$(curl -fsSL http://bit.ly/IGFWL-install)"

    # Update to 4.11.2 kernel. nvidia-375 compiles fine >=4.11.1
    # Update to 4.13 kernel. nvidia-384 compiles fine with this.
    cd /tmp
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11.2/linux-headers-4.11.2-041102_4.11.2-041102.201705201036_all.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11.2/linux-headers-4.11.2-041102-generic_4.11.2-041102.201705201036_amd64.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11.2/linux-image-4.11.2-041102-generic_4.11.2-041102.201705201036_amd64.deb
    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
    @@ -19,28 +19,16 @@ 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
    cd ~/Downloads
    wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
    sudo dpkg -i cuda*.deb; sudo apt update; sudo apt install cuda
    # 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.

    # if you get this message:
    # /sbin/ldconfig.real: /usr/lib/nvidia-375/libEGL.so.1 is not a symbolic link
    # /sbin/ldconfig.real: /usr/lib32/nvidia-375/libEGL.so.1 is not a symbolic link
    # Manually override using https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-375/+bug/1662860/comments/14

    # <optional for ML Folks> Install CuDNN for running things like tensorflow
    # Download cudnn from nvidia
    tar -xvzf cudnn-8.0-linux-x64-v6.0.tgz
    sudo rsync -K -a cuda/* /usr/local/cuda/

    # The version of prime-select is BS. Patch prime select like this
    # Update: it's been fixed, just leaving here if something fails.
    # cd /usr/bin
    # sudo mv prime-select prime-select.bkup
    # sudo wget https://raw.githubusercontent.com/C11235/nvidia-prime-bugfix/master/prime-select
    # sudo chmod 755 prime-select
    # sudo reboot now
    # 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
    @@ -80,7 +68,7 @@ sudo nano /etc/bumblebee/bumblebee.conf

    # Change 'Driver=' to 'Driver=nvidia'
    # Change all occurences of 'nvidia-current' to 'nvidia-xxx'
    # Change KernelDriver=nvidia-375
    # Change KernelDriver=nvidia-384

    # save and run
    sudo service bumblebeed restart
    @@ -92,10 +80,10 @@ sudo nano /etc/modprobe.d/bumblebee.conf

    # Make the following section look like this (the drm line will be added):
    #375
    blacklist nvidia-375
    blacklist nvidia-375-drm
    blacklist nvidia-375-updates
    blacklist nvidia-experimental-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
  7. @whizzzkid whizzzkid revised this gist May 24, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -65,7 +65,7 @@ sudo powertop
    # 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=vendor acpi_osi=Linux acpi_osi=! acpi_osi="Windows 2009"'
    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.
  8. @whizzzkid whizzzkid revised this gist May 24, 2017. 1 changed file with 49 additions and 36 deletions.
    85 changes: 49 additions & 36 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -3,39 +3,44 @@
    # Install Intel Graphics Patch Firmwares (This should reboot your system):
    bash -c "$(curl -fsSL http://bit.ly/IGFWL-install)"

    # Update to 4.10 kernel all others might fail.
    # Update to 4.11.2 kernel. nvidia-375 compiles fine >=4.11.1
    cd /tmp
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10/linux-headers-4.10.0-041000_4.10.0-041000.201702191831_all.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10/linux-headers-4.10.0-041000-generic_4.10.0-041000.201702191831_amd64.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10/linux-image-4.10.0-041000-generic_4.10.0-041000.201702191831_amd64.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11.2/linux-headers-4.11.2-041102_4.11.2-041102.201705201036_all.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11.2/linux-headers-4.11.2-041102-generic_4.11.2-041102.201705201036_amd64.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11.2/linux-image-4.11.2-041102-generic_4.11.2-041102.201705201036_amd64.deb
    sudo dpkg -i *.deb

    # (This is optional for ML Folks) Install CUDA 8 (if you're interested in using gpu for ML) ~> requires nvidia stable drivers
    # 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
    cd ~/Downloads
    wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
    sudo dpkg -i cuda*.deb; sudo apt update; sudo apt install cuda
    # Update Path to have /usr/local/cuda/bin incase using dotfiles.

    # <optional> Install CuDNN for running things like tensorflow
    # if you get this message:
    # /sbin/ldconfig.real: /usr/lib/nvidia-375/libEGL.so.1 is not a symbolic link
    # /sbin/ldconfig.real: /usr/lib32/nvidia-375/libEGL.so.1 is not a symbolic link
    # Manually override using https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-375/+bug/1662860/comments/14

    # <optional for ML Folks> Install CuDNN for running things like tensorflow
    # Download cudnn from nvidia
    tar -xvzf cudnn-8.0-linux-x64-v6.0.tgz
    sudo cp -r cuda/* /usr/local/cuda/

    # Add Nvidia repository
    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt update

    # Install via ubuntu drivers
    sudo ubuntu-drivers autoinstall

    sudo rsync -K -a cuda/* /usr/local/cuda/

    # The version of prime-select is BS. Patch prime select like this
    cd /usr/bin
    sudo mv prime-select prime-select.bkup
    sudo wget https://raw.githubusercontent.com/C11235/nvidia-prime-bugfix/master/prime-select
    sudo chmod 755 prime-select
    sudo reboot now
    # Update: it's been fixed, just leaving here if something fails.
    # cd /usr/bin
    # sudo mv prime-select prime-select.bkup
    # sudo wget https://raw.githubusercontent.com/C11235/nvidia-prime-bugfix/master/prime-select
    # sudo chmod 755 prime-select
    # sudo reboot now

    # Testing cuda.
    $ sudo prime-select intel
    @@ -45,6 +50,10 @@ $ nvidia-smi
    $ 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
    @@ -65,29 +74,23 @@ sudo add-apt-repository ppa:bumblebee/testing
    sudo apt update
    sudo apt install bumblebee bumblebee-nvidia

    # Add yourself to the bumblebee usergroup so you can make changes to the videocard.
    sudo adduser $USER bumblebee

    # Enable bumblebee service
    sudo systemctl enable bumblebeed

    # now you need to load the right driver in bumblebee because it's an old piece of software which has not been updated in a whie
    # to know the nvidia driver currently loaded. Run:
    lsmod | grep nvidia

    # this should give you something like, nvidia-xxx
    # at the time of writing this, the latest is nvidia-378 but cuda 8 requires the stable, which is nvidia-375
    # 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 'Driver=' to 'Driver=nvidia'
    # Change all occurences of 'nvidia-current' to 'nvidia-xxx'
    # Change KernelDriver=nvidia-375

    # 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

    # add a new entry toward the end, with nvidia-xxx, in my case:
    # nvidia-375
    # Make the following section look like this (the drm line will be added):
    #375
    blacklist nvidia-375
    blacklist nvidia-375-drm
    @@ -103,6 +106,16 @@ sudo nano /etc/modules-load.d/modules.conf
    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

  9. @whizzzkid whizzzkid revised this gist May 17, 2017. 1 changed file with 2 additions and 10 deletions.
    12 changes: 2 additions & 10 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,7 @@
    # As of writing this, 4.11 kernel fails, 4.10.15 fails, 4.11rc8 seems to be working. Apply the graphics patches first.

    # Install KabyLake graphics patches
    cd /tmp;
    wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/kbldmcver101.tar.bz2;
    tar xjvf kbldmcver101.tar.bz2; cd kbl_dmc_ver1_01/; sudo ./install.sh

    cd /tmp;
    wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/kblgucver914.tar.gz;
    tar xvzf kblgucver914.tar.gz; cd firmware/kbl/guc/kbl_guc_ver/; sudo ./install.sh

    # You might need additional driver from here https://01.org/linuxgraphics/downloads/firmware linux kernel is messed up.
    # Install Intel Graphics Patch Firmwares (This should reboot your system):
    bash -c "$(curl -fsSL http://bit.ly/IGFWL-install)"

    # Update to 4.10 kernel all others might fail.
    cd /tmp
  10. @whizzzkid whizzzkid revised this gist May 15, 2017. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -11,11 +11,11 @@ tar xvzf kblgucver914.tar.gz; cd firmware/kbl/guc/kbl_guc_ver/; sudo ./install.s

    # You might need additional driver from here https://01.org/linuxgraphics/downloads/firmware linux kernel is messed up.

    # Update to 4.11rc8 kernel
    # Update to 4.10 kernel all others might fail.
    cd /tmp
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-headers-4.11.0-041100rc8_4.11.0-041100rc8.201704232131_all.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-headers-4.11.0-041100rc8-generic_4.11.0-041100rc8.201704232131_amd64.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-image-4.11.0-041100rc8-generic_4.11.0-041100rc8.201704232131_amd64.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10/linux-headers-4.10.0-041000_4.10.0-041000.201702191831_all.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10/linux-headers-4.10.0-041000-generic_4.10.0-041000.201702191831_amd64.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10/linux-image-4.10.0-041000-generic_4.10.0-041000.201702191831_amd64.deb
    sudo dpkg -i *.deb

    # (This is optional for ML Folks) Install CUDA 8 (if you're interested in using gpu for ML) ~> requires nvidia stable drivers
  11. @whizzzkid whizzzkid revised this gist May 13, 2017. 1 changed file with 9 additions and 8 deletions.
    17 changes: 9 additions & 8 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -18,14 +18,7 @@ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-headers-4.11.
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-image-4.11.0-041100rc8-generic_4.11.0-041100rc8.201704232131_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

    # Install CUDA 8 (if you're interested in using gpu for ML)
    # (This is 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
    cd ~/Downloads
    wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
    @@ -37,6 +30,14 @@ sudo dpkg -i cuda*.deb; sudo apt update; sudo apt install cuda
    tar -xvzf cudnn-8.0-linux-x64-v6.0.tgz
    sudo cp -r cuda/* /usr/local/cuda/

    # Add Nvidia repository
    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt update

    # Install via ubuntu drivers
    sudo ubuntu-drivers autoinstall


    # The version of prime-select is BS. Patch prime select like this
    cd /usr/bin
    sudo mv prime-select prime-select.bkup
  12. @whizzzkid whizzzkid revised this gist May 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -39,7 +39,7 @@ sudo cp -r cuda/* /usr/local/cuda/

    # The version of prime-select is BS. Patch prime select like this
    cd /usr/bin
    mv prime-select prime-select.bkup
    sudo mv prime-select prime-select.bkup
    sudo wget https://raw.githubusercontent.com/C11235/nvidia-prime-bugfix/master/prime-select
    sudo chmod 755 prime-select
    sudo reboot now
  13. @whizzzkid whizzzkid revised this gist May 13, 2017. 1 changed file with 10 additions and 6 deletions.
    16 changes: 10 additions & 6 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,4 @@
    # Update to 4.11rc8 kernel
    cd /tmp
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-headers-4.11.0-041100rc8_4.11.0-041100rc8.201704232131_all.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-headers-4.11.0-041100rc8-generic_4.11.0-041100rc8.201704232131_amd64.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-image-4.11.0-041100rc8-generic_4.11.0-041100rc8.201704232131_amd64.deb
    sudo dpkg -i *.deb
    # As of writing this, 4.11 kernel fails, 4.10.15 fails, 4.11rc8 seems to be working. Apply the graphics patches first.

    # Install KabyLake graphics patches
    cd /tmp;
    @@ -14,6 +9,15 @@ cd /tmp;
    wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/kblgucver914.tar.gz;
    tar xvzf kblgucver914.tar.gz; cd firmware/kbl/guc/kbl_guc_ver/; sudo ./install.sh

    # You might need additional driver from here https://01.org/linuxgraphics/downloads/firmware linux kernel is messed up.

    # Update to 4.11rc8 kernel
    cd /tmp
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-headers-4.11.0-041100rc8_4.11.0-041100rc8.201704232131_all.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-headers-4.11.0-041100rc8-generic_4.11.0-041100rc8.201704232131_amd64.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-image-4.11.0-041100rc8-generic_4.11.0-041100rc8.201704232131_amd64.deb
    sudo dpkg -i *.deb

    # Add Nvidia repository
    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt update
  14. @whizzzkid whizzzkid revised this gist May 13, 2017. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,9 @@
    # Update to 4.9 kernel do not delete the old kernel as it will be your failsafe if something happens to this one
    # Update to 4.11rc8 kernel
    cd /tmp
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-headers-4.11.0-041100rc8_4.11.0-041100rc8.201704232131_all.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-headers-4.11.0-041100rc8-generic_4.11.0-041100rc8.201704232131_amd64.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11-rc8/linux-image-4.11.0-041100rc8-generic_4.11.0-041100rc8.201704232131_amd64.deb
    sudo dpkg -i *.deb

    # Install KabyLake graphics patches
    cd /tmp;
  15. @whizzzkid whizzzkid revised this gist Apr 27, 2017. No changes.
  16. @whizzzkid whizzzkid revised this gist Apr 5, 2017. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -21,6 +21,12 @@ sudo ubuntu-drivers autoinstall
    cd ~/Downloads
    wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
    sudo dpkg -i cuda*.deb; sudo apt update; sudo apt install cuda
    # Update Path to have /usr/local/cuda/bin incase using dotfiles.

    # <optional> Install CuDNN for running things like tensorflow
    # Download cudnn from nvidia
    tar -xvzf cudnn-8.0-linux-x64-v6.0.tgz
    sudo cp -r cuda/* /usr/local/cuda/

    # The version of prime-select is BS. Patch prime select like this
    cd /usr/bin
  17. @whizzzkid whizzzkid revised this gist Feb 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -48,7 +48,7 @@ sudo powertop
    # Add command line params:
    sudo nano /etc/default/grub
    # Make the following look like this, do not ask why.
    GRUB_CMDLINE_LINUX_DEFAULT='i915.preliminary_hw_support=1 pcie_port_pm=off acpi_backlight=vendor acpi_osi=Linux acpi_osi=! acpi_osi="Windows 2009"'
    GRUB_CMDLINE_LINUX_DEFAULT='pcie_port_pm=off acpi_backlight=vendor 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.
  18. @whizzzkid whizzzkid revised this gist Feb 22, 2017. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -124,7 +124,14 @@ Mon Feb 20 21:51:18 2017

    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
  19. @whizzzkid whizzzkid revised this gist Feb 21, 2017. 1 changed file with 28 additions and 3 deletions.
    31 changes: 28 additions & 3 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -48,8 +48,7 @@ sudo powertop
    # Add command line params:
    sudo nano /etc/default/grub
    # Make the following look like this, do not ask why.
    GRUB_CMDLINE_LINUX_DEFAULT='i915.edp_vswing=2 i915.preliminary_hw_support=1 intel_idle.max_cstate=1 pcie_port_pm=off acpi_backlight=vendor acpi_osi=Linux acpi_osi=! acpi_osi="Windows 2009"'
    i915.edp_vswing=2 i915.preliminary_hw_support=1 intel_idle.max_cstate=1 acpi_backlight=vendor acpi_osi=Linux acpi_osi=! acpi_osi="Windows 2009"'
    GRUB_CMDLINE_LINUX_DEFAULT='i915.preliminary_hw_support=1 pcie_port_pm=off acpi_backlight=vendor 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.
    @@ -99,7 +98,33 @@ bbswitch
    # 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

    # Helpful links:
    # 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:
    Mon Feb 20 21:51:18 2017
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 375.39 Driver Version: 375.39 |
    |-------------------------------+----------------------+----------------------+
    | 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 | 0000:01:00.0 Off | N/A |
    | N/A 41C P3 N/A / N/A | 6MiB / 4041MiB | 0% Default |
    +-------------------------------+----------------------+----------------------+

    +-----------------------------------------------------------------------------+
    | Processes: GPU Memory |
    | GPU PID Type Process name Usage |
    |=============================================================================|
    | 0 3351 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

    # Other Helpful links:
    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
  20. @whizzzkid whizzzkid revised this gist Feb 21, 2017. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -97,4 +97,10 @@ i915
    bbswitch

    # 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
    # Run powertop to see if battery consumption is in check: 10w +/- 5W

    # Helpful links:
    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
  21. @whizzzkid whizzzkid revised this gist Feb 21, 2017. 1 changed file with 64 additions and 9 deletions.
    73 changes: 64 additions & 9 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Update to 4.9 kernel
    # Update to 4.9 kernel do not delete the old kernel as it will be your failsafe if something happens to this one

    # Install KabyLake graphics patches
    cd /tmp;
    @@ -9,20 +9,20 @@ cd /tmp;
    wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/kblgucver914.tar.gz;
    tar xvzf kblgucver914.tar.gz; cd firmware/kbl/guc/kbl_guc_ver/; sudo ./install.sh

    # Add repository
    # Add Nvidia repository
    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt update

    # Install via ubuntu drivers
    sudo ubuntu-drivers autoinstall

    # Install CUDA 8
    # This acts as repo so install it somewhere safe
    # Install CUDA 8 (if you're interested in using gpu for ML)
    # This acts as repo so install it somewhere safe and do not delete
    cd ~/Downloads
    wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
    sudo dpkg -i cuda*.deb; sudo apt update; sudo apt install cuda

    # Patch prime select
    # The version of prime-select is BS. Patch prime select like this
    cd /usr/bin
    mv prime-select prime-select.bkup
    sudo wget https://raw.githubusercontent.com/C11235/nvidia-prime-bugfix/master/prime-select
    @@ -32,14 +32,69 @@ sudo reboot now
    # Testing cuda.
    $ sudo prime-select intel
    $ nvidia-smi
    # no drivers found

    # This should give an error, no drivers found
    # Try this
    $ sudo prime-select nvidia
    # displays info.
    # displays CUDA info.

    # 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='i915.edp_vswing=2 i915.preliminary_hw_support=1 intel_idle.max_cstate=1 pcie_port_pm=off acpi_backlight=vendor acpi_osi=Linux acpi_osi=! acpi_osi="Windows 2009"'
    i915.edp_vswing=2 i915.preliminary_hw_support=1 intel_idle.max_cstate=1 acpi_backlight=vendor 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

    # Add yourself to the bumblebee usergroup so you can make changes to the videocard.
    sudo adduser $USER bumblebee

    # Enable bumblebee service
    sudo systemctl enable bumblebeed

    # now you need to load the right driver in bumblebee because it's an old piece of software which has not been updated in a whie
    # to know the nvidia driver currently loaded. Run:
    lsmod | grep nvidia

    # this should give you something like, nvidia-xxx
    # at the time of writing this, the latest is nvidia-378 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'

    # 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

    # add a new entry toward the end, with nvidia-xxx, in my case:
    # nvidia-375
    #375
    blacklist nvidia-375
    blacklist nvidia-375-drm
    blacklist nvidia-375-updates
    blacklist nvidia-experimental-375

    # 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

    # Install bumblebee
    # 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
  22. @whizzzkid whizzzkid revised this gist Feb 21, 2017. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ sudo ubuntu-drivers autoinstall
    # This acts as repo so install it somewhere safe
    cd ~/Downloads
    wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
    sudo apt update; sudo apt install cuda
    sudo dpkg -i cuda*.deb; sudo apt update; sudo apt install cuda

    # Patch prime select
    cd /usr/bin
    @@ -33,7 +33,13 @@ sudo reboot now
    $ sudo prime-select intel
    $ nvidia-smi
    # no drivers found

    $ sudo prime-select nvidia
    # displays info.

    # Install powertop and tlp

    # Add command line params:
    i915.edp_vswing=2 i915.preliminary_hw_support=1 intel_idle.max_cstate=1 acpi_backlight=vendor acpi_osi=Linux acpi_osi=! acpi_osi="Windows 2009"'

    # Install bumblebee
  23. @whizzzkid whizzzkid created this gist Feb 20, 2017.
    39 changes: 39 additions & 0 deletions XPS-15 9560 Getting Nvidia To Work on KDE Neon
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    # Update to 4.9 kernel

    # Install KabyLake graphics patches
    cd /tmp;
    wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/kbldmcver101.tar.bz2;
    tar xjvf kbldmcver101.tar.bz2; cd kbl_dmc_ver1_01/; sudo ./install.sh

    cd /tmp;
    wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/kblgucver914.tar.gz;
    tar xvzf kblgucver914.tar.gz; cd firmware/kbl/guc/kbl_guc_ver/; sudo ./install.sh

    # Add repository
    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt update

    # Install via ubuntu drivers
    sudo ubuntu-drivers autoinstall

    # Install CUDA 8
    # This acts as repo so install it somewhere safe
    cd ~/Downloads
    wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
    sudo apt update; sudo apt install cuda

    # Patch prime select
    cd /usr/bin
    mv prime-select prime-select.bkup
    sudo wget https://raw.githubusercontent.com/C11235/nvidia-prime-bugfix/master/prime-select
    sudo chmod 755 prime-select
    sudo reboot now

    # Testing cuda.
    $ sudo prime-select intel
    $ nvidia-smi
    # no drivers found
    $ sudo prime-select nvidia
    # displays info.

    # Install powertop and tlp