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]
注意:
-
内部环境变量仍然是0,1
-
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