Merge pull request #376 from elezar/cherry-pick-v1.14.6

Cherry pick v1.14.6
This commit is contained in:
Evan Lezar 2024-02-27 16:55:22 +02:00 committed by GitHub
commit 5d246adf3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 24 additions and 3 deletions

View File

@ -1,6 +1,8 @@
# NVIDIA Container Toolkit Changelog # NVIDIA Container Toolkit Changelog
## v1.14.6
* Add support for extracting device major number from `/proc/devices` if `nvidia` is used as a device name over `nvidia-frontend`. * Add support for extracting device major number from `/proc/devices` if `nvidia` is used as a device name over `nvidia-frontend`.
* Add support for selecting IMEX channels using the NVIDIA_IMEX_CHANNELS environement variable.
## v1.14.5 ## v1.14.5
* Fix `nvidia-ctk runtime configure --cdi.enabled` for Docker. This was incorrectly setting `experimental = true` instead * Fix `nvidia-ctk runtime configure --cdi.enabled` for Docker. This was incorrectly setting `experimental = true` instead

View File

@ -9,9 +9,10 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/NVIDIA/nvidia-container-toolkit/internal/config/image"
"github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/mod/semver" "golang.org/x/mod/semver"
"github.com/NVIDIA/nvidia-container-toolkit/internal/config/image"
) )
const ( const (
@ -22,6 +23,7 @@ const (
envNVVisibleDevices = "NVIDIA_VISIBLE_DEVICES" envNVVisibleDevices = "NVIDIA_VISIBLE_DEVICES"
envNVMigConfigDevices = "NVIDIA_MIG_CONFIG_DEVICES" envNVMigConfigDevices = "NVIDIA_MIG_CONFIG_DEVICES"
envNVMigMonitorDevices = "NVIDIA_MIG_MONITOR_DEVICES" envNVMigMonitorDevices = "NVIDIA_MIG_MONITOR_DEVICES"
envNVImexChannels = "NVIDIA_IMEX_CHANNELS"
envNVDriverCapabilities = "NVIDIA_DRIVER_CAPABILITIES" envNVDriverCapabilities = "NVIDIA_DRIVER_CAPABILITIES"
) )
@ -37,6 +39,7 @@ type nvidiaConfig struct {
Devices string Devices string
MigConfigDevices string MigConfigDevices string
MigMonitorDevices string MigMonitorDevices string
ImexChannels string
DriverCapabilities string DriverCapabilities string
// Requirements defines the requirements DSL for the container to run. // Requirements defines the requirements DSL for the container to run.
// This is empty if no specific requirements are needed, or if requirements are // This is empty if no specific requirements are needed, or if requirements are
@ -271,6 +274,13 @@ func getMigMonitorDevices(env map[string]string) *string {
return nil return nil
} }
func getImexChannels(env map[string]string) *string {
if chans, ok := env[envNVImexChannels]; ok {
return &chans
}
return nil
}
func (c *HookConfig) getDriverCapabilities(env map[string]string, legacyImage bool) image.DriverCapabilities { func (c *HookConfig) getDriverCapabilities(env map[string]string, legacyImage bool) image.DriverCapabilities {
// We use the default driver capabilities by default. This is filtered to only include the // We use the default driver capabilities by default. This is filtered to only include the
// supported capabilities // supported capabilities
@ -324,6 +334,11 @@ func getNvidiaConfig(hookConfig *HookConfig, image image.CUDA, mounts []Mount, p
log.Panicln("cannot set MIG_MONITOR_DEVICES in non privileged container") log.Panicln("cannot set MIG_MONITOR_DEVICES in non privileged container")
} }
var imexChannels string
if c := getImexChannels(image); c != nil {
imexChannels = *c
}
driverCapabilities := hookConfig.getDriverCapabilities(image, legacyImage).String() driverCapabilities := hookConfig.getDriverCapabilities(image, legacyImage).String()
requirements, err := image.GetRequirements() requirements, err := image.GetRequirements()
@ -335,6 +350,7 @@ func getNvidiaConfig(hookConfig *HookConfig, image image.CUDA, mounts []Mount, p
Devices: devices, Devices: devices,
MigConfigDevices: migConfigDevices, MigConfigDevices: migConfigDevices,
MigMonitorDevices: migMonitorDevices, MigMonitorDevices: migMonitorDevices,
ImexChannels: imexChannels,
DriverCapabilities: driverCapabilities, DriverCapabilities: driverCapabilities,
Requirements: requirements, Requirements: requirements,
} }

View File

@ -126,6 +126,9 @@ func doPrestart() {
if len(nvidia.MigMonitorDevices) > 0 { if len(nvidia.MigMonitorDevices) > 0 {
args = append(args, fmt.Sprintf("--mig-monitor=%s", nvidia.MigMonitorDevices)) args = append(args, fmt.Sprintf("--mig-monitor=%s", nvidia.MigMonitorDevices))
} }
if len(nvidia.ImexChannels) > 0 {
args = append(args, fmt.Sprintf("--imex-channel=%s", nvidia.ImexChannels))
}
for _, cap := range strings.Split(nvidia.DriverCapabilities, ",") { for _, cap := range strings.Split(nvidia.DriverCapabilities, ",") {
if len(cap) == 0 { if len(cap) == 0 {

@ -1 +1 @@
Subproject commit 8971b92998844ea82beed7549a2dd3e3a5899310 Subproject commit d2eb0afe86f0b643e33624ee64f065dd60e952d4

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
LIB_NAME := nvidia-container-toolkit LIB_NAME := nvidia-container-toolkit
LIB_VERSION := 1.14.5 LIB_VERSION := 1.14.6
LIB_TAG := LIB_TAG :=
# The package version is the combination of the library version and tag. # The package version is the combination of the library version and tag.