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
@@ -29,7 +30,96 @@ CDI also improves the compatibility of the NVIDIA container stack with certain f
29
30
30
31
- You installed an NVIDIA GPU Driver.
31
32
32
-
### Procedure
33
+
### Automatic CDI Specification Generation
34
+
35
+
As of NVIDIA Container Toolkit `v1.18.0`, the CDI specification is automatically generated and updated by a systemd service called `nvidia-cdi-refresh`. This service:
36
+
37
+
- Automatically generates the CDI specification at `/var/run/cdi/nvidia.yaml` when NVIDIA drivers are installed or upgraded
38
+
- Runs automatically on system boot to ensure the specification is up to date
39
+
40
+
```{note}
41
+
The automatic CDI refresh service does not handle:
42
+
- Driver removal (the CDI file is intentionally preserved)
43
+
- MIG device reconfiguration
44
+
45
+
For these scenarios, you may still need to manually regenerate the CDI specification. See [Manual CDI Specification Generation](#manual-cdi-specification-generation) for instructions.
46
+
```
47
+
48
+
#### Customizing the Automatic CDI Refresh Service
49
+
50
+
You can customize the behavior of the `nvidia-cdi-refresh` service by adding environment variables to `/etc/nvidia-container-toolkit/cdi-refresh.env`. This file is read by the service and allows you to modify the `nvidia-ctk cdi generate` command behavior.
51
+
52
+
Example configuration file:
53
+
```bash
54
+
# /etc/nvidia-container-toolkit/cdi-refresh.env
55
+
NVIDIA_CTK_DEBUG=1
56
+
# Add other nvidia-ctk environment variables as needed
57
+
```
58
+
59
+
For a complete list of available environment variables, run `nvidia-ctk cdi generate --help` to see the command's documentation.
60
+
61
+
```{important}
62
+
After modifying the environment file, you must reload the systemd daemon and restart the service for changes to take effect:
Jun 27 00:04:30 ipp2-0502 nvidia-ctk[1623461]: time="2025-06-27T00:04:30-04:00" level=info msg="Selecting /usr/bin/nvidia-smi as /usr/bin/nvidia-smi"
96
+
Jun 27 00:04:30 ipp2-0502 nvidia-ctk[1623461]: time="2025-06-27T00:04:30-04:00" level=info msg="Selecting /usr/bin/nvidia-debugdump as /usr/bin/nvidia-debugdump"
97
+
Jun 27 00:04:30 ipp2-0502 nvidia-ctk[1623461]: time="2025-06-27T00:04:30-04:00" level=info msg="Selecting /usr/bin/nvidia-persistenced as /usr/bin/nvidia-persistenced"
98
+
Jun 27 00:04:30 ipp2-0502 nvidia-ctk[1623461]: time="2025-06-27T00:04:30-04:00" level=info msg="Selecting /usr/bin/nvidia-cuda-mps-control as /usr/bin/nvidia-cuda-mps-control"
99
+
Jun 27 00:04:30 ipp2-0502 nvidia-ctk[1623461]: time="2025-06-27T00:04:30-04:00" level=info msg="Selecting /usr/bin/nvidia-cuda-mps-server as /usr/bin/nvidia-cuda-mps-server"
100
+
Jun 27 00:04:30 ipp2-0502 nvidia-ctk[1623461]: time="2025-06-27T00:04:30-04:00" level=warning msg="Could not locate nvidia-imex: pattern nvidia-imex not found"
101
+
Jun 27 00:04:30 ipp2-0502 nvidia-ctk[1623461]: time="2025-06-27T00:04:30-04:00" level=warning msg="Could not locate nvidia-imex-ctl: pattern nvidia-imex-ctl not found"
102
+
Jun 27 00:04:30 ipp2-0502 nvidia-ctk[1623461]: time="2025-06-27T00:04:30-04:00" level=info msg="Generated CDI spec with version 1.0.0"
103
+
Jun 27 00:04:30 ipp2-0502 systemd[1]: nvidia-cdi-refresh.service: Succeeded.
104
+
Jun 27 00:04:30 ipp2-0502 systemd[1]: Started Refresh NVIDIA CDI specification file.
105
+
106
+
# Enable/disable the automatic CDI refresh service
You can also view the service logs to see the output of the CDI generation process.
114
+
115
+
```console
116
+
# View service logs
117
+
$ sudo journalctl -u nvidia-cdi-refresh.service
118
+
```
119
+
120
+
### Manual CDI Specification Generation
121
+
122
+
If you need to manually generate a CDI specification, for example, after MIG configuration changes or if you are using a Container Toolkit version before v1.18.0, follow this procedure:
33
123
34
124
Two common locations for CDI specifications are `/etc/cdi/` and `/var/run/cdi/`.
35
125
The contents of the `/var/run/cdi/` directory are cleared on boot.
@@ -39,10 +129,10 @@ However, the path to create and use can depend on the container engine that you
0 commit comments