docker-compose 版本 1.29.1 是否支持 --gpus 参数?如果没有,是否有其他参数支持在 docker-compose 1.29.1 中设置 GPU 的使用?
--gpus
参数与命令一起使用docker
。GPU 配置在以下docker-compose
时间内完成docker-compose.yml
:
runtime
选项(旧v2.3
格式)version: "2.3"
services:
test:
image: nvidia/cuda:10.2-base
command: nvidia-smi
runtime: nvidia # <- this option
Run Code Online (Sandbox Code Playgroud)
device
结构(自 docker-compose v1.28.0 起)version: "3.8"
services:
test:
image: nvidia/cuda:10.2-base
command: nvidia-smi
deploy:
resources:
reservations:
devices:
- driver: nvidia
# that's the closest analogue to --gpus; provide
# an integer amount of devices or 'all'
count: 1
# Devices are reserved using a list of capabilities, making
# capabilities the only required field. A device MUST
# satisfy all the requested capabilities for a successful
# reservation.
capabilities: [gpu]
Run Code Online (Sandbox Code Playgroud)
后者可能看起来有点复杂,但有一个指南解释了两者(使用 Compose 启用 GPU 访问 ),并且可以从Compose 规范中获取一些额外信息。
归档时间: |
|
查看次数: |
2517 次 |
最近记录: |