Skip to content

Commit

Permalink
pkg/nvidia: Clean up NVIDIA Management Library when no longer in use
Browse files Browse the repository at this point in the history
The NVIDIA Management Library API expects nvmlShutdown() to be called
once it's no longer in use [1].

Fallout from 8dd2f8e

[1] https://docs.nvidia.com/deploy/nvml-api/group__nvmlInitializationAndCleanup.html

#1555
  • Loading branch information
debarshiray committed Sep 29, 2024
1 parent 1d6b0b9 commit 5eb3e85
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/pkg/nvidia/nvidia.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5eb3e85

Please sign in to comment.