You are not logged in.

#1 2017-07-18 23:23:52

Registered: 2015-08-20
Posts: 6,488

HowTo get Blender Cycles GPU rendering on Debian 9, with Nvidia

HowTo get Blender Cycles GPU rendering on Debian 9

You need:

  • Nvidia graphics card (the bigger the better!)

  • Blender (see below for the easy way)


For machines with Nvidia-only graphics

The default nouveau driver works pretty well, except Blender Cycles can't use it!
Installing the nvidia driver seems to be much easier on Debian 9, and I didn't have to jump through hoops, as descibed in HowTo: Install NVIDIA.

For older cards you may need to specify a driver, but that card is unlikely to support CUDA. CUDA-supported gpus.
You can find which one is needed by installing and running nvidia-detect:

sudo apt-get install nvidia-detect

For most systems, this should do the job:

sudo apt-get install nvidia-driver

Don't run nvidia-xconfig, or create an xorg.conf!

Reboot to blacklist the nouveau driver.

Get Blender and the CUDA lib as described below.

If you have an Optimus laptop, with discrete graphics

DISCLAIMER: This was done on a fresh Helium development install, and seems to be much simpler than the recommended methods.

BunsenLabs help links:
Newer Graphics Hardware in BunsenLabs
HowTo: Install NVIDIA
Official Debian links:
Debian HowTo: NvidiaGraphicsDrivers
Debian: NvidiaGraphicsDrivers Optimus

I have always had great trouble with the recommended Debian methods of installing and configuring Bumblebee/Optimus, so I tried with a method based on this HowTo: Install and configure Nvidia Optimus with bumblebee in Debian
My hardware is an Optimus laptop, with:  NVIDIA Corporation GM204M [GeForce GTX 970M], Intel Corporation Skylake

  1. Get packages

    sudo apt-get install gcc make linux-headers-amd64
    sudo apt-get install dkms bbswitch-dkms
  2. Load the bbswitch module

    sudo modprobe bbswitch load_state=0

    The bbswitch module is loaded automatically at every power up and turns off the discrete nvidia optimus GPU, no need to load it manually. Test the state with

    cat /proc/acpi/bbswitch
  3. Install nvidia and bumblebee, and required packages

    This will install non-free nvidia drivers, nvidia kernel driver, nvidia specific OpenGL library etc. and other dependencies, and bumblebee and friends:

    sudo apt-get install nvidia-kernel-dkms nvidia-xconfig nvidia-settings
    sudo apt-get install bumblebee-nvidia

    You should have been added to the bumblebee group, but if not

    sudo adduser $USER bumblebee
  4. VirtualGL
    If you want VirtualGL capability for VNC and other thin client environments, it isn't currently available from Debian.
    However you can install VirtualGL from<deb>
    (I used virtualgl_2.5.2_amd64.deb, which gdebi said was OK to install)

    sudo dpkg -i virtualgl_2.5.2_amd64.deb
  5. Now reboot to blacklist the nouveau driver

Running applications with discrete graphics

optirun is what is used to run an application with discrete graphics:

optirun glxgears -info

Test and see the difference (I doubt this output is meaningful, but it is good for the soul smile )

Without bumblebee and VirtualGL...

damo@helium-dev2:~$ glxgears -info
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
GL_RENDERER   = Mesa DRI Intel(R) HD Graphics 530 (Skylake GT2) 
GL_VERSION    = 3.0 Mesa 13.0.6
GL_VENDOR     = Intel Open Source Technology Center
460 frames in 5.0 seconds = 91.909 FPS
301 frames in 5.0 seconds = 60.023 FPS
301 frames in 5.0 seconds = 60.019 FPS
301 frames in 5.0 seconds = 60.021 FPS
301 frames in 5.0 seconds = 60.021 FPS
301 frames in 5.0 seconds = 60.019 FPS

...and with...

damo@helium-dev2:~$ optirun glxgears -info
GL_VERSION    = 4.5.0 NVIDIA 375.66
GL_VENDOR     = NVIDIA Corporation
14606 frames in 5.0 seconds = 2921.047 FPS
14532 frames in 5.0 seconds = 2906.259 FPS
14803 frames in 5.0 seconds = 2960.591 FPS
15092 frames in 5.0 seconds = 3018.390 FPS
15162 frames in 5.0 seconds = 3032.399 FPS

NB nvidia-settings will be useless, unless you can disable the integrated graphics in the BIOS....and then you won't need bumblebee, I assume.

Get Blender to use GPU Cycles rendering

You can install Blender from the repos, but to get Cycles GPU rendering going you need the nvidia-cuda-toolkit, which is a monster 2GB download!
There is a much easier way though: get the portable version direct from This contains the necessary CUDA libraries, without all the unneeded bloat. (Bear in mind that the Blender in Stable will fall a long way behind the current release, which is why I have always used the latest portable version, with the bugfixes and extra goodies).

I downloaded blender-2.78c-linux-glibc219-x86_64.tar.bz2 and unzipped it. (Select the version you need from the site).

tar xf blender-2.78c-linux-glibc219-x86_64.tar.bz2 

The Blender executable in this case is ~/blender-2.78c-linux-glibc219-x86_64/blender, which can be run as is, but with only CPU rendering until it is configured.

There have been recent issues with CUDA builds for Debian, which is maybe why I also need to install another library, (found by trial and error!):

sudo apt-get install libcuda1


Blender configuration

Next thing is to start blender with optirun, and tweak the settings:

optirun ~/path/to/blender

In Blender's User Settings -> System, "CUDA" will have appeared in the "Cycles Compute Device" area, and you can now select your GPU. (Don't forget to Save User Settings!).
Back in the main window, the Render tab will also allow toggling between CPU/GPU Device. (This is often necessary for big renders when you run out of memory sad )

TIP: Blender can do background rendering on the commandline, which is slightly faster. It could make a big difference if you are rendering animations.

Last edited by damo (2017-07-19 10:45:07)

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt


#2 2017-07-19 13:22:08

Middle Office
Registered: 2015-09-29
Posts: 2,178

Re: HowTo get Blender Cycles GPU rendering on Debian 9, with Nvidia

Thanks, this will come handy.


Board footer

Powered by FluxBB