docker使用GPU

发布于 2024-03-07 16:11:10阅读 1270

只能使用支持 cuda 的 nvidia 显卡,其他不行😭

docker run

https://docs.docker.com/config/containers/resource_constraints/#gpu

--gpus all

docker run -it --rm --gpus all nvidia/cuda:12.3.1-base-ubuntu20.04 nvidia-smi

docker compose

https://docs.docker.com/compose/gpu-support/

services:
  test:
    image: nvidia/cuda:12.3.1-base-ubuntu20.04
    command: nvidia-smi
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

广而告之,我的新作品《语音助手》上架Google Play了,欢迎下载体验