From 4faed94d75abe95df2be9f7b1263d22df2347fed Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Mon, 17 Feb 2025 14:01:29 +0100 Subject: [PATCH] Add disable-cuda-compat-lib-hook feature flag Signed-off-by: Evan Lezar --- internal/config/features.go | 6 ++++++ internal/modifier/gated.go | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/config/features.go b/internal/config/features.go index 0d511398..a326e4ee 100644 --- a/internal/config/features.go +++ b/internal/config/features.go @@ -25,6 +25,12 @@ type features struct { // If this feature flag is not set to 'true' only host-rooted config paths // (i.e. paths starting with an '@' are considered valid) AllowLDConfigFromContainer *feature `toml:"allow-ldconfig-from-container,omitempty"` + // DisableCUDACompatLibHook, when enabled skips the injection of a specific + // hook to process CUDA compatibility libraries. + // + // Note: Since this mechanism replaces the logic in the `nvidia-container-cli`, + // toggling this feature has no effect if `allow-cuda-compat-libs-from-container` is enabled. + DisableCUDACompatLibHook *feature `toml:"disable-cuda-compat-lib-hook,omitempty"` // DisableImexChannelCreation ensures that the implicit creation of // requested IMEX channels is skipped when invoking the nvidia-container-cli. DisableImexChannelCreation *feature `toml:"disable-imex-channel-creation,omitempty"` diff --git a/internal/modifier/gated.go b/internal/modifier/gated.go index 6902e7a3..8320286e 100644 --- a/internal/modifier/gated.go +++ b/internal/modifier/gated.go @@ -79,9 +79,11 @@ func NewFeatureGatedModifier(logger logger.Interface, cfg *config.Config, image discoverers = append(discoverers, d) } - if !cfg.Features.AllowCUDACompatLibsFromContainer.IsEnabled() { + if !cfg.Features.AllowCUDACompatLibsFromContainer.IsEnabled() && !cfg.Features.DisableCUDACompatLibHook.IsEnabled() { compatLibHookDiscoverer := discover.NewCUDACompatHookDiscoverer(logger, cfg.NVIDIACTKConfig.Path, driver) discoverers = append(discoverers, compatLibHookDiscoverer) + // For legacy mode, we also need to inject a hook to update the LDCache + // after we have modifed the configuration. if cfg.NVIDIAContainerRuntimeConfig.Mode == "legacy" { ldcacheUpdateHookDiscoverer, err := discover.NewLDCacheUpdateHook( logger,