@@ -143,8 +143,8 @@ func (i CUDA) HasDisableRequire() bool {
143143 return false
144144}
145145
146- // DevicesFromEnvvars returns the devices requested by the image through environment variables
147- func (i CUDA ) DevicesFromEnvvars (envVars ... string ) VisibleDevices {
146+ // devicesFromEnvvars returns the devices requested by the image through environment variables
147+ func (i CUDA ) devicesFromEnvvars (envVars ... string ) [] string {
148148 // We concantenate all the devices from the specified env.
149149 var isSet bool
150150 var devices []string
@@ -165,15 +165,15 @@ func (i CUDA) DevicesFromEnvvars(envVars ...string) VisibleDevices {
165165
166166 // Environment variable unset with legacy image: default to "all".
167167 if ! isSet && len (devices ) == 0 && i .IsLegacy () {
168- return NewVisibleDevices ( "all" )
168+ devices = [] string { "all" }
169169 }
170170
171171 // Environment variable unset or empty or "void": return nil
172172 if len (devices ) == 0 || requested ["void" ] {
173- return NewVisibleDevices ( "void" )
173+ devices = [] string { "void" }
174174 }
175175
176- return NewVisibleDevices (devices ... )
176+ return NewVisibleDevices (devices ... ). List ()
177177}
178178
179179// GetDriverCapabilities returns the requested driver capabilities.
@@ -319,7 +319,7 @@ func (i CUDA) cdiDeviceRequestsFromAnnotations() []string {
319319// NVIDIA_VISIBLE_DEVICES environment variable is used.
320320func (i CUDA ) visibleDevicesFromEnvVar () []string {
321321 envVars := i .visibleEnvVars ()
322- return i .DevicesFromEnvvars (envVars ... ). List ( )
322+ return i .devicesFromEnvvars (envVars ... )
323323}
324324
325325// visibleDevicesFromMounts returns the set of visible devices requested as mounts.
@@ -405,7 +405,7 @@ func (m cdiDeviceMountRequest) qualifiedName() (string, error) {
405405
406406// ImexChannelsFromEnvVar returns the list of IMEX channels requested for the image.
407407func (i CUDA ) ImexChannelsFromEnvVar () []string {
408- imexChannels := i .DevicesFromEnvvars (EnvVarNvidiaImexChannels ). List ( )
408+ imexChannels := i .devicesFromEnvvars (EnvVarNvidiaImexChannels )
409409 if len (imexChannels ) == 1 && imexChannels [0 ] == "all" {
410410 return nil
411411 }
0 commit comments