On a machine with multiple Nvidia GPUs, is there a way to specify in the docker-compose.yml
file that we want to use two specific GPU device IDs in the Docker container?
The following seems to be the equivalent of docker run --gpus=allsince all the GPUs are listed when running
nvidia-smi` inside the Docker container.
deploy:
resources:
reservations:
devices:
- driver: nvidia
capabilities: [gpu]
CodePudding user response:
You may use device_ids
or count
.
For example, to allow only GPUs with ID 0
and 3
:
deploy:
resources:
reservations:
devices:
- driver: nvidia
device_ids: ['0', '3']
capabilities: [gpu]