mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-21 15:57:49 +00:00
Ensure that nvsandboxutils is available for version
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
19482dac6f
commit
7cd2aef0d8
@ -263,6 +263,10 @@ func (l *nvcdilib) getCudaVersionNvml() (string, error) {
|
||||
}
|
||||
|
||||
func (l *nvcdilib) getCudaVersionNvsandboxutils() (string, error) {
|
||||
if l.nvsandboxutilslib == nil {
|
||||
return "", fmt.Errorf("libnvsandboxutils is not available")
|
||||
}
|
||||
|
||||
// Sandboxutils initialization should happen before this function is called
|
||||
version, ret := l.nvsandboxutilslib.GetDriverVersion()
|
||||
if ret != nvsandboxutils.SUCCESS {
|
||||
|
@ -28,6 +28,7 @@ import (
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/discover"
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/edits"
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/lookup/cuda"
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/nvsandboxutils"
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec"
|
||||
)
|
||||
|
||||
@ -61,6 +62,19 @@ func (m *managementlib) GetAllDeviceSpecs() ([]specs.Device, error) {
|
||||
|
||||
// GetCommonEdits returns the common edits for use in managementlib containers.
|
||||
func (m *managementlib) GetCommonEdits() (*cdi.ContainerEdits, error) {
|
||||
if m.nvsandboxutilslib != nil {
|
||||
if r := m.nvsandboxutilslib.Init(m.driverRoot); r != nvsandboxutils.SUCCESS {
|
||||
m.logger.Warningf("Failed to init nvsandboxutils: %v; ignoring", r)
|
||||
m.nvsandboxutilslib = nil
|
||||
}
|
||||
defer func() {
|
||||
if m.nvsandboxutilslib == nil {
|
||||
return
|
||||
}
|
||||
_ = m.nvsandboxutilslib.Shutdown()
|
||||
}()
|
||||
}
|
||||
|
||||
version, err := m.getCudaVersion()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get CUDA version: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user