mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 08:18:32 +00:00
Split isLegacyCUDAImage() into its own helper function
Signed-off-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
parent
0a9dc3c653
commit
a24b0c8b4e
@ -192,6 +192,12 @@ func isPrivileged(s *Spec) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isLegacyCUDAImage(env map[string]string) bool {
|
||||||
|
legacyCudaVersion := env[envCUDAVersion]
|
||||||
|
cudaRequire := env[envNVRequireCUDA]
|
||||||
|
return len(legacyCudaVersion) > 0 && len(cudaRequire) == 0
|
||||||
|
}
|
||||||
|
|
||||||
func getDevices(env map[string]string) *string {
|
func getDevices(env map[string]string) *string {
|
||||||
gpuVars := []string{envNVVisibleDevices}
|
gpuVars := []string{envNVVisibleDevices}
|
||||||
if envSwarmGPU != nil {
|
if envSwarmGPU != nil {
|
||||||
@ -313,10 +319,7 @@ func getNvidiaConfigLegacy(env map[string]string, privileged bool) *nvidiaConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getNvidiaConfig(env map[string]string, privileged bool) *nvidiaConfig {
|
func getNvidiaConfig(env map[string]string, privileged bool) *nvidiaConfig {
|
||||||
legacyCudaVersion := env[envCUDAVersion]
|
if isLegacyCUDAImage(env) {
|
||||||
cudaRequire := env[envNVRequireCUDA]
|
|
||||||
if len(legacyCudaVersion) > 0 && len(cudaRequire) == 0 {
|
|
||||||
// Legacy CUDA image detected.
|
|
||||||
return getNvidiaConfigLegacy(env, privileged)
|
return getNvidiaConfigLegacy(env, privileged)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user