From 2310ed76d8b67ac7477467fe3f374ff0a319b4a7 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Fri, 10 Jan 2025 10:30:39 +0100 Subject: [PATCH] Add allow-cuda-compat-libs-from-container feature flag This change adds an allow-cuda-compat-libs-from-container feature flag to the NVIDIA Container Toolkit config. This allows a user to opt-in to the previous default behaviour of overriding certain driver libraries with CUDA compat libraries from the container. Signed-off-by: Evan Lezar --- cmd/nvidia-container-runtime-hook/main.go | 5 +++-- internal/config/features.go | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/nvidia-container-runtime-hook/main.go b/cmd/nvidia-container-runtime-hook/main.go index c9380800..e864a51d 100644 --- a/cmd/nvidia-container-runtime-hook/main.go +++ b/cmd/nvidia-container-runtime-hook/main.go @@ -114,8 +114,9 @@ func doPrestart() { } args = append(args, "configure") - args = append(args, "--no-cntlibs") - + if !hook.Features.AllowCUDACompatLibsFromContainer.IsEnabled() { + args = append(args, "--no-cntlibs") + } if ldconfigPath := cli.NormalizeLDConfigPath(); ldconfigPath != "" { args = append(args, fmt.Sprintf("--ldconfig=%s", ldconfigPath)) } diff --git a/internal/config/features.go b/internal/config/features.go index 396e0b8c..0d511398 100644 --- a/internal/config/features.go +++ b/internal/config/features.go @@ -18,6 +18,9 @@ package config // features specifies a set of named features. type features struct { + // AllowCUDACompatLibsFromContainer allows CUDA compat libs from a container + // to override certain driver library mounts from the host. + AllowCUDACompatLibsFromContainer *feature `toml:"allow-cuda-compat-libs-from-container,omitempty"` // AllowLDConfigFromContainer allows non-host ldconfig paths to be used. // If this feature flag is not set to 'true' only host-rooted config paths // (i.e. paths starting with an '@' are considered valid)