Fix bug where docker swarm device selection is overriden by NVIDIA_VISIBLE_DEVICES

This change fixes a bug where the value of NVIDIA_VISIBLE_DEVICES would be used to
select devices even if the `swarm-resource` config option is specified.

Note that this does not change the value of NVIDIA_VISIBLE_DEVICES in the container.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2021-06-07 14:02:10 +02:00
parent 602eaf0e60
commit 2a92d6acb7
2 changed files with 191 additions and 0 deletions

View File

@@ -216,6 +216,7 @@ func getDevicesFromEnvvar(env map[string]string, legacyImage bool) *string {
for _, envVar := range envVars {
if devs, ok := env[envVar]; ok {
devices = &devs
break
}
}