flathub / org.blender.Blender

https://flathub.org/apps/details/org.blender.Blender
18 stars 26 forks source link

There's no CUDA rendering support #8

Closed cpba closed 3 years ago

cpba commented 6 years ago

How to reproduce:

  1. Run blender.
  2. Hit ctrl+alt+u to open the user settings window.
  3. Click on system tab.

Expected result:

Cuda capable hardware should be listed under under "Cycles Compute Device".

Actual result:

None are shown.

Requested strace:

close(18)                               = 0
open("/lib/tls/x86_64/libcuda.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/tls/x86_64", 0x7ffd7cbcb600) = -1 ENOENT (No such file or directory)
open("/lib/tls/libcuda.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/tls", 0x7ffd7cbcb600)        = -1 ENOENT (No such file or directory)
open("/lib/x86_64/libcuda.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64", 0x7ffd7cbcb600)     = -1 ENOENT (No such file or directory)
open("/lib/libcuda.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib", {st_mode=S_IFDIR|0755, st_size=50380, ...}) = 0
open("/usr/lib/tls/x86_64/libcuda.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/tls/x86_64", 0x7ffd7cbcb600) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/libcuda.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/tls", 0x7ffd7cbcb600)    = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64/libcuda.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64", 0x7ffd7cbcb600) = -1 ENOENT (No such file or directory)
open("/usr/lib/libcuda.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib", {st_mode=S_IFDIR|0755, st_size=50380, ...}) = 0
munmap(0x7fa95c0d4000, 74898)           = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 18
fstat(18, {st_mode=S_IFREG|0600, st_size=74898, ...}) = 0
mmap(NULL, 74898, PROT_READ, MAP_PRIVATE, 18, 0) = 0x7fa95c0d4000
close(18)                               = 0
open("/lib/libnvrtc.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/libnvrtc.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
munmap(0x7fa95c0d4000, 74898)           = 0
open("/usr/local/cuda/lib64/libnvrtc.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
gettid()                                = 5
write(2, "I0206 19:08:26.127634     5 device_cuda.cpp:2113] CUEW initialization failed: Error opening the library\n", 104) = 104
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 18
fstat(18, {st_mode=S_IFREG|0600, st_size=74898, ...}) = 0
mmap(NULL, 74898, PROT_READ, MAP_PRIVATE, 18, 0) = 0x7fa95c0d4000
close(18)                               = 0

I tested the official tarball build from the blender website, that one works fine.

TingPing commented 6 years ago

The nvidia driver contains libcuda.so.1: https://github.com/flatpak/freedesktop-sdk-images/blob/nvidia-drivers/nvidia-apply-extra.c#L369

We could add an unversioned one though I'd honestly say Blender should never be using that one.

TingPing commented 6 years ago

A symlink to libnvrtc probably needs to be added there too.

bochecha commented 6 years ago

So Blender has this code:

/* Implementation function. */
int cuewInit(void) {
  /* Library paths. */
#ifdef _WIN32
  /* Expected in c:/windows/system or similar, no path needed. */
  const char *cuda_paths[] = {"nvcuda.dll", NULL};
  const char *nvrtc_paths[] = {"nvrtc.dll", NULL};
#elif defined(__APPLE__)
  /* Default installation path. */
  const char *cuda_paths[] = {"/usr/local/cuda/lib/libcuda.dylib", NULL};
  const char *nvrtc_paths[] = {"/usr/local/cuda/lib/libnvrtc.dylib", NULL};
#else
  const char *cuda_paths[] = {"libcuda.so", NULL};
  const char *nvrtc_paths[] = {"libnvrtc.so",
#  if defined(__x86_64__) || defined(_M_X64)
                               "/usr/local/cuda/lib64/libnvrtc.so",
#else
                               "/usr/local/cuda/lib/libnvrtc.so",
#endif
                               NULL};
#endif
…

  /* Load library. */
  cuda_lib = dynamic_library_open_find(cuda_paths);
  nvrtc_lib = dynamic_library_open_find(nvrtc_paths);

…

I guess I could just patch it to load libcuda.so.1 instead (and the same for libnvrtc), but I'd rather have this a proper upstream change instead if at all possible…

@brechtvl hi there! Do you have any thoughts on this issue? 🙂

brechtvl commented 6 years ago

I've submitted a patch to fix this in Blender now.

We do intentionally try using libcuda.so and libnvrtc.so without the version first, to work with CUDA toolkit installs which don't quite use typical Linux library versioning. libnvrtc.so is also not part of the driver, only the CUDA toolkit.

bochecha commented 6 years ago

Thanks @brechtvl !

I'm not sure I understand what you mean with "libnvrtc.so is also not part of the driver, only the CUDA toolkit.". Your patches don't do anything to libnvrtc, only libcuda… is it not needed as well?

brechtvl commented 6 years ago

We don't actually use libnvrtc in Blender at runtime, so this doesn't really matter, but the reason we don't use a versioned file name there is as follows.

The CUDA toolkit I have installed has libnvrtc.so, libnvrtc.so.9.0 and libnvrtc.so.9.0.176. But we also want to work with 8.0, 9.1 and 10.0 in the future. These files don't seem to follow typical Linux library versioning, as they remain compatible with major version changes and switch often enough that we want CUDA to work also when a user has installed a future CUDA toolkit version.

bochecha commented 6 years ago

I just pushed a build which integrates @brechtvl's patch. Thanks for that!

@cpba Once this build is finished, can you flatpak update and then try again with it? I don't have Nvidia hardware to test this.

cpba commented 6 years ago

@bochecha I just updated and tested, the problem persists.

I can't see anything at that buildbot url, is it possible that the build hasn't finished yet?

TingPing commented 6 years ago

This build succeeded: https://flathub.org/builds/#/builders/1/builds/2177

bochecha commented 6 years ago

@cpba There was an issue with the build at the link I gave. It was then restarted, and succeeded (that's the link @TingPing gave).

Can you run a quick flatpak update just to be sure you really have the latest Blender?

Also, can you run that strace again and paste the output, to see what happens now?

cpba commented 6 years ago

@bochecha as far as I can tell I have the latest version available on flathub, running flatpak update doesn't bring up anything new. Is there a better way to check?

Terminal output from running blender with --debug-all:

wm_window_make_drawable: set drawable 1
wm_window_make_drawable: set drawable 2
I0220 20:04:35.545511     6 device_cuda.cpp:2096] CUEW initialization succeeded which: no nvcc in (/app/bin:/usr/bin:/home/carles/android-sdk/tools:/home/carles/android-sdk/platform-tools)
I0220 20:04:35.553834     6 device_cuda.cpp:2107] Neither precompiled kernels nor CUDA compiler wad found, unable to use CUDA
I0220 20:04:35.554838     6 device_opencl.cpp:58] CLEW initialization succeeded.
I0220 20:04:35.554978     6 opencl_util.cpp:760] Error fetching platforms:CL_PLATFORM_NOT_FOUND_KHR

strace output, not sure if this is the relevant part, I can share the full file if necessary:

close(19)                               = 0
open("/lib/tls/x86_64/libcuda.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/tls/x86_64", 0x7ffe68cb4390) = -1 ENOENT (No such file or directory)
open("/lib/tls/libcuda.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/tls", 0x7ffe68cb4390)        = -1 ENOENT (No such file or directory)
open("/lib/x86_64/libcuda.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64", 0x7ffe68cb4390)     = -1 ENOENT (No such file or directory)
open("/lib/libcuda.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib", {st_mode=S_IFDIR|0755, st_size=50468, ...}) = 0
open("/usr/lib/libcuda.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
munmap(0x7fc9ee0a2000, 76752)           = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 19
fstat(19, {st_mode=S_IFREG|0600, st_size=76752, ...}) = 0
mmap(NULL, 76752, PROT_READ, MAP_PRIVATE, 19, 0) = 0x7fc9ee0a2000
close(19)                               = 0
open("/usr/lib/GL/nvidia-390-25/lib/libcuda.so.1", O_RDONLY|O_CLOEXEC) = 19
read(19, "\177ELF\2\1\1\0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0\0\0\0\0\0\0\0\0\0\0\333\0\0\0\0\0\0\0\16\1\0\0\0\0\0\0}\2\0\0\0\0\0\0~\2\0\0(\0\0\0`\1\0\0.\2\0\0\0\0\0\0B\1\0\0(\2\0\0\0\0\0\0\361\0\0\0a\0\0\0\0\0\0\0\366\1\0\0\334\0\0\0\330\1\0\0\0\0\0\0\361\1\0\0\253\1\0\0\366\0\0\0\f\2\0\0008\0\0\0\236\1\0\0O\2\0\0\0\0\0\0)\2\0\0\346\1\0\0i\0\0\0\n\2\0\0\377\0\0\0\350\0\0\0F\0\0\0\204\2\0\0;\2\0\0007\0\0\0\0\0\0\0\326\1\0\0\177\2\0\0005\2\0\0\0\0\0\0\0\0\0\0c\1\0\0\203\2\0\0#\2\0\0\30\2\0\0\272\1\0\0\200\2\0\0\0\0\0\0\0\0\0\0\37\2\0\0?\0\0\0\0\0\0\0T\1\0\0-\2\0\0\0\0\0\0\r\1\0\0z\1\0\0\0\0\0\0\233\1\0\0N\2\0\0!\2\0\0\234\1\0\0y\1\0\0\370\1\0\0\0\0\0\0\312\0\0\0", 832) = 832
fstat(19, {st_mode=S_IFREG|0755, st_size=10032952, ...}) = 0
mmap(NULL, 12188184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 19, 0) = 0x7fc9e4340000
mprotect(0x7fc9e4b81000, 2097152, PROT_NONE) = 0
mmap(0x7fc9e4d81000, 1380352, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 19, 0x841000) = 0x7fc9e4d81000
mmap(0x7fc9e4ed2000, 55832, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc9e4ed2000
close(19)                               = 0
open("/usr/lib/GL/nvidia-390-25/lib/libnvidia-fatbinaryloader.so.390.25", O_RDONLY|O_CLOEXEC) = 19
read(19, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200Y\0\0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0K\0\0\0\267\0\0\0g\0\0\0\270\0\0\0\0\0\0\0I\0\0\0p\0\0\0\266\0\0\0\0\0\0\0q\0\0\0,\0\0\0\251\0\0\0Y\0\0\0\221\0\0\0\10\0\0\0\0\0\0\0\0\0\0\0N\0\0\0\0\0\0\0\217\0\0\0\21\0\0\0007\0\0\0\223\0\0\0\31\0\0\0>\0\0\0\200\0\0\0\0\0\0\0S\0\0\0Q\0\0\0\260\0\0\0\0\0\0\0;\0\0\0:\0\0\0\22\0\0\0\0\0\0\0\23\0\0\0\252\0\0\0\246\0\0\0\0\0\0\0\211\0\0\0i\0\0\0R\0\0\0\261\0\0\0\212\0\0\0\0\0\0\0|\0\0\0\265\0\0\0\264\0\0\0\253\0\0\0\244\0\0\0\247\0\0\0\220\0\0\0y\0\0\0n\0\0\0\30\0\0\0\262\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0l\0\0\0~\0\0\0'\0\0\0\213\0\0\0x\0\0\0\0\0\0\0\0\0\0\0\263\0\0\0", 832) = 832
fstat(19, {st_mode=S_IFREG|0755, st_size=291624, ...}) = 0
mmap(NULL, 2408072, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 19, 0) = 0x7fc9eb836000
mprotect(0x7fc9eb873000, 2093056, PROT_NONE) = 0
mmap(0x7fc9eba72000, 45056, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 19, 0x3c000) = 0x7fc9eba72000
mmap(0x7fc9eba7d000, 20104, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc9eba7d000
close(19)                               = 0
sched_get_priority_max(SCHED_RR)        = 99
sched_get_priority_min(SCHED_RR)        = 1
munmap(0x7fc9ee0a2000, 76752)           = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 19
fstat(19, {st_mode=S_IFREG|0600, st_size=76752, ...}) = 0
mmap(NULL, 76752, PROT_READ, MAP_PRIVATE, 19, 0) = 0x7fc9ee0a2000
close(19)                               = 0
open("/lib/libnvrtc.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/libnvrtc.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
munmap(0x7fc9ee0a2000, 76752)           = 0
open("/usr/local/cuda/lib64/libnvrtc.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
gettid()                                = 6
write(2, "I0220 20:04:35.545511     6 device_cuda.cpp:2096] CUEW initialization succeeded\n", 80) = 80
stat("/app/share/blender/2.79/scripts/addons/cycles/lib", 0x7ffe68cb4ce0) = -1 ENOENT (No such file or directory)
stat("/Developer/NVIDIA/CUDA-5.0/bin/nvcc", 0x7ffe68cb3d50) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-5.0/bin/nvcc", 0x7ffe68cb3d50) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda/bin/nvcc", 0x7ffe68cb3d50) = -1 ENOENT (No such file or directory)
stat("/Developer/NVIDIA/CUDA-6.0/bin/nvcc", 0x7ffe68cb3d50) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-6.0/bin/nvcc", 0x7ffe68cb3d50) = -1 ENOENT (No such file or directory)
stat("/Developer/NVIDIA/CUDA-5.5/bin/nvcc", 0x7ffe68cb3d50) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-5.5/bin/nvcc", 0x7ffe68cb3d50) = -1 ENOENT (No such file or directory)
pipe2([19, 20], O_CLOEXEC)              = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fc9fc6dc290) = 18
close(20)                               = 0
fcntl(19, F_SETFD, 0)                   = 0
fstat(19, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
read(19, "", 4096)                      = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=18, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
close(19)                               = 0
wait4(18, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 18
gettid()                                = 6
write(2, "I0220 20:04:35.553834     6 device_cuda.cpp:2107] Neither precompiled kernels nor CUDA compiler wad found, unable to use CUDA\n", 126) = 126
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 19
fstat(19, {st_mode=S_IFREG|0600, st_size=76752, ...}) = 0
mmap(NULL, 76752, PROT_READ, MAP_PRIVATE, 19, 0) = 0x7fc9ee0a2000
close(19)                               = 0
open("/lib/libOpenCL.so", O_RDONLY|O_CLOEXEC) = 19
brechtvl commented 6 years ago

You'll need to install the CUDA toolkit to compile the CUDA binaries at runtime. Or the flatpak could be built with WITH_CYCLES_CUDA_BINARIES=ON, and then that would need the CUDA toolkit to build.

bochecha commented 6 years ago

Thank you @brechtvl for chiming in once more and helping. :slightly_smiling_face:

You'll need to install the CUDA toolkit to compile the CUDA binaries at runtime

You mean when building Blender?

Oh, you mean when running Blender, Blender can compile its CUDA bits if it finds the CUDA toolkit!

That's what the message from @cpba's output above means:

Neither precompiled kernels nor CUDA compiler wad found, unable to use CUDA

The "precompiled kernels" would be built when building Blender with WITH_CYCLES_CUDA_BINARIES=ON, but if not then the CUDA toolkit must be installed on the machine that runs Blender, and the bits will be compiled at that time.

TingPing commented 6 years ago

The flatpak'd nvidia drivers only ship the runtime libraries not any development bits.

TingPing commented 6 years ago

A cuda sdk-extension is probably the best solution to this.

SaladinAyyub commented 5 years ago

So is CUDA toolkit working with blender ? Or else i cant use flatpak atleast snap can find CUDA

bochecha commented 5 years ago

@jatin-cbs since this issue hasn't been closed, then no it hasn't been implemented.

Help would be very welcome, as I don't have any NVidia hardware to even test this.

SaladinAyyub commented 5 years ago

when can we expect CUDA support ? @bochecha its been a long thread now. I just have to download blender manually because on my distro blender is not in repos.

bochecha commented 5 years ago

As I said in my previous comment, not having the hardware I can't work on this. Someone else needs to make it happen.

Asking over and over won't make it happen faster.

dineshdb commented 5 years ago

I could work on this if someone could tell me how to do it.

inkoqnito commented 5 years ago

I could help test new build i have an Geforce 1060 card. Unfortunately i don't now how to build Blender 2.8 for flatpak. For now i have to download Blender from blender.org instead of using flatpak.

cpba commented 5 years ago

Anybody willing to fix this issue should start by bundling the cuda development libraries, a good way to do it would be as an sdk extension as suggested in: https://github.com/flathub/org.blender.Blender/issues/8#issuecomment-367315845

The scripts that currently build the nvidia drivers can be found here: https://github.com/flathub/org.freedesktop.Platform.GL.nvidia

Once that's done it's just a matter of rebuilding the blender flatpak with cuda support, it's a trivial change that would only take a couple lines.

zicklag commented 4 years ago

Anybody willing to fix this issue should start by bundling the cuda development libraries, a good way to do it would be as an sdk extension as suggested in: #8 (comment)

The scripts that currently build the nvidia drivers can be found here: https://github.com/flathub/org.freedesktop.Platform.GL.nvidia

Do you have any pointers to documentation or otherwise could you elaborate on what that would take and how I might go about that if I were to find the time?

Once that's done it's just a matter of rebuilding the blender flatpak with cuda support, it's a trivial change that would only take a couple lines.

That's what I imagined. Last I built Blender from source it was just a Cmake flag.

zicklag commented 4 years ago

Hey, the latest release of the flatpak is actually using binary releases instead of source builds now so my CUDA card is detected on my laptop now!

If it works for everyone else I think that means we could close this issue.

cpba commented 4 years ago

@zicklag I'm pretty sure it's going to work for everybody, the initial fixes done to address this issue a couple years ago included everything required on the driver side.

But it was a lot of work to get it to build, to this day nobody's done it.

AdsonCicilioti commented 3 years ago

i'm have this problem yet.

Arch Linux 5.8 Nvidia Drivers 255.23 455.23

Flatpak Blender 2.90.1

eszlari commented 3 years ago

Nvidia Drivers 255.23

That version seems not to be available in the extension (maybe too old?):

https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/tree/master/data

AdsonCicilioti commented 3 years ago

Nvidia Drivers 255.23

That version seems not to be available in the extension (maybe too old?):

https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/tree/master/data

Sorry.. I've wanna mean 455.23

vivi90 commented 3 years ago

@eszlari @AdsonCicilioti Here the same issue, no CUDA with GTX 1060 and driver version 455.45.01 on Manjaro Linux (Arch). //EDIT: Available after restart.

tim77 commented 3 years ago

CUDA is here on Fedora 33; nvidia-455.45.01; GTX 1060. Снимок экрана от 2020-11-22 14-29-52

cpba commented 3 years ago

It also works perfectly fine for me on fedora 33, but I tried to do some testing to see what was going on:

It all works as intended, however, it stops working as soon as I remove the xorg-x11-drv-nvidia-cuda system package. I have no idea why but it looks like this somehow requires cuda support on the host side, could this be what was going wrong for @AdsonCicilioti and @vivi90 ?

I didn't expect this to be the case at all, I guess there's a kernel driver that has to be loaded for the cuda libs to work. Perhaps somebody with more experience with the nvidia driver can shed light on this issue.

sirn commented 3 years ago

I think I've found it. It looks like /dev/nvidia-uvm needs to exist on the host for Blender to be able to pick up the GPU. Running modprobe nvidia-uvm alone is not enough, as modprobe won't create the device node. This seems to be exactly what xorg-x11-drv-nvidia-cuda on Fedora is doing (see 60-nvidia-uvm.rules in rpmfusion repo).

For the adventurous, the easiest way to do this on non-Fedora is to use initialization script from CUDA documentation:

/sbin/modprobe nvidia-uvm

if [ "$?" -eq 0 ]; then
  # Find out the major device number used by the nvidia-uvm driver
  D=`grep nvidia-uvm /proc/devices | awk '{print $1}'`

  mknod -m 666 /dev/nvidia-uvm c $D 0
else
  exit 1
fi

Alternatively, install these files:

Then regenerate initrd (either via mkinitcpio or dracut) and reboot. Blender and probably everything else in Flatpak should now able to detect CUDA.

TopologicallySpeaking commented 3 years ago

I had exactly the same problem on Debian with a GTX 1080. Running the initialization script as suggested by @sirn fixed the problem.

plafue commented 3 years ago

Hi there :wave: This issue has been open for a while....

If I understand the thread correctly there were some different issues being reported here:

  1. Upstream not looking for libcuda.so.1 additionally to libcuda.so (which has been fixed for a while).
  2. Hosts missing nvidia-cuda-toolkit (and possibly nvidia-modprobe).
  3. Some devices not existing in the host machine needed for blender to be able to pick up the GPU.

I will address points two and three in an upcoming README.md. Otherwise i don't think there's not much to do here.

I would suggest to contact the package maintainers for your distros to make them aware of the information about the /dev/nvidia* devices as noted by by @sirn above.

If there are no objections i will close this issue soon.

cpba commented 3 years ago

Sorry, this has been fixed for months now, I didn't realise I'd left it open. Feel free to close it as soon as you wish.

AdsonCicilioti commented 2 years ago

@eszlari @AdsonCicilioti Here the same issue, no CUDA with GTX 1060 and driver version 455.45.01 on Manjaro Linux (Arch). //EDIT: Available after restart.

What!??

After years, I still can't get Blender Flatpak using Nvidia GPU and CUDA. Drivers properly installed. I definitely don't know what to do to make this work.

mbridon commented 2 years ago

https://github.com/flathub/org.blender.Blender/issues/8#issuecomment-490385316

I'm not going to buy new hardware just to test this, sorry.

kevinsmia1939 commented 2 years ago

@eszlari @AdsonCicilioti Here the same issue, no CUDA with GTX 1060 and driver version 455.45.01 on Manjaro Linux (Arch). //EDIT: Available after restart.

What!??

After years, I still can't get Blender Flatpak using Nvidia GPU and CUDA. Drivers properly installed. I definitely don't know what to do to make this work.

Try install NVIDIA driver in Flatpak. flatpak install org.freedesktop.Platform.GL.nvidia

AdsonCicilioti commented 2 years ago

@eszlari @AdsonCicilioti Here the same issue, no CUDA with GTX 1060 and driver version 455.45.01 on Manjaro Linux (Arch). //EDIT: Available after restart.

What!?? After years, I still can't get Blender Flatpak using Nvidia GPU and CUDA. Drivers properly installed. I definitely don't know what to do to make this work.

Try install NVIDIA driver in Flatpak. flatpak install org.freedesktop.Platform.GL.nvidia

@kevinsmia1939 , Already, don't work for me.

Martin15135215 commented 1 year ago

Does Cuda function now?

My flathub list ouput:

➤ flatpak list
Name                                  Application ID                                 Version      Zweig        Installation
Flatseal                              com.github.tchx84.Flatseal                     1.8.1        stable       system
Bottles                               com.usebottles.bottles                         51.5         stable       system
GPU-Viewer                            io.github.arunsivaramanneo.GPUViewer           2.26         stable       system
Obsidian                              md.obsidian.Obsidian                           1.1.16       stable       system
Blender                               org.blender.Blender                            3.5.0        stable       system
Codecs                                org.blender.Blender.Codecs                                  stable       system
FreeCAD                               org.freecadweb.FreeCAD                         0.20.2.29603 stable       system
Freedesktop Platform                  org.freedesktop.Platform                       22.08.9      22.08        system
Mesa                                  org.freedesktop.Platform.GL.default            22.3.5       22.08        system
Mesa (Extra)                          org.freedesktop.Platform.GL.default            22.3.5       22.08-extra  system
nvidia-520-56-06                      org.freedesktop.Platform.GL.nvidia-520-56-06                1.4          system
Mesa                                  org.freedesktop.Platform.GL32.default          22.3.5       22.08        system
nvidia-520-56-06                      org.freedesktop.Platform.GL32.nvidia-520-56-06              1.4          system
Intel                                 org.freedesktop.Platform.VAAPI.Intel                        22.08        system
ffmpeg-full                           org.freedesktop.Platform.ffmpeg-full                        22.08        system
openh264                              org.freedesktop.Platform.openh264              2.1.0        2.2.0        system
Freedesktop SDK                       org.freedesktop.Sdk                            22.08.9      22.08        system
Boxen                                 org.gnome.Boxes                                44.0         stable       system
GNOME Boxes Osinfo DB                 org.gnome.Boxes.Extension.OsinfoDb             20230308     stable       system
GNOME Application Platform version 43 org.gnome.Platform                                          43           system
GNOME Application Platform version 44 org.gnome.Platform                                          44           system
i386                                  org.gnome.Platform.Compat.i386                              43           system
Breeze GTK theme                      org.gtk.Gtk3theme.Breeze                       5.27.3       3.22         system
KDE Application Platform              org.kde.Platform                                            5.15-22.08   system
LibreOffice                           org.libreoffice.LibreOffice                    7.5.2.2      stable       system
cpba commented 1 year ago

@Martin15135215 Yes, I tested this just in case, it works on a fresh install of fedora 37.

Keep in mind that, as you can read in the messages from 2020 and 2021, this relies (among other things) on the nvidia-uvm device being properly set up. Most distributions should do this automatically, but yours might not.

Martin15135215 commented 1 year ago

Oh, I see, I am using MX Linux KDE, and they have a tool to install Nvidia drivers.

Screenshot_20230418_181926

And I also did this command:

flatpak override --user --device=dri --env=__NV_PRIME_RENDER_OFFLOAD=1 --env=__VK_LAYER_NV_optimus=NVIDIA_only --env=__GLX_VENDOR_LIBRARY_NAME=nvidia org.blender.Blender

If the command is not the cause for the failure, I will report to MX Linux forum, that the nvidia-uvm device might not be set properly.

Martin15135215 commented 1 year ago

I checked the Debian nvidia site and did install the cuda and the optix library, and then I did download the tarball and cuda did function. Afterwards, I opened the flathub version and there it now functions. I don't know why it does now, however I am happy :)

mikamyara commented 2 months ago

Hello, on Debian 12 : Blender flatpak does not alows cuda. However : if I first start the NVIDIA Settings app, then quit it, then start Blender, then blender has Cuda available. I don't kwow if it was necessary but I added the "environment" elements to the blender flatpak parameters as shown Martin :

flatpak override --user --device=dri --env=__NV_PRIME_RENDER_OFFLOAD=1 --env=VK_LAYER_NV_optimus=NVIDIA_only --env=GLX_VENDOR_LIBRARY_NAME=nvidia org.blender.Blender

But I did it with Flatseal. Don't know if it was necessary.

I checked the environment before and after the nvidia settings launch and nothing differs. So it os not what changes. If someone knows what I could check to understand what changes I can make tests.

But in short : on Debian at least, start nvidia settings app, close it (or not), then start blender's flatpak, and Cuda is avaiable.

Regards, Mike