附註:

NVIDIA GPUDirect RDMA 與 InfiniBand 寫入頻寬基準

簡介

效能基準是 HPC 的特色。最現代的超級電腦是具有異質架構的運算節點叢集。在此節點中,我們可以看到傳統 CPU 和特殊運算共處理器 (GPU)。本教學課程描述使用以 InfiniBand 寫入頻寬 (ib_write_bw) 為基礎的自訂命令檔來設定 NVIDIA GPUDirect Remote Direct Memory Access (GPUDirect RDMA) 基準的方法。

使用 ib_write_bw.sh 命令檔對 GPUDirect RDMA 進行基準測試可提供簡單有效的機制,在 HPC 叢集中執行 GPUDirect RDMA 基準測試,無須擔心軟體安裝、相依性或組態問題。此命令檔包含在 OCI HPC 堆疊 2.10.2 和更新版本中。OCI 堡壘主機主控台上會顯示包含所有介面詳細資訊的合併測試報表,並儲存在 /tmp 以供日後參考。

Remote Direct Memory Access (RDMA) 可讓週邊元件 Interconnect Express (PCIe) 裝置直接存取 GPU 記憶體。NVIDIA GPUDirect RDMA 專為 GPU 加速需求所設計,可在遠端系統中直接通訊 NVIDIA GPU。此技術可使用 PCI Express 的標準功能,直接在 GPU 和第三方對等裝置之間交換資料。它是在 Tesla 和 Quadro 類別的 GPU 上啟用,GPUDirect RDMA 仰賴 NVIDIA GPU 在 PCI Express Base Address Register 區域中顯示部分裝置記憶體的功能。

GPU 路馬

「gpurdma」

Perftest 套裝程式是透過 Uverbs 撰寫的測試集合,用來作為效能微指標。它包含一組頻寬與延遲基準,像是:

注意perftest 套裝軟體需要使用 Compute Unified Device Architecture (CUDA) 編譯才能使用 GPUDirect 功能。

在本教學課程中,我們專注於使用 InfiniBand 寫入頻寬 (ib_write_bw) 傳送交易的 GPUDirect RDMA 頻寬測試,該測試可用於使用 RDMA 寫入交易來測試頻寬和延遲。我們將使用原生 ib_write_bw 的自訂包裝函式命令檔來自動執行安裝和測試程序。此命令檔可用來檢查叢集中兩個 GPU 節點之間的 ib_write_bw。如果節點上已安裝 CUDA,則執行將會使用 CUDA 重新編譯 perftest 套裝軟體。

目標

必要條件

使用 CUDA DMA-BUF 手動安裝 perftest

繼續手動安裝之前,請先確定符合所有先決條件,然後安裝在支援的 GPU 資源配置上。

注意:使用 ib_write_bw 手動測試 GPUDirect RDMA 需要解除安裝現有的套裝軟體,然後使用 CUDA 重新編譯。我們必須先手動驗證節點上的節點資源配置、GPU 數目和作用中 RDMA 介面,才能繼續進行基準測試。

解決方案總覽

ib_write_bw.sh 是一種命令檔,可透過將所有與其相關的手動工作自動化,簡化 GPUDirect RDMA 基準處理作業。此命令檔可以直接從堡壘主機本身觸發,並包含所有引數。不需要在傳統的用戶端 - 伺服器模型中執行。程序檔會在執行期間執行下列檢查。如果這些檢查中有任何一項失敗,就會因發生錯誤而結束。

如果所有檢查都通過,ib_write_bw.sh 將會產生並執行可能的手冊,以執行安裝和組態設定。

Script

使用狀況

sh ib_write_bw.sh -h

Usage:
./ib_write_bw.sh -s <server> -n <node> -c <y> -g <gpu id>
Options:
s     Server hostname
n     Client hostname.
c     Enable cuda (Default: Disabled)
g     GPU id (Default: 0)
h     Print this help.
Logs are stored at /tmp/logs
e.g.,  sh ./ib_write_bw.sh -s compute-permanent-node-1 -n compute-permanent-node-2 -c y -g 2
Supported shapes: BM.GPU.B4.8,BM.GPU.A100-v2.8,BM.GPU4.8

範例輸出

sh ib_write_bw.sh -s compute-permanent-node-14 -n compute-permanent-node-965 -c y -g 1
Shape: "BM.GPU4.8"
Server: compute-permanent-node-14
Client: compute-permanent-node-965
Cuda: y
GPU id: 1
Checking interfaces...
PLAY [all] *******************************************************************************************************************************
TASK [Gathering Facts] *******************************************************************************************************************
ok: [compute-permanent-node-14]
ok: [compute-permanent-node-965]
TASK [check cuda] ************************************************************************************************************************
ok: [compute-permanent-node-965]
ok: [compute-permanent-node-14]
.
.
Testing active interfaces...
mlx5_0
mlx5_1
mlx5_2
mlx5_3
mlx5_6
mlx5_7
mlx5_8
mlx5_9
mlx5_10
mlx5_11
mlx5_12
mlx5_13
mlx5_14
mlx5_15
mlx5_16
mlx5_17
ib_server.sh                                                                                            100%  630     2.8MB/s   00:00
ib_client.sh                                                                                            100%  697     2.9MB/s   00:00
Server Interface: mlx5_0
initializing CUDA
Listing all CUDA devices in system:
CUDA device 0: PCIe address is 0F:00
CUDA device 1: PCIe address is 15:00
CUDA device 2: PCIe address is 51:00
CUDA device 3: PCIe address is 54:00
CUDA device 4: PCIe address is 8D:00
CUDA device 5: PCIe address is 92:00
CUDA device 6: PCIe address is D6:00
CUDA device 7: PCIe address is DA:00
Picking device No. 1
[pid = 129753, dev = 1] device name = [NVIDIA A100-SXM4-40GB]
creating CUDA Ctx
making it the current CUDA Ctx
cuMemAlloc() of a 131072 bytes GPU buffer
allocated GPU buffer address at 00007f29df200000 pointer=0x7f29df200000
---------------------------------------------------------------------------------------
                    RDMA_Write BW Test
Dual-port       : OFF                    Device         : mlx5_0
Number of qps   : 1                   Transport type : IB
Connection type : RC                 Using SRQ      : OFF
PCIe relax order: ON
ibv_wr* API     : ON
TX depth        : 128
CQ Moderation   : 1
Mtu             : 4096[B]
Link type       : Ethernet
GID index       : 3
Max inline data : 0[B]
rdma_cm QPs  : OFF
Data ex. method : Ethernet
---------------------------------------------------------------------------------------
local address: LID 0000 QPN 0x008b PSN 0xe4ad79 RKey 0x181de0 VAddr 0x007f29df210000
GID: 00:00:00:00:00:00:00:00:00:00:255:255:192:168:19:196
remote address: LID 0000 QPN 0x008b PSN 0x96f625 RKey 0x181de0 VAddr 0x007f9c4b210000
GID: 00:00:00:00:00:00:00:00:00:00:255:255:192:168:16:13
---------------------------------------------------------------------------------------
#bytes     #iterations    BW peak[Gb/sec]    BW average[Gb/sec]   MsgRate[Mpps]    CPU_Util[%]
65536      407514           0.00                                35.61                   0.067920           0.78

測試摘要

GPUDirect 運算節點之每個介面的 RDMA 測試摘要都會顯示在堡壘主機上,而且同樣會儲存在堡壘主機的資料夾 /tmp/ib_bw 中。

它所尋找的重要參數是 BW 平均值 [Gb/sec]。

************** Test Summary **************
Server interface: mlx5_0
#bytes     #iterations    BW peak[Gb/sec]    BW average[Gb/sec]   MsgRate[Mpps]    CPU_Util[%]
65536      407514           0.00                                35.61                   0.067920           0.78
---------------------------------------------------------------------------------------
Server interface: mlx5_1
#bytes     #iterations    BW peak[Gb/sec]    BW average[Gb/sec]   MsgRate[Mpps]    CPU_Util[%]
65536      407569           0.00                                35.61                   0.067929           0.78
---------------------------------------------------------------------------------------
Server interface: mlx5_2
#bytes     #iterations    BW peak[Gb/sec]    BW average[Gb/sec]   MsgRate[Mpps]    CPU_Util[%]
65536      407401           0.00                                35.60                   0.067901           0.78
---------------------------------------------------------------------------------------

認可

其他學習資源

瀏覽 docs.oracle.com/learn 的其他實驗室,或前往 Oracle Learning YouTube 頻道存取更多免費學習內容。此外,請造訪 education.oracle.com/learning-explorer 以成為 Oracle Learning Explorer。

如需產品文件,請造訪 Oracle Help Center