Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nvidia dGPUs in laptops w/ integrated graphics require a workaround #40

Open
zelikos opened this issue Nov 27, 2023 · 8 comments
Open
Labels
enhancement New feature or request nvidia

Comments

@zelikos
Copy link
Owner

zelikos commented Nov 27, 2023

On a laptop with Nvidia, DaVinci doesn't use the dGPU by default, and GNOME's "launch with discrete GPU" option doesn't work because it sets environment variables which don't get passed through by distrobox. The fix I found was editing the desktop file and replacing

Exec=/usr/bin/distrobox-enter -n davincibox -- /opt/resolve/bin/resolve %u

with

Exec=/usr/bin/distrobox-enter -n davincibox -- env __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia /opt/resolve/bin/resolve %u

Originally posted by @flexagoon in #21 (comment)

Ideally, we'd handle this automatically, but in the short term we can add an argument for add-davinci-launcher and the run-davinci script to apply the environment variables here.

@zelikos zelikos changed the title Handle dual GPUs (laptops) Handle Nvidia dGPUs in laptops Nov 27, 2023
@not-a-dev-stein
Copy link

This finally fixed the issue I was having (error 999), thanks!

@zelikos zelikos added enhancement New feature or request help wanted Extra attention is needed and removed help wanted Extra attention is needed labels Jun 6, 2024
@zelikos zelikos added the nvidia label Jun 17, 2024
@not-a-dev-stein
Copy link

I'm not sure what's changed in the meantime, but ever since updating to the 555 NVIDIA drivers, something broke, both distrobox and toolbox don't recognize CUDA anymore and I get the "Failed to initialize GPU" error whenever I launch Davinci, which I'm working around by using the integrated GPU with rusticl, but it's obviously much, much slower than the dedicated GPU.

@flexagoon
Copy link

@not-a-dev-stein did you also update the driver inside of the distrobox?

@not-a-dev-stein
Copy link

@not-a-dev-stein did you also update the driver inside of the distrobox?

Yup, I'm on latest on both. If I don't run the command to open Davinci with rusticl it gives out an error and gives me the menu to change GPU configuration, where I can see it detects both the integrated and the NVIDIA GPU but only gives OpenCL as an option, and the program doesn't run at all when I restart, it always gives me the GPU error. With rusticl at least it runs on the integrated GPU.

@Alexios13
Copy link

Alexios13 commented Jul 8, 2024

I am using the latest bazzite on my laptop. My configuration is an intel i7-8750H with integrated Intel UHD Graphics 630 and a discrete NVIDIA GeForce GTX 1050 Ti Mobile. I use this Setup Guide but I have the same issue with @not-a-dev-stein. When I open the Davinci I get an "unable to intialize GPU" and gives me the menu to update GPU configuration, where I can see it detects both the integrated and the NVIDIA GPU but only gives OpenCL as an option and the program doesn't run at all even after I restart, it always gives me the GPU error.

@zelikos
Copy link
Owner Author

zelikos commented Jul 8, 2024

If things are broken in both distrobox and toolbox, my guess would be something was broken on the Nvidia driver side. I'm unable to troubleshoot this directly since I don't have an Nvidia GPU, though

zelikos added a commit that referenced this issue Sep 16, 2024
Based on findings in
#114 (comment)
it seems that having the akmod-nvidia and CUDA packages installed into
the container actually *cause* problems, and through
`nvidia-container-toolkit` the container actually uses the host NVIDIA
drivers just fine.

This PR splits davincibox into two builds: `davincibox` that contains
only DaVinci Resolve dependencies and no drivers, for use on NVIDIA GPUs
with `nvidia-container-toolkit`, and `davincibox-opencl` for AMD & Intel
with their respective compute packages (`intel-compute-runtime` and
`rocm-opencl`).

In theory, this will likely resolve #96 #114 and #117 and may help with
#40
@zelikos
Copy link
Owner Author

zelikos commented Sep 16, 2024

The GPU initialization issue should be fixed as part of #121. No idea if other issues remain with running davincibox on these laptops, though.

@Beryesa
Copy link

Beryesa commented Sep 18, 2024

Could distrobox itself further handle these nvidia ones (and DRI_PRIME) which it gets from gnome/kde/switcherooctl, perhaps on the upstream project?

@zelikos zelikos changed the title Handle Nvidia dGPUs in laptops Nvidia dGPUs in laptops w/ integrated graphics require a workaround Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request nvidia
Projects
None yet
Development

No branches or pull requests

5 participants