iT邦幫忙

12

【求助】顯卡/主板 支援 PCIe4.0 為何 Host to Device (H2D) 只剩 Gen1 速度 (0.5 GB/s) ?

  • 分享至 

  • xImage

前言

最近使用 AI Server 時發現訓練模型的 DataLoader 很慢,於是我測試 GPU Server 的 PCIe 傳輸效能時,發現一個奇怪的現象:雖然主機板與 CPU 都標榜支援 PCIe Gen4 x16,但實際測試 Host to Device (H2D) 帶寬卻只有 Gen1 水準 (0.5 GB/s)。想請教大家可能的原因與解決方式。

環境

  • CPU: Intel® Xeon® Silver 4310 @ 2.10 GHz (支援到 PCIe 64)
  • GPU: NVIDIA RTX A6000 * 2、RTX 3090 * 2
  • 主機板: Supermicro X12SPA-TF (BIOS v1.01)
  • 系統: Ubuntu 24.04
  • 顯卡驅動: CUDA 12.4

測試工具

CUDA Samples v12.4 (NVIDIA/cuda-samples)

基礎環境檢視

使用 lspci 檢查
傳輸閒置時:在待機給最低 Gen1 速度合理

LnkCap: Port #0, Speed 16GT/s, Width x16
LnkSta: Speed 2.5GT/s (downgraded), Width x16 (ok)

傳輸中:有提升至 Gen4x16 也合理

LnkCap: Port #0, Speed 16GT/s, Width x16
LnkSta: Speed 16GT/s (ok), Width x16 (ok)

CUDA bandwidthTest (pinned memory)
我是透過 Github 上 NVIDIA/cuda-samples Releases v12.4 版本測試
使用指令為:

./Samples/1_Utilities/bandwidthTest/bandwidthTest --memory=pinned --device=4

輸出結果: 以 Device 發起的傳輸速度都正常,從 CPU 提供的傳輸 (H2D) 受到限制 (Gen1),很不合理

Host to Device Bandwidth: 0.5 GB/s
Device to Host Bandwidth: 26.3 GB/s
Device to Device Bandwidth: 720.9 GB/s

拓樸 (nvidia-smi topo -m)
這邊單純做一個觀察: 其中 A6000 有使用 NVLink

	GPU0	GPU1	GPU2	GPU3	CPU Affinity	NUMA Affinity
GPU0	 X 	SYS	SYS	SYS	0-23	0
GPU1	SYS	 X 	NV4	SYS	0-23	0
GPU2	SYS	NV4	 X 	SYS	0-23	0
GPU3	SYS	SYS	SYS	 X 	0-23	0

PCI 流程 以最後一張 3090 為例

  1. 17:00.0: PCIe Root Port(CPU 直接提供的 PCIe 插槽)。
  2. 17:02.0: PCIe Switch / Bridge,也就是一個轉接點。
  3. 18:00.0: NVIDIA GeForce RTX 3090 GPU 本體 (VGA Controller)。
(base) louis900412@server:~$ lspci -tv | egrep -i 'NVIDIA|09a2'
 +-[0000:c2]-+-00.0  Intel Corporation Device 09a2
 |           \-02.0-[c3]--+-00.0  NVIDIA Corporation GA102 [GeForce RTX 3090]
 |                        \-00.1  NVIDIA Corporation GA102 High Definition Audio Controller
 +-[0000:89]-+-00.0  Intel Corporation Device 09a2
 |           \-02.0-[8a]--+-00.0  NVIDIA Corporation GA102GL [RTX A6000]
 |                        \-00.1  NVIDIA Corporation GA102 High Definition Audio Controller
 +-[0000:50]-+-00.0  Intel Corporation Device 09a2
 |           \-02.0-[51]--+-00.0  NVIDIA Corporation GA102GL [RTX A6000]
 |                        \-00.1  NVIDIA Corporation GA102 High Definition Audio Controller
 +-[0000:17]-+-00.0  Intel Corporation Device 09a2
 |           \-02.0-[18]--+-00.0  NVIDIA Corporation GA102 [GeForce RTX 3090]
 |                        \-00.1  NVIDIA Corporation GA102 High Definition Audio Controller
 \-[0000:00]-+-00.0  Intel Corporation Device 09a2

最高傳輸寬帶 Max Payload Size (MPS) / Max Read Request Size (MRRS)
觀察到即使 17:02.0, 18:00.0 都給到 256 bytes,但 17:00.0 也只有 128 bytes,這部分也是納悶,因為我在 BIOS 中都將 MPS/MRRS 設定為最高 512 與 4096。

sudo lspci -vv -s 17:00.0 | egrep -i 'DevCtl|MaxPayload|MaxReadReq'
		DevCap:	MaxPayload 128 bytes, PhantFunc 0
		DevCtl:	CorrErr- NonFatalErr- FatalErr- UnsupReq-
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR- OBFF Disabled,
        
sudo lspci -vv -s 17:02.0 | egrep -i 'DevCtl|MaxPayload|MaxReadReq'
		DevCap:	MaxPayload 256 bytes, PhantFunc 0
		DevCtl:	CorrErr- NonFatalErr- FatalErr+ UnsupReq-
			MaxPayload 256 bytes, MaxReadReq 256 bytes
		DevCtl2: Completion Timeout: 260ms to 900ms, TimeoutDis- LTR- OBFF Disabled, ARIFwd-

sudo lspci -vv -s 18:00.0 | egrep -i 'DevCtl|MaxPayload|MaxReadReq'
		DevCap:	MaxPayload 256 bytes, PhantFunc 0, Latency L0s unlimited, L1 <64us
		DevCtl:	CorrErr- NonFatalErr- FatalErr+ UnsupReq-
			MaxPayload 256 bytes, MaxReadReq 256 bytes
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR- OBFF Disabled,

BIOS 設定

  • Max Payload Size (MPS) / Max Read Request Size (MRRS): BIOS 中設定最大 512/4096
  • IOU0,1,3,4 都設定為 x16
  • CPU SLOT1,3,5,7 (PCI-E 4.0 x16) 都設定 Gen4,開啟 Re-Train 與 Max Payload Size
  • CPU SLOT2,4,6 無法設定,預設應該是 x8。但顯卡是在 1,3,5,7
  • CPU C State Control 有開道 c1/c2

主要問題

似乎修改 BIOS 中 Max Payload Size (MPS) / Max Read Request Size (MRRS) 於 lspci 中不起作用,D2H 速度有 Gen4 水準,而 H2D 只有 Gen1 速度,不太清楚哪邊沒有設定好,我有嘗試 BIOS: Restore Optimized Defaults 還是一樣... 我認為問題出在 MPS 與 MRRS 設定不被 CPU 准許,可能有所住。

附件

PCIe 速度對照表。
1

看更多先前的討論...收起先前的討論...
這邊更正 CUDA bandwidthTest (pinned memory) 我是 device=3
望空 iT邦研究生 4 級 ‧ 2025-09-18 11:38:24 檢舉
硬碟的最高傳輸速度是多少?
@望空

(base) louis900412@server:~$ lsblk -d -o name,rota,model
NAME ROTA MODE
sda 0 SAMSUNG MZ7L3960 (SSD)
sdb 1 TOSHIBA HDWG31G (HDD)
sdc 1 TOSHIBA HDWG31G (HDD)

(base) louis900412@server:~$ sudo hdparm -tT /dev/sda
/dev/sda:
Timing cached reads: 13674 MB in 2.00 seconds = 6845.01 MB/sec
Timing buffered disk reads: 394 MB in 3.00 seconds = 131.24 MB/sec

文章內測試都是從 sda 發出的
frogsoul iT邦研究生 3 級 ‧ 2025-09-19 07:00:57 檢舉
插槽頻寬是兩兩共用的,包含M.2
是否VGA插在slot 1且SSD在M.2?

官網資訊:
Expansion Slots
PCIe
4 PCIe 4.0 x16,
3 PCIe 4.0 x8 (in x16 slot), PCIe x16 Slot#1 shares with M.2, Slot#2 shares with Slot#3 (NA/16,8/8), Slot#4 shares with Slot#5 (NA/16,8/8), Slot#6 shares with Slot#7 (NA/16,8/8)
這塊板子,PCI #2跟 #4跟M.2槽共用頻寬哦
frogsoul iT邦研究生 3 級 ‧ 2025-09-19 09:59:24 檢舉
補充一下資訊來源
www.supermicro.com/zh_tw/products/motherboard/x12spa-tf
Specifications > Expansion Slots
不明
【**此則訊息已被站方移除**】
目前 PCIE 使用 1,3,5,7 因為 x16 的關係。也沒有放 M.2,單純一個 SATA SSD 與 HDD * 2。

問題已經解決,我是透過升級 BIOS,升級後四張卡都可以 Gen4 x16速度,而且 python import 都變超快
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中
不明
【**此則訊息已被站方移除**】

尚未有邦友回答

立即登入回答