LuxCoreRender / BlendLuxCore

Blender Integration for LuxCore
GNU General Public License v3.0
726 stars 91 forks source link

CUDA fails to render on Linux #576

Open BojanBekic opened 3 years ago

BojanBekic commented 3 years ago

Steps to reproduce: Enable CUDA in addon prefs. All ok. Open Viewport preview or mat preview. It fails with a message: MergeSampleBuffersOCL CUDA program compilation error Start a rendering. It fails with a message: BVHKernel CUDA program compilation error

OS: Operating System: KDE neon 5.20 KDE Plasma Version: 5.20.0 KDE Frameworks Version: 5.75.0 Qt Version: 5.15.0 Kernel Version: 5.4.0-51-lowlatency OS Type: 64-bit Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz Memory: 15.5 GiB of RAM Graphics Processor: GeForce GTX 960M/PCIe/SSE2

Blender version: 2.90.1 LuxCore version: 2.5 (any build)

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/93439716-cuda-fails-to-render-on-linux?utm_campaign=plugin&utm_content=tracker%2F80143047&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F80143047&utm_medium=issues&utm_source=github).
ChandraVFX commented 3 years ago

Copy from Home ./config/blender/2.90/scripts/addons/BlendLuxCore/bin (place where BlenderLuxCore addon installed) all libnvrtc to /usr/lib. example: sudo cp libnvrtc. /usr/lib

Thats work for me and (CUDA GPU rendering and Optix viewport denoiser works). Nvidia driver is 450.80.02. I'm on Ubuntu Linux 20.04

BojanBekic commented 3 years ago

Thanks, just tried it. It did something for sure :) - now it fails with a different message:

CUDA driver API error CUDA_ERROR_INVALID_PTX (code: 218, file:/home/vsts/work/1/s/LinuxCompile/LuxCore/src/luxrays/utils/cuda.cpp, line: 221): a PTX JIT compilation failed

We have the same NVIDIA driver and Linux versions.

Maybe the old hardware - Graphics Processor: GeForce GTX 960M/PCIe/SSE2 has something to do with it?

Dade916 commented 3 years ago

It happens because the CUDA compiler is newer than your driver. You need to install a CUDA 10.1 compatible driver.

Note: the CUDA compiler is the file you copied.

BojanBekic commented 3 years ago

Thank you for the explanation. I'll update the driver, there was a dedicated ppa for NVIDIA stuff if I remember.

ChandraVFX commented 3 years ago

Nvidia 450 Linux driver is CUDA 11 compatible. I dont know which version of CUDA is supported by gtx 960m GPU. Try with sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update and try with 440 driver in additional driver settings.

BojanBekic commented 3 years ago

I've installed first 455, then 440 from the ppa:graphics-drivers/ppa, no problems, but LuxCore fails with both of them with the same message.

I generally don't understand this subject, when I enter "cuda" in my package manager, I can see some ~ 20 libs, none of them installed. They are always of 10.1 version, except a few that have the version number of the driver in use. So, for me It could look like I can and should install some lib of the appropriate cuda. But then, how does Cycles use cuda if it's not in the system?? Are the libs needed packed with Blender?

I know, I'm a noob :)

ChandraVFX commented 3 years ago

I'm a noob too :) Cycles use CUDA by default, but in LuxCoreRender for Blender libraries for NVidia CUDA not load properly in my case, i don't know why. OpenCL works without problem, but slower. I do workaround for all libnvrtc for me and copy it to Ubuntu system /usr/lib folder, and that's work for me on 450 driver and CUDA 11. I forgot to say, my GPU is gtx1060.

BojanBekic commented 3 years ago

Hmmm, then maybe it is because my gtx960m, I'll try to google it.

OpenCL works for me to, yeah. And it's still faster and better looking than Cycles with CUDA for the interiors! I wonder how much gain could I have with LuxCore CUDA?

ChandraVFX commented 3 years ago

That depend of scene. I don't know precisely. Not big difference between OpenCL and CUDA like in Cycles. Maybe because CUDA kernel is new and practically experimental in Lux. But, with 450 Linux drivers you got Optix denoiser under CUDA which works pretty well in Blender Viewport.

BojanBekic commented 3 years ago

Thanks for the info :)

ghost commented 3 years ago

Copy from Home ./config/blender/2.90/scripts/addons/BlendLuxCore/bin (place where BlenderLuxCore addon installed) all libnvrtc to /usr/lib. example: sudo cp libnvrtc. /usr/lib

Thats work for me and (CUDA GPU rendering and Optix viewport denoiser works). Nvidia driver is 450.80.02. I'm on Ubuntu Linux 20.04

There are no libnvrtc*.* files in .config/blender/2.91/scripts/adodns/BlendLuxCore/bin/ where can I find them?

Dade916 commented 3 years ago

There are no libnvrtc*.* files in .config/blender/2.91/scripts/adodns/BlendLuxCore/bin/ where can I find them?

It is included in BlendLuxCore .zip file.

Another possible solution could be to just install CUDA (10 or 11) SDK so NVRTC is installed system wide and available for everything.

johannes-wilde commented 3 years ago

Copy from Home ./config/blender/2.90/scripts/addons/BlendLuxCore/bin (place where BlenderLuxCore addon installed) all libnvrtc to /usr/lib. example: sudo cp libnvrtc. /usr/lib

Thats work for me and (CUDA GPU rendering and Optix viewport denoiser works). Nvidia driver is 450.80.02. I'm on Ubuntu Linux 20.04

Thanks, that works for me as well! Was searching for a solution for weeks!

HerbertBlenderman commented 7 months ago

This worked for me: export LD_LIBRARY_PATH=$HOME/.config/blender/3.6/scripts/addons/BlendLuxCore/bin before running Blender 3.6.8 LTS (in the same terminal)