mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 08:18:32 +00:00
Make NewVisibleDevices public
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
25759ca933
commit
429ef4d4e9
@ -135,15 +135,15 @@ func (i CUDA) DevicesFromEnvvars(envVars ...string) VisibleDevices {
|
|||||||
|
|
||||||
// Environment variable unset with legacy image: default to "all".
|
// Environment variable unset with legacy image: default to "all".
|
||||||
if !isSet && len(devices) == 0 && i.IsLegacy() {
|
if !isSet && len(devices) == 0 && i.IsLegacy() {
|
||||||
return newVisibleDevices("all")
|
return NewVisibleDevices("all")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Environment variable unset or empty or "void": return nil
|
// Environment variable unset or empty or "void": return nil
|
||||||
if len(devices) == 0 || requested["void"] {
|
if len(devices) == 0 || requested["void"] {
|
||||||
return newVisibleDevices("void")
|
return NewVisibleDevices("void")
|
||||||
}
|
}
|
||||||
|
|
||||||
return newVisibleDevices(devices...)
|
return NewVisibleDevices(devices...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDriverCapabilities returns the requested driver capabilities.
|
// GetDriverCapabilities returns the requested driver capabilities.
|
||||||
|
@ -32,8 +32,8 @@ var _ VisibleDevices = (*none)(nil)
|
|||||||
var _ VisibleDevices = (*void)(nil)
|
var _ VisibleDevices = (*void)(nil)
|
||||||
var _ VisibleDevices = (*devices)(nil)
|
var _ VisibleDevices = (*devices)(nil)
|
||||||
|
|
||||||
// newVisibleDevices creates a VisibleDevices based on the value of the specified envvar.
|
// NewVisibleDevices creates a VisibleDevices based on the value of the specified envvar.
|
||||||
func newVisibleDevices(envvars ...string) VisibleDevices {
|
func NewVisibleDevices(envvars ...string) VisibleDevices {
|
||||||
for _, envvar := range envvars {
|
for _, envvar := range envvars {
|
||||||
if envvar == "all" {
|
if envvar == "all" {
|
||||||
return all{}
|
return all{}
|
||||||
|
Loading…
Reference in New Issue
Block a user