hi all again,
I’ve installed blender (unsupported) in the configuration.nix file
environment.systemPackages = let
unstable = import <nixos-unstable> { config = { allowUnfree = true; }; };
in with pkgs; [
vim
cudaPackages.cudatoolkit
(unstable.blender.override {
cudaSupport = true;
})
];
then I open blender at it sees my Nivida GPU without problem.
The problem arise when I install LuxBlend addon (is an alternate render engine); if I run blender as user I get, in the addons settings, “GPU API, not available in this build” but if I start blender as root everything works as inteded and I can use the GPU to render without any problem.
How can I make blender have the same behavior when started as user?
Could you provide some more details for reproducing your error? What environment are you running Blender in (e.g. NixOS or else), how do you install LuxBlend, etc. E.g. you could attach the outputs of nix-shell -p nix-info --run "nix-info -m" and nvidia-smi in a <details></details> environment
Sun Sep 17 18:22:46 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.86.05 Driver Version: 535.86.05 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce GTX 1060 ... Off | 00000000:01:00.0 On | N/A |
| N/A 46C P8 6W / 60W | 21MiB / 6144MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 2073 G ...84-gnome-shell-44.2/bin/gnome-shell 1MiB |
+---------------------------------------------------------------------------------------+
Blender installed from unstable with CUDA support in configuration.nix
environment.systemPackages = let
unstable = import <nixos-unstable> { config = { allowUnfree = true; }; };
in with pkgs; [
vim
cudaPackages.cudatoolkit
(unstable.blender.override {
cudaSupport = true;
})
];
LuxBlend addon downloaded from their github, beta build that works with 3.6.2 LTS blender (that’s why I need 3.6.2 blender from unstable), installed directly from blender.
Preference > addons > install
No error showed when installed or activated the addon, just that message in the addon menu and no GPU. Blender correctly detect my GTX 1060 if using cycles and LuxBlend work if setup for CPU usage, but that is not an option for me.
Are you referring to this? Releases · LuxCoreRender/BlendLuxCore · GitHub
If so, I see they’re shipping some prebuilt shared libraries (including vendored copies of nixpkgs’ cudaPackages.cuda_nvrtc) which likely need to be patchelf-ed or used with programs.nix-ld.enable = true:
(blender.override { cudaSupport = true; }) is already linked to all the necessary cuda libraries; you add cudatoolkit when you compile new programs that use cuda
sorry but I didn’t undestrand this part
I suspect that the add-on is broken regardless of sudo, because it relies on some system libraries it wouldn’t be able to find on NixOS unless you explicitly exposed them or perhaps Blender had already loaded them. Seems like these also come prebuilt in the archive though:
Still, you might want to rebuild nixos with programs.nix-ld.enable = true and, for example, try running Blender from a nix-shell with mkShell { NIX_LD_LIBRARY_PATH = lib.makeSearchPath "lib" [ "/run/opengl-driver" cudaPackages_11.cuda_nvrtc ]; } (and you might need to experiment with adding embree openimagedenoise tbb stdenv.cc.cc.lib to the list). This is only a concern when using a prebuilt add-on
I just got around to try and reproduce your error. I ran bin/blender built from the (blender.override { cudaSupport = true; }) expression, installed the BlendLuxCore-v2.7beta1-linux64.zip through settings -> addons -> install (logs: “pyluxcore successfully registered”), setup “LuxCoreRender” as the “Render Engine” for the default cube scene, and finally ran rendering with F12. As expected, this fails with an error related to libnvrtc:
[...]
[LuxRays][64.573] [BVHKernel] CUDA program compilation error:
nvrtc: error: failed to open libnvrtc-builtins.so.
Make sure that libnvrtc-builtins.so is installed correctly.
Traceback (most recent call last):
File "/home/ss/.config/blender/3.6/scripts/addons/BlendLuxCore/engine/base.py", line 91, in render_final
final.render(self, depsgraph)
File "/home/ss/.config/blender/3.6/scripts/addons/BlendLuxCore/engine/final.py", line 44, in render
_render_layer(engine, depsgraph, statistics, layer)
File "/home/ss/.config/blender/3.6/scripts/addons/BlendLuxCore/engine/final.py", line 56, in _render_layer
engine.session = engine.exporter.create_session(depsgraph, engine=engine, view_layer=view_layer)
File "/home/ss/.config/blender/3.6/scripts/addons/BlendLuxCore/export/__init__.py", line 217, in create_session
pyluxcore.KernelCacheFill(config_props_copy)
RuntimeError: BVHKernel CUDA program compilation error
ERROR: BVHKernel CUDA program compilation error
Info: Compiling CUDA kernels (just once, usually takes 15-30 minutes)
Error: BVHKernel CUDA program compilation error
I then created a shell.nix file as described above and:
$ cat > shell.nix << EOF
with import <nixpkgs> { config.allowUnfree = true; };
mkShell {
NIX_LD_LIBRARY_PATH = lib.makeSearchPath "lib" [
addOpenGLRunpath.driverLink
cudaPackages_11.cuda_nvrtc
];
}
EOF
$ nix-shell shell.nix # enter the environment where NIX_LD_LIBRARY_PATH is set up
$ echo $NIX_LD_LIBRARY_PATH # takes priority over libnvrtc.so shipped with BlendLuxCore
/run/opengl-driver/lib:/nix/store/wxg5an09nys8awnhnwc19pnghg6433wv-cuda_nvrtc-11.8.89/lib
$ ls -l /lib64/ld-linux-x86-64.so.2 # note I'm using NixOS with programs.nix-ld.enable = true:
lrwxrwxrwx 1 root root 71 Sep 15 20:46 /lib64/ld-linux-x86-64.so.2 -> /nix/store/386r5hy238s7djbpdpijxlj2f8kfz7cw-nix-ld-1.2.2/libexec/nix-ld
$ blender
[...]
[LuxRays][7.968] OpenCL support: enabled
[LuxRays][7.971] CUDA support: enabled
[...]
[LuxCore][20.624] Noise estimation: first pass
[LuxCore][32.515] Noise estimation: Error mean = 0.00170071
[LuxCore][50.613] Noise estimation: Error mean = 0.000993632
[LuxCore][70.259] Noise estimation: Error mean = 0.000427202
Alternatively, instead of nix-shell environments you could also just set a default NIX_LD_LIBRARY_PATH globally in your NixOS configuration.nix, e.g. in environment.variables.NIX_LD_LIBRARY_PATH = pkgs.lib.makeSearchPath "lib" [ ... ], albeit this may be more fragile
P.S. Uhm, sorry I’m just dumping more and more text, it’s probably too much to consume at once and more than was needed to solve the problem