Make NewVisibleDevices public

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2022-11-14 12:19:59 +01:00
parent 25759ca933
commit 429ef4d4e9
2 changed files with 5 additions and 5 deletions

View File

@ -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.

View File

@ -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{}