mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-25 13:35:00 +00:00
Merge pull request #515 from elezar/fix-cdi-construction
Ensure consistent construction order for libs
This commit is contained in:
commit
b407109bdf
@ -81,14 +81,25 @@ func New(opts ...Option) (Interface, error) {
|
|||||||
indexNamer, _ := NewDeviceNamer(DeviceNameStrategyIndex)
|
indexNamer, _ := NewDeviceNamer(DeviceNameStrategyIndex)
|
||||||
l.deviceNamers = []DeviceNamer{indexNamer}
|
l.deviceNamers = []DeviceNamer{indexNamer}
|
||||||
}
|
}
|
||||||
|
if l.nvidiaCDIHookPath == "" {
|
||||||
|
l.nvidiaCDIHookPath = "/usr/bin/nvidia-cdi-hook"
|
||||||
|
}
|
||||||
if l.driverRoot == "" {
|
if l.driverRoot == "" {
|
||||||
l.driverRoot = "/"
|
l.driverRoot = "/"
|
||||||
}
|
}
|
||||||
if l.devRoot == "" {
|
if l.devRoot == "" {
|
||||||
l.devRoot = l.driverRoot
|
l.devRoot = l.driverRoot
|
||||||
}
|
}
|
||||||
if l.nvidiaCDIHookPath == "" {
|
l.driver = root.New(
|
||||||
l.nvidiaCDIHookPath = "/usr/bin/nvidia-cdi-hook"
|
root.WithLogger(l.logger),
|
||||||
|
root.WithDriverRoot(l.driverRoot),
|
||||||
|
root.WithLibrarySearchPaths(l.librarySearchPaths...),
|
||||||
|
)
|
||||||
|
if l.nvmllib == nil {
|
||||||
|
l.nvmllib = nvml.New()
|
||||||
|
}
|
||||||
|
if l.devicelib == nil {
|
||||||
|
l.devicelib = device.New(device.WithNvml(l.nvmllib))
|
||||||
}
|
}
|
||||||
if l.infolib == nil {
|
if l.infolib == nil {
|
||||||
l.infolib = info.New(
|
l.infolib = info.New(
|
||||||
@ -99,12 +110,6 @@ func New(opts ...Option) (Interface, error) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
l.driver = root.New(
|
|
||||||
root.WithLogger(l.logger),
|
|
||||||
root.WithDriverRoot(l.driverRoot),
|
|
||||||
root.WithLibrarySearchPaths(l.librarySearchPaths...),
|
|
||||||
)
|
|
||||||
|
|
||||||
var lib Interface
|
var lib Interface
|
||||||
switch l.resolveMode() {
|
switch l.resolveMode() {
|
||||||
case ModeCSV:
|
case ModeCSV:
|
||||||
@ -118,13 +123,6 @@ func New(opts ...Option) (Interface, error) {
|
|||||||
}
|
}
|
||||||
lib = (*managementlib)(l)
|
lib = (*managementlib)(l)
|
||||||
case ModeNvml:
|
case ModeNvml:
|
||||||
if l.nvmllib == nil {
|
|
||||||
l.nvmllib = nvml.New()
|
|
||||||
}
|
|
||||||
if l.devicelib == nil {
|
|
||||||
l.devicelib = device.New(device.WithNvml(l.nvmllib))
|
|
||||||
}
|
|
||||||
|
|
||||||
lib = (*nvmllib)(l)
|
lib = (*nvmllib)(l)
|
||||||
case ModeWsl:
|
case ModeWsl:
|
||||||
lib = (*wsllib)(l)
|
lib = (*wsllib)(l)
|
||||||
|
Loading…
Reference in New Issue
Block a user