mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 00:08:11 +00:00
Merge pull request #395 from elezar/add-nvidia-visible-devices-void
Add NVIDIA_VISIBLE_DEVICES=void to CDI specs
This commit is contained in:
commit
4806f6e70d
@ -6,6 +6,7 @@
|
|||||||
CDI spec to be generated that includes GPUs by index and UUID.
|
CDI spec to be generated that includes GPUs by index and UUID.
|
||||||
* Set the default `--device-name-strategy` for the `nvidia-ctk cdi generate` command to `[index, uuid]`.
|
* Set the default `--device-name-strategy` for the `nvidia-ctk cdi generate` command to `[index, uuid]`.
|
||||||
* Remove `libnvidia-container0` jetpack dependency included for legacy Tegra-based systems.
|
* Remove `libnvidia-container0` jetpack dependency included for legacy Tegra-based systems.
|
||||||
|
* Add `NVIDIA_VISIBLE_DEVICES=void` to generated CDI specifications.
|
||||||
|
|
||||||
* [toolkit-container] Remove centos7 image. The ubi8 image can be used on all RPM-based platforms.
|
* [toolkit-container] Remove centos7 image. The ubi8 image can be used on all RPM-based platforms.
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/NVIDIA/go-nvlib/pkg/nvlib/device"
|
"github.com/NVIDIA/go-nvlib/pkg/nvlib/device"
|
||||||
"github.com/NVIDIA/go-nvlib/pkg/nvlib/info"
|
"github.com/NVIDIA/go-nvlib/pkg/nvlib/info"
|
||||||
"github.com/NVIDIA/go-nvlib/pkg/nvml"
|
"github.com/NVIDIA/go-nvlib/pkg/nvml"
|
||||||
|
"tags.cncf.io/container-device-interface/pkg/cdi"
|
||||||
|
|
||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/logger"
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/logger"
|
||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/lookup/root"
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/lookup/root"
|
||||||
@ -162,6 +163,17 @@ func (l *wrapper) GetSpec() (spec.Interface, error) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetCommonEdits returns the wrapped edits and adds additional edits on top.
|
||||||
|
func (m *wrapper) GetCommonEdits() (*cdi.ContainerEdits, error) {
|
||||||
|
edits, err := m.Interface.GetCommonEdits()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
edits.Env = append(edits.Env, "NVIDIA_VISIBLE_DEVICES=void")
|
||||||
|
|
||||||
|
return edits, nil
|
||||||
|
}
|
||||||
|
|
||||||
// resolveMode resolves the mode for CDI spec generation based on the current system.
|
// resolveMode resolves the mode for CDI spec generation based on the current system.
|
||||||
func (l *nvcdilib) resolveMode() (rmode string) {
|
func (l *nvcdilib) resolveMode() (rmode string) {
|
||||||
if l.mode != ModeAuto {
|
if l.mode != ModeAuto {
|
||||||
|
Loading…
Reference in New Issue
Block a user