Page MenuHomeSolus

Cuda not available in Blender
Closed, WontfixPublic

Description

Upon installing Blender the only option available is to use the CPU, not having the option to use Cuda instead.

Event Timeline

theSoenke added a subtask: T354: CUDA.
theSoenke added a subscriber: theSoenke.

CUDA is not available as package yet. As far as i know blender also works with OpenCL. But if you want CUDA you could try to use their installer

OpenCL is not as mature as CUDA in Blender, still has a few issues.

DataDrake triaged this task as Wishlist priority.Sep 15 2016, 6:25 PM

Prior information (https://plus.google.com/+Solus-Project/posts/HZq9fjHEWgJ) made it sound as if CUDA was included as part of the packaged Nvidia drivers. It sounds like that is no longer correct. Will someone be kind enough to confirm that so I know whether this is the end of the road for solving my Blender GPU issue?

Hi,

Let me tell my findings with CUDA in Blender and Solus to see if we can find a solution for this all together. :-) Note : CAUTION! most of this post are assumptions and non related information until all the pieces make enough sense to have CUDA working ok in Blender under Solus.

I could configure CUDA in blender, but it seems I'm not able to make the setting remain. I loose the configuration every time I reboot.

I have a NVidia GTX 1060. If I recall correctly, I remember reading somewhere that this card is not supported in blender until version 2.78c. This arises several questions:

  • How is blender (or other packages) provided in Solus? Solus Blender is currently at 2.78b. The update of a package already provided is automatically done or do we need to ask for it?
  • Is the Blender package provided by Solus already compiled with CUDA options? If I recall correctly this is a compilation option, so blender can be compiled with CUDA support or not.

For the test I used the official Blender 2.78c provided by blender.org.

It seems I had to install nvidia-modprobe in order to help Blender detect my CUDA device. I did this when testing with 2.78b, before knowing that 2.78c was needed for my card, so nothing worked until I moved to 2.78c because of the GTX 1060. So it would be appreciated to investigate if nvidia-modprobe is really needed or not. I have not tested to remove it. At first I though that this was going to be provided by the driver, but it seems this is not the case. So, maybe, on other distributions this is provided by the nvidia package of the distribution (just guessing here...). I installed nvidia-modprobe from sources (ftp://download.nvidia.com/XFree86/nvidia-modprobe/). In my case, version 375.39, same version as my nvidia driver:

  • make
  • sudo make install

After this I though my CUDA card was going to be detected just starting Blender, but this is not true. I need to start blender with sudo:

  • sudo ./blender

If I do this, blender detects my CUDA device!!!! If I save the preferences and shutdown blender and start it again without sudo, the card is still configured as my Cycles Compute Device. I save the preferences again and I can stop and start blender and CUDA is still working.

I read this trick somewhere... sorry... can't find the source now... but it seems to work... what I still don't know is if this need is due to Blender or Solus. People using Blender in other Linux distributions with CUDA support need to do this?

Rebooting the system breaks the configuration. If I try to start blender I get this error message: "CUDA cuInit: Unknown error". I need to repeat the "sudo ./blender" trick again to be able to enable it.

Do you think we are close to make this work?

  1. Blender is updated when we update it. Sometimes people let us know, sometimes they supply patches for the existing package for us to apply, and still other times we notice that there is an update and do it then.
  2. Blender must be compiled against CUDA libraries in order for it to be enabled. We have not yet done this because NVIDIA doesn't make the source available and repackaging the binaries is not trivial.
  3. I am unsure what nvidia-modprobe accomplishes here, but it probably needed by CUDA itself.
  4. The reason you have to run blender as sudo is that you do not have permissions to the CUDA device as a normal user by default. This needs to be handled by udev rules (iirc) which would set global r/w to the device. I suspect that when you run blender as sudo it is changing these permissions. However any changes to device permissions will not persist through a reboot without the udev rules to set them.

As it stands, support for CUDA will require:

  • Repackaging the CUDA kernel drivers for the specific nvidia driver packages in Solus
    • Creating udev rules to set device permissions for access to CUDA devices as a normal user.
  • Repackaging the CUDA libraries and headers for Solus
  • Rebuilding applications like blender against these CUDA libraries

Thanks DataDrake.

Thanks to twitter, I saw that solus is doing some introductory sessions to Solus packaging. I hope to be able to help in the future providing blender updates.

Looking at the nvidia-modprobe source code I found this notice:

/*
 * This is a small setuid utility for loading the NVIDIA kernel module
 * and creating NVIDIA device files.  Different Linux distributions
 * handle automatic module loading and device file creation in
 * different ways.  When the NVIDIA driver is packaged for a specific
 * distribution, it is recommended to use distribution-specific management
 * of module loading and device file creation rather than this utility.
 *
 * This utility makes sure, in a distribution-independent way, that
 * the kernel module is loaded and the device files created on behalf
 * of user-space NVIDIA driver components who run without sufficient
 * privileges (e.g., the CUDA driver run within the permissions of a
 * non-privileged user).
 */

So it seems it should not be needed once the stages for CUDA support you describe are done. I will keep it for now and will try to understand what is happening with the devices and udev rules. This will help to understand what CUDA toolkit does/needs. Once this is more or less clear, or gives enough clues, I will remove it and will try to help on the other parts. The only thing I can see now (testing at the time of writing this) is that before running "sudo ./blender" the only nvidia devices available in my system are:

  • /dev/nvidia0
  • /dev/nvidiactl
  • /dev/nvidia-modeset

and after executing "sudo ./blender", two new devices appear:

  • /dev/nvidia-uvm
  • /dev/nvidia-uvm-tools

FYI another option is to use nvidia-docker and there are plenty of images with cuda/cudnn/tensorflow/keras/etc ready. I've requested the package here https://dev.solus-project.com/T3641

The problem is in compilation of blender from the solus repository, because without touching any nvidia and manually downloading the blender from blender.org and trying it now can detect my cuda without problems.

violentmagician raised the priority of this task from Wishlist to Normal.Jul 4 2018, 7:04 AM
sunnyflunk lowered the priority of this task from Normal to Wishlist.Jul 4 2018, 7:37 AM
sunnyflunk added a subscriber: sunnyflunk.

Please do not change priority if you are not part of the triage team

I am not even sure how this happened. I was searching for and trying to update a different package.

I don't think we will ever be able to fix this unless the redistribution terms of CUDA become reasonable. The EULA was still a mess last I looked.