You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Atomic Desktops for Fedora](https://fedoraproject.org/atomic-desktops/)
6
7
-[Fedora Spins](https://fedoraproject.org/spins)
7
-
-[Other Distributions](https://containertoolbx.org/distros/), including `Red Hat Enterprise Linux >= 8.`, `Arch Linux`, and `Ubuntu`.
8
-
8
+
-[Other Distributions](https://containertoolbx.org/distros/), including `Red Hat Enterprise Linux >= 8.5`, `Arch Linux`, and `Ubuntu`.
9
9
10
10
## Table of Contents
11
11
12
12
-[Prerequisites](#prerequisites)
13
-
-[Monitoring NVIDIA CUDA Repositories](#monitoring-nvidia-cuda-repositories)
14
-
-[Using the Fedora 39 CUDA Repository](#using-the-fedora-39-cuda-repository)
13
+
-[Using the Fedora 41 CUDA Repository](#using-the-fedora-41-cuda-repository)
15
14
-[Creating a Fedora Toolbox Environment](#creating-a-fedora-toolbox-environment)
16
15
-[Installing Essential Development Tools](#installing-essential-development-tools)
17
16
-[Adding the CUDA Repository](#adding-the-cuda-repository)
@@ -29,44 +28,33 @@ In this guide we setup [Nvidia CUDA](https://docs.nvidia.com/cuda/) in a toolbox
29
28
## Prerequisites
30
29
31
30
-**Toolbox Installed on the Host System**`Fedora Silverblue` and `Fedora Workstation` both have toolbox by default, other distributions may need to install the [toolbox package](https://containertoolbx.org/install/).
32
-
-**NVIDIA Drivers and Graphics Card installed on Host System (optional)** To run CUDA program, such as `llama.cpp`, the host should be setup to access your NVIDIA hardware. Fedora Hosts can use the [RPM Fusion Repository](https://rpmfusion.org/Howto/NVIDIA).
31
+
-**NVIDIA Drivers and Graphics Card installed on Host System (recommended)** To run CUDA program, such as `llama.cpp`, the host should be setup to access your NVIDIA hardware. Fedora Hosts can use the [RPM Fusion Repository](https://rpmfusion.org/Howto/NVIDIA).
33
32
-**Internet connectivity** to download packages.
34
33
35
-
### Monitoring NVIDIA CUDA Repositories
34
+
### Using the Fedora 41 CUDA Repository
36
35
37
-
Before proceeding, it is advisable to check if NVIDIA has updated their CUDA repositories for your Fedora version. NVIDIA's repositories can be found at:
36
+
The latest release is 41.
38
37
39
-
-[Fedora 40 CUDA Repository](https://developer.download.nvidia.com/compute/cuda/repos/fedora40/x86_64/)
40
38
-[Fedora 41 CUDA Repository](https://developer.download.nvidia.com/compute/cuda/repos/fedora41/x86_64/)
41
39
42
-
As of the latest update, these repositories do not contain the `cuda` meta-package or are missing essential components.
43
-
44
-
### Using the Fedora 39 CUDA Repository
45
-
46
-
Since the newer repositories are incomplete, we'll use the Fedora 39 repository:
47
-
48
-
-[Fedora 39 CUDA Repository](https://developer.download.nvidia.com/compute/cuda/repos/fedora39/x86_64/)
49
-
50
-
**Note:** Fedora 39 is no longer maintained, so we recommend using a toolbox environment to prevent system conflicts.
40
+
**Note:** We recommend using a toolbox environment to prevent system conflicts.
51
41
52
42
## Creating a Fedora Toolbox Environment
53
43
54
-
This guide focuses on Fedora hosts, but with small adjustments, it can work for other hosts. Using a Fedora 39 toolbox allows us to install the necessary packages without affecting the host system.
44
+
This guide focuses on Fedora hosts, but with small adjustments, it can work for other hosts. Using the Fedora Toolbox allows us to install the necessary packages without affecting the host system.
55
45
56
46
**Note:** Toolbox is available for other systems, and even without Toolbox, it is possible to use Podman or Docker.
57
47
58
-
We do not recommend installing on the host system, as Fedora 39 is out-of-maintenance, and instead you should upgrade to a maintained version of Fedora for your host.
After adding the repository, synchronize the package manager again:
@@ -109,106 +97,62 @@ After adding the repository, synchronize the package manager again:
109
97
sudo dnf distro-sync
110
98
```
111
99
112
-
## Installing `nvidia-driver-libs`
100
+
## Installing `nvidia-driver-libs` and `nvidia-driver-cuda-libs`
113
101
114
-
Attempt to install `nvidia-driver-libs`:
102
+
We need to detect if the host is supplying the [NVIDIA driver libraries into the toolbox](https://github.com/containers/toolbox/blob/main/src/pkg/nvidia/nvidia.go).
115
103
116
104
```bash
117
-
sudo dnf install nvidia-driver-libs
105
+
ls -la /usr/lib64/libcuda.so.1
118
106
```
119
107
120
108
**Explanation:**
121
109
122
-
-`nvidia-driver-libs` contains necessary NVIDIA driver libraries required by CUDA.
123
-
- This step might fail due to conflicts with existing NVIDIA drivers on the host system.
124
-
125
-
## Manually Resolving Package Conflicts
126
-
127
-
If the installation fails due to conflicts, we'll manually download and install the required packages, excluding conflicting files.
You should receive a message indicating the package is already installed:
206
148
207
149
```
208
-
Package nvidia-driver-libs-3:560.35.05-1.fc39.x86_64 is already installed.
209
-
Dependencies resolved.
150
+
Updating and loading repositories:
151
+
Repositories loaded.
152
+
Package "nvidia-driver-libs-3:570.86.10-1.fc41.x86_64" is already installed.
153
+
Package "nvidia-driver-cuda-libs-3:570.86.10-1.fc41.x86_64" is already installed.
154
+
210
155
Nothing to do.
211
-
Complete!
212
156
```
213
157
214
158
## Installing the CUDA Meta-Package
@@ -233,7 +177,7 @@ To use CUDA, add its binary directory to your system's `PATH`.
233
177
234
178
**Explanation:**
235
179
236
-
- We add to `/etc/profile.d/` as the `/etc/` folder is unique to this particular container, and is not shared with other containers or the host system.
180
+
- We add to `/etc/profile.d/` as the `/etc/` folder is unique to this particular container, and is not shared with other containers or the host system.
237
181
- The backslash `\` before `$PATH` ensures the variable is correctly written into the script.
238
182
239
183
2.**Make the Script Executable:**
@@ -262,26 +206,33 @@ You should see output similar to:
262
206
263
207
```
264
208
nvcc: NVIDIA (R) Cuda compiler driver
265
-
Copyright (c) 2005-2024 NVIDIA Corporation
266
-
Built on Tue_Oct_29_23:50:19_PDT_2024
267
-
Cuda compilation tools, release 12.6, V12.6.85
268
-
Build cuda_12.6.r12.6/compiler.35059454_0
209
+
Copyright (c) 2005-2025 NVIDIA Corporation
210
+
Built on Wed_Jan_15_19:20:09_PST_2025
211
+
Cuda compilation tools, release 12.8, V12.8.61
212
+
Build cuda_12.8.r12.8/compiler.35404655_0
269
213
```
270
214
271
215
This output confirms that the CUDA compiler is accessible and indicates the installed version.
272
216
273
217
## Conclusion
274
218
275
-
You have successfully set up CUDA on Fedora within a toolbox environment using the Fedora 39 CUDA repository. By manually resolving package conflicts and configuring the environment, you can develop CUDA applications without affecting your host system.
219
+
You have successfully set up CUDA on Fedora within a toolbox environment using the Fedora 41 CUDA repository. By manually updating the RPM db and configuring the environment, you can develop CUDA applications without affecting your host system.
276
220
277
221
## Troubleshooting
278
222
279
223
-**Installation Failures:**
224
+
280
225
- If you encounter errors during installation, carefully read the error messages. They often indicate conflicting files or missing dependencies.
281
-
-Use the `--excludepath` option with `rpm` to exclude conflicting files during manual installations.
226
+
-You may use the `--excludepath` option with `rpm` to exclude conflicting files during manual RPM installations.
282
227
283
-
-**Driver Conflicts:**
284
-
- Since the host system may already have NVIDIA drivers installed, conflicts can arise. Using the toolbox environment helps isolate these issues.
228
+
-**Rebooting the Container:**
229
+
230
+
- Sometimes there may be a bug in the NVIDIA driver host passthrough (such as missing a shared library). Rebooting the container may solve this issue:
231
+
232
+
```bash
233
+
# on the host system
234
+
podman container restart --all
235
+
```
285
236
286
237
-**Environment Variables Not Set:**
287
238
- If `nvcc` is not found after installation, ensure that `/usr/local/cuda/bin` is in your `PATH`.
@@ -291,10 +242,12 @@ You have successfully set up CUDA on Fedora within a toolbox environment using t
291
242
## Additional Notes
292
243
293
244
-**Updating CUDA in the Future:**
245
+
294
246
- Keep an eye on the official NVIDIA repositories for updates to your Fedora version.
295
247
- When an updated repository becomes available, adjust your `dnf` configuration accordingly.
296
248
297
249
-**Building `llama.cpp`:**
250
+
298
251
- With CUDA installed, you can follow these [build instructions for `llama.cpp`](https://github.com/ggerganov/llama.cpp/blob/master/docs/build.md) to compile it with CUDA support.
299
252
- Ensure that any CUDA-specific build flags or paths are correctly set in your build configuration.
0 commit comments