diff --git a/src/pkg/nvidia/nvidia.go b/src/pkg/nvidia/nvidia.go index fdb924063..b38e073bc 100644 --- a/src/pkg/nvidia/nvidia.go +++ b/src/pkg/nvidia/nvidia.go @@ -74,6 +74,13 @@ func GenerateCDISpec() (*specs.Spec, error) { return nil, errors.New("failed to initialize NVIDIA Management Library") } } + + defer func() { + if err := nvmLib.Shutdown(); err != nvml.SUCCESS { + logrus.Debugf("Generating Container Device Interface for NVIDIA: failed to shutdown NVML: %s", + err) + } + }() } else { logrus.Debugf("Generating Container Device Interface for NVIDIA: Management Library not found: %s", reason)