-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuseCudaWithoutSwitchingRenderer
More file actions
106 lines (82 loc) · 5.76 KB
/
useCudaWithoutSwitchingRenderer
File metadata and controls
106 lines (82 loc) · 5.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env bash
# Warning on laptops, the HDMI port, as well as any DP Alt Mode port that would be provided by docking stations,
# are wired to the nvidia card. So you can't use an external display without the `nvidia_drm` or `noveau` module.
# You can use CUDA without switching rendering to the Nvidia graphics. All you need to do is ensure that the Nvidia card is powered on before starting a CUDA application
# https://wiki.archlinux.org/title/NVIDIA_Optimus#Use_CUDA_without_switching_the_rendering_provider
# Kernel Open (nvidia-open vs nvidia)
# Since the NVIDIA driver 515xx, there is a mean to use a full open source kernel space driver (userspace driver remains proprietary).
# This is only relevant for Turing, Ampere and later (there is no chance for it to works with older GPU).
# https://rpmfusion.org/Howto/NVIDIA#Kernel_Open
# https://negativo17.org/nvidia-proprietary-and-open-source-kernel-modules/
# ublue OS also does as negativo17 suggests:
# The nvidia-open flavored containers call `build-kmod-nvidia.sh kernel-open`
# https://github.com/ublue-os/akmods/blob/1c5da5bf9fd1907cc47f5a439c12cbf9f1763d05/Containerfile.nvidia-open#L43C10-L43C30
# which does the `sed -i -e 's/kernel$/kernel-open/g' /etc/nvidia/kernel.conf` before an `akmods` build of `nvidia`
# https://github.com/ublue-os/akmods/blob/1c5da5bf9fd1907cc47f5a439c12cbf9f1763d05/build_files/nvidia/build-kmod-nvidia.sh#L37
# !!!! NOTE !!! The `/etc/nvidia/kernel.conf` doesn't exist on a minimal FC 43 install anymore, so don't get surprised if you don't find it.
# You can do just do a `sudo akmods --force --kmod "nvidia"` on FC43.
# Keep in mind that as of `akmod-nvidia` `3:590.44.01-1.fc43`,
# the module needs a C++ compiler, but that dependency is somehow missing from the RPM,
# so you have to ensure it for yourself that it is available.
# both nvidia and nvidia-open can support additional kernel modules:
# * nvidiafb: framebuffer support
# * nvidia_modeset: Kernel Mode Setting (KMS) support
# * nvidia_uvm: Unified Virtual Memory (UVM) support
# * nvidia_drm: Direct Rendering Management (DRM) support
# https://www.baeldung.com/linux/nvidia-gpu-enable-disable
# Important: both (nvidia-open vs nvidia) use the module name `nvidia`
# To check which one is in use `modinfo nvidia | grep license`
# If it returns `Dual MIT/GPL` then it is `nvidia-open`,
# if it returns `NVIDIA`, then it is the proprietary `nvidia`.
# See https://negativo17.org/nvidia-proprietary-and-open-source-kernel-modules/#akmods
# On newer GPUs blender will need the CUDA toolkit to compile, but:
# Normally users do not need to install the CUDA toolkit as Blender comes with precompiled kernels.
# https://docs.blender.org/manual/en/latest/render/cycles/gpu_rendering.html#cuda-error-kernel-compilation-failed
# https://bbs.archlinux.org/viewtopic.php?id=283439
# Gnome launches Wayland sessions by default, which are incompatible with optimus-manager.
# https://github.com/Askannz/optimus-manager/wiki/v1.3.1-README
# A much lighter tool designed with simplicity in mind, it doesn't requires extensive config files or having a daemon running 24/7 on your system
# as well as having to install a patched version of GDM if you're a Gnome use
# https://github.com/bayasdev/envycontrol/wiki/Frequently-Asked-Questions#how-is-this-different-from-optimus-manager
# Nvidia GPU is allways on. How to used integrated card by default? On Fedora 40 this worked like I expected.
# https://universal-blue.discourse.group/t/nvidia-gpu-is-allways-on-how-to-used-integrated-card-by-default/3617
# I also like to edit /etc/supergfxd.conf to make rebootless and loginless switching (seamless).
# This is my currenct config. You might need to reboot the first time after editing it tho, or restart the service with systemctl restart supergfxd.
# {
# “mode”: “Integrated”,
# “vfio_enable”: true,
# “vfio_save”: false,
# “always_reboot”: false,
# “no_logind”: true,
# “logout_timeout_s”: 60,
# “hotplug_type”: “None”
# }
# https://universal-blue.discourse.group/t/recommended-way-to-have-integrated-intel-as-primary-gpu-and-nvidia-for-offloading/7545/3
# In the meantime there is a GNOME Shell extension in ublue staging area:
# https://github.com/ublue-os/packages/pull/46/files
# https://extensions.gnome.org/extension/5344/supergfxctl-gex/
# Nvidia optimus laptop
# If you are using an nvidia image on an optimus laptop, run this after installation:
#
# > ujust configure-nvidia-optimus
# https://github.com/AB9IL/bluejay-hyprland?tab=readme-ov-file#nvidia-optimus-laptop
# https://elis.nu/blog/2024/08/back-from-hyprland-to-sway/
# https://github.com/ublue-os/packages/blob/45e1c9ad70077a28efd18a75b4d451e3779a4f00/packages/ublue-os-just/src/recipes/40-nvidia.just#L102
# https://download.nvidia.com/XFree86/Linux-x86_64/545.29.06/README/dynamicpowermanagement.html
# > echo "options nvidia NVreg_DynamicPowerManagement=0x02" >> /etc/modprobe.d/nvidia.conf
# Suspend / Resume
# Suspend & Resume might not work out of the box after installing packages.
# Check if the output of `systemctl list-unit-files | grep nvidia`
# The `nvidia-resume.service` & `nvidia-suspend.service` should both be `enabled - enabled`.
# If not then:
# sudo systemctl enable nvidia-suspend.service
# sudo systemctl enable nvidia-resume.service
# Also check the developments in this thread:
# https://github.com/NVIDIA/open-gpu-kernel-modules/issues/472
# Test if cuda is working in a podman container:
# podman run --rm --device=nvidia.com/gpu=all --security-opt=label=disable fedora nvidia-smi
# See:
# https://developers.redhat.com/articles/2025/04/11/my-advice-selinux-container-labeling#6__run_container_with_selinux_separation_disabled_
# also somewhat relevant, but much older posts are:
# https://www.redhat.com/en/blog/podman-inside-container
# https://www.redhat.com/en/blog/files-devices-podman