【AI】10卡的GPU服务器,Docker 配置 docker-compose.yml 限制指定使用最后两块GPU 序号8,9

GPU状态

复制代码
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 570.86.10              Driver Version: 570.86.10      CUDA Version: 12.8     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 4090        Off |   00000000:0C:00.0 Off |                  Off |
| 30%   26C    P8             18W /  450W |   23393MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   1  NVIDIA GeForce RTX 4090        Off |   00000000:25:00.0 Off |                  Off |
| 30%   27C    P8             28W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   2  NVIDIA GeForce RTX 4090        Off |   00000000:32:00.0 Off |                  Off |
| 30%   27C    P8              6W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   3  NVIDIA GeForce RTX 4090        Off |   00000000:45:00.0 Off |                  Off |
| 30%   27C    P8             18W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   4  NVIDIA GeForce RTX 4090        Off |   00000000:58:00.0 Off |                  Off |
| 30%   28C    P8             24W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   5  NVIDIA GeForce RTX 4090        Off |   00000000:84:00.0 Off |                  Off |
| 30%   27C    P8             21W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   6  NVIDIA GeForce RTX 4090        Off |   00000000:98:00.0 Off |                  Off |
| 30%   26C    P8             16W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   7  NVIDIA GeForce RTX 4090        Off |   00000000:AC:00.0 Off |                  Off |
| 30%   28C    P8             27W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   8  NVIDIA GeForce RTX 4090        Off |   00000000:C0:00.0 Off |                  Off |
| 30%   27C    P8             22W /  450W |     439MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   9  NVIDIA GeForce RTX 4090        Off |   00000000:D4:00.0 Off |                  Off |
| 30%   25C    P8             22W /  450W |       4MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

配置docker-compose.yml

services:

ragflow:

environment:

  • NVIDIA_VISIBLE_DEVICES=0,1 # 内部序号还是0,1 不是外部的8,9

deploy:

resources:

reservations:

devices:

  • driver: nvidia

device_ids: "8","9"

capabilities: gpu

注意:

  1. 内部环境变量仍然是0,1

  2. device_ids参数是字符串数组,不是整形数组

效果:

docker exec -it ragflow-server nvidia-smi

Thu Mar 27 00:23:16 2025

+-----------------------------------------------------------------------------------------+

| NVIDIA-SMI 570.86.10 Driver Version: 570.86.10 CUDA Version: 12.8 |

|-----------------------------------------+------------------------+----------------------+

| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |

| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |

| | | MIG M. |

|=========================================+========================+======================|

| 0 NVIDIA GeForce RTX 4090 Off | 00000000:C0:00.0 Off | Off |

| 30% 25C P8 22W / 450W | 439MiB / 24564MiB | 0% Default |

| | | N/A |

+-----------------------------------------+------------------------+----------------------+

| 1 NVIDIA GeForce RTX 4090 Off | 00000000:D4:00.0 Off | Off |

| 30% 23C P8 22W / 450W | 4MiB / 24564MiB | 0% Default |

| | | N/A |

+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+

| Processes: |

| GPU GI CI PID Type Process name GPU Memory |

| ID ID Usage |

|=========================================================================================|

| 0 N/A N/A 18 C python3 430MiB |

+-----------------------------------------------------------------------------------------+

观察GPU内存,可以确认容器内部是使用末尾的两块GPU

相关推荐
小宋10212 小时前
Chrome 的 AI 功能在后台偷跑流量:把端侧模型做成可版本化的分发制品,用下载资格门控、差分更新与「下载未使用率」验收
大数据·人工智能·chrome
小猪写代码2 小时前
AI核心概念解析
人工智能
xieyan08113 小时前
企业 Agent 底座怎么选?我选了 Open WebUI
人工智能
`Levie3 小时前
Docker-安装部署、容器管理(一)
docker·容器·eureka
NicOoole1233 小时前
AI自动做短视频并分发是什么?
大数据·人工智能
fly-iot4 小时前
【摩尔线程S4000卡】执行Qwen3-14B-W8A8 量化、启动与接口性能测试报告,结果更慢了13 tok/s
人工智能·语言模型
budingxiaomoli5 小时前
LangChain与LangGraph介绍
人工智能·langchain
龙腾AI白云5 小时前
触觉预测与接触动力学:具身智能摸懂世界的底层机制
大数据·人工智能·机器学习·知识图谱·pygame