# Docker doesn't detect MIG gpu devices

**URL:** <https://forums.developer.nvidia.com/t/docker-doesnt-detect-mig-gpu-devices/201921>\
**Category:** DGX Systems (DATA CENTER)\
**Tags:** docker\
**Created:** [January 28, 2022, 4:35pm UTC](https://forums.developer.nvidia.com/t/docker-doesnt-detect-mig-gpu-devices/201921 "2022-01-28T16:35:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![leo2105](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/leo2105/32/27757_2.png) [@leo2105](https://forums.developer.nvidia.com/u/leo2105)\
**Post date:** [January 28, 2022, 4:35pm UTC](https://forums.developer.nvidia.com/t/docker-doesnt-detect-mig-gpu-devices/201921/1 "2022-01-28T16:35:11Z")

</div>

Hi, I training MNIST on a DGX of A100-SXM4-40GB with MIG (multi instance GPUs) using docker but it only detects the first gpu.

docker version : 20.10.7

I am using this command:

> docker run --gpus ‘“device=2:0,3:1,5:1”’ [nvcr.io/nvidia/pytorch:20.11-py3](http://nvcr.io/nvidia/pytorch:20.11-py3) [http://nvcr.io/nvidia/pytorch:20.11-py3](http://nvcr.io/nvidia/pytorch:20.11-py3) /bin/bash -c 'cd /opt/pytorch/examples/upstream/mnist && python main.py

An image of nvidia-smi, where just the first gpu is being used.

 ![image](https://global.discourse-cdn.com/nvidia/original/3X/d/a/da8b24abf481111f62a6614e2d6a88286e8bb2bc.png)

When I am training another model in TAO I got a similar problem, but I think its related to the above one.

`tlt_1 | tensorflow.python.framework.errors_impl.InvalidArgumentError: 'visible_device_list' listed an invalid GPU id '2' but visible device count is 1`

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![ScottEllis](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/scottellis/32/14043_2.png) [@ScottEllis](https://forums.developer.nvidia.com/u/ScottEllis)\
**Post date:** [January 31, 2022, 6:51pm UTC](https://forums.developer.nvidia.com/t/docker-doesnt-detect-mig-gpu-devices/201921/2 "2022-01-31T18:51:47Z")

</div>

As a sanity check, does this happen when you use the device names as `MIG-` like described by [https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#running-containers](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#running-containers) ?

ScottE

---

<div class="post-metadata">

**Author:** ![leo2105](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/leo2105/32/27757_2.png) [@leo2105](https://forums.developer.nvidia.com/u/leo2105)\
**Post date:** [February 1, 2022, 2:27pm UTC](https://forums.developer.nvidia.com/t/docker-doesnt-detect-mig-gpu-devices/201921/3 "2022-02-01T14:27:47Z")

</div>

I used that names too:

` docker run --rm -it --gpus '"device=MIG-6b1e9520-11da-5757-b9df-8ac6a3d9a78f,MIG-10d8cd6b-6356-557a-9ed4-fe10edf9e394,MIG-ecf7a5d7-fd31-5554-a5e4-42717ccdf584"' nvcr.io/nvidia/pytorch:20.11-py3 /bin/bash`

but same results, its only running on the first gpu.

---

<div class="post-metadata">

**Author:** ![ScottEllis](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/scottellis/32/14043_2.png) [@ScottEllis](https://forums.developer.nvidia.com/u/ScottEllis)\
**Post date:** [February 1, 2022, 6:24pm UTC](https://forums.developer.nvidia.com/t/docker-doesnt-detect-mig-gpu-devices/201921/4 "2022-02-01T18:24:05Z")

</div>

Ah, I get what you’re saying now @leo2105 .

When using MIG, a single application can only actually execute on a single “GPU” (aka MIG device). You could run two different PyTorch instances inside the container, each using a different slice, but a single instance can only access one slice.

---

<div class="post-metadata">

**Author:** ![leo2105](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/leo2105/32/27757_2.png) [@leo2105](https://forums.developer.nvidia.com/u/leo2105)\
**Post date:** [February 1, 2022, 6:29pm UTC](https://forums.developer.nvidia.com/t/docker-doesnt-detect-mig-gpu-devices/201921/5 "2022-02-01T18:29:37Z")

</div>

So, you are saying that I can’t train TAO models in DGX with MIG at scale, I mean using more than 1 gpu?

---

<div class="post-metadata">

**Author:** ![ScottEllis](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/scottellis/32/14043_2.png) [@ScottEllis](https://forums.developer.nvidia.com/u/ScottEllis)\
**Post date:** [February 1, 2022, 7:01pm UTC](https://forums.developer.nvidia.com/t/docker-doesnt-detect-mig-gpu-devices/201921/6 "2022-02-01T19:01:39Z")

</div>

Correct. You can disable MIG on the GPUs and do multi-GPU training on the DGX though.

---

<div class="post-metadata">

**Author:** ![leo2105](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/leo2105/32/27757_2.png) [@leo2105](https://forums.developer.nvidia.com/u/leo2105)\
**Post date:** [February 8, 2022, 8:52pm UTC](https://forums.developer.nvidia.com/t/docker-doesnt-detect-mig-gpu-devices/201921/7 "2022-02-08T20:52:20Z")

</div>

Hi @ScottEllis, I have one more doubt related to what you said before,

> “When using MIG, a single application can only actually execute on a single ‘GPU’ (aka MIG device). You could run two different PyTorch instances inside the container, each using a different slice, but a single instance can only access one slice.”

It applies for all applications? for example, Tensorflow, Triton, Deepstream, TAO, etc.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![jbarciv](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/jbarciv/32/251164_2.png) [@jbarciv](https://forums.developer.nvidia.com/u/jbarciv)\
**Post date:** [May 11, 2023, 9:06am UTC](https://forums.developer.nvidia.com/t/docker-doesnt-detect-mig-gpu-devices/201921/8 "2023-05-11T09:06:38Z")

</div>

Hi, I’m experiencing the same issue as @leo2105. I would like to partition my A30 GPU into four segments and develop a program that utilizes all segments simultaneously to accelerate the inference during the training process.  
Currently, when I attempt to identify the instances from TensorFlow after creating the partitions using the appropriate MIG commands, I can only detect the first instance.  
Is something only for TF? Is there any possibility with MIG for that?

Thanks
