基本系统健康检查#
要确认您的系统运行状况良好且配置正确,请使用一些简单的基准测试检查计算性能和内存带宽。
STREAM#
使用 STREAM 基准测试检查 LPDDR5X 内存带宽。以下命令下载并编译 STREAM,总内存占用约为 2.7 GB,这足以超出 L3 缓存,而不会导致运行时过长。
注意
我们建议使用 GCC 12.3 或更高版本。
$ wget https://www.cs.virginia.edu/stream/FTP/Code/stream.c
$ gcc -Ofast -mcpu=neoverse-v2 -fopenmp \
-DSTREAM_ARRAY_SIZE=120000000 -DNTIMES=200 \
-o stream_openmp.exe stream.c
要运行 STREAM,请根据以下示例设置 OpenMP 线程数 (OMP_NUM_THREADS
)。为了在所有可用内核上均匀分配线程并最大化带宽,请使用 OMP_PROC_BIND=spread
。
$ OMP_NUM_THREADS={THREADS} OMP_PROC_BIND=spread ./stream_openmp.exe
系统带宽与内存容量成正比。在下表中找到您系统的内存容量,并使用给定的参数生成 STREAM TRIAD 的预期分数。例如,当在内存容量为 120 GB 的 Grace-Hopper Superchip 上运行时,此命令在 STREAM TRIAD 中将至少获得 450 GB/s 的分数
$ OMP_NUM_THREADS=72 OMP_PROC_BIND=spread ./stream_openmp.exe
同样,以下命令在内存容量为 240 GB 的 Grace CPU Superchip 上,STREAM TRIAD 中将至少获得 900 GB/s 的分数
$ OMP_NUM_THREADS=144 OMP_PROC_BIND=spread numactl -m0,1 ./stream_openmp.exe
超级芯片 |
容量 (GB) |
NUM_THREADS** |
值 |
---|---|---|---|
Grace-Hopper |
120 |
72 |
450+ |
Grace-Hopper |
480 |
72 |
340+ |
Grace CPU |
240 |
144 |
900+ |
Grace CPU |
480 |
144 |
900+ |
Grace CPU |
960 |
144 |
680+ |
$ OMP_NUM_THREADS=72 OMP_PROC_BIND=spread numactl -m0,1 ./stream_openmp.exe
-------------------------------------------------------------
STREAM version $Revision: 5.10 $
-------------------------------------------------------------
This system uses 8 bytes per array element.
-------------------------------------------------------------
Array size = 120000000 (elements), Offset = 0 (elements)
Memory per array = 915.5 MiB (= 0.9 GiB).
Total memory required = 2746.6 MiB (= 2.7 GiB).
Each kernel will be executed 200 times.
The *best* time for each kernel (excluding the first iteration) will be used to compute the reported bandwidth.
-------------------------------------------------------------
Number of Threads requested = 72
Number of Threads counted = 72
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 2927 microseconds.
(= 2927 clock ticks)
Increase the size of the arrays if this shows that you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------
WARNING -- The above is only a rough guideline. For best results, please be sure you know the precision of your system timer.
-------------------------------------------------------------
Function Best Rate MB/s Avg time Min time Max time
Copy: 919194.6 0.002149 0.002089 0.002228
Scale: 913460.0 0.002137 0.002102 0.002192
Add: 916926.9 0.003183 0.003141 0.003343
Triad: 903687.9 0.003223 0.003187 0.003308
-------------------------------------------------------------
Solution Validates: avg error less than 1.000000e-13 on all three arrays
-------------------------------------------------------------
融合乘加运算#
NVIDIA 提供了一套用于 Arm CPU 的开源基准测试微内核套件。为了精确计数指令和练习特定的功能单元,这些内核是用汇编语言编写的。要测量内核的峰值浮点能力并检查 CPU 时钟速度,请使用融合乘加 (FMA) 内核。
为了测量内核可实现的峰值性能,fp64_sve_pred_fmla
内核执行已知数量的 SVE 谓词融合乘加运算 (FMLA)。当与 perf 工具结合使用时,您可以测量性能和内核时钟速度。
$ git clone https://github.com/NVIDIA/arm-kernels.git
$ cd arm-kernels
$ make
$ perf stat ./arithmetic/fp64_sve_pred_fmla.x
基准测试分数以每秒千兆次运算 (Gop/sec) 为单位报告在基准测试输出的顶部附近。Grace 每个周期可以执行 16 次 FP64 FMA 运算,因此标称 CPU 频率为 3.3 GHz 的 Grace CPU 将报告 52 到 53 Gop/sec 之间的分数。CPU 频率在 perf 输出的 cycles 行和 # 符号之后报告。
以下是 fp64_sve_pred_fmla.x 执行输出的示例
$ perf stat ./arithmetic/fp64_sve_pred_fmla.x
4( 16(SVE_FMLA_64b) );
Iterations;100000000
Total Inst;6400000000
Total Ops;25600000000
Inst/Iter;64
Ops/Iter;256
Seconds;0.481267
GOps/sec;53.1929
Performance counter stats for './arithmetic/fp64_sve_pred_fmla.x':
482.25 msec task-clock # 0.996 CPUs utilized
0 context-switches # 0.000 /sec
0 cpu-migrations # 0.000 /sec
65 page-faults # 134.786 /sec
1,607,949,685 cycles # 3.334 GHz
6,704,065,953 instructions # 4.17 insn per cycle
<not supported> branches
18,383 branch-misses # 0.00% of all branches
0.484136320 seconds time elapsed
0.482678000 seconds user
0.000000000 seconds sys
C2C CPU-GPU 带宽#
NVIDIA 提供了一个类似于 STREAM 的开源基准测试,旨在测试系统上各种内存单元之间的带宽。这可以用于测试 Grace Hopper Superchip 的 CPU 和 GPU 之间 NVLink C2C 提供的带宽。
下载、构建并运行 nvbandwidth
git clone https://github.com/NVIDIA/nvbandwidth.git
cd nvbandwidth
# may need to update version of CUDA
docker run -it --rm --gpus all -v $(pwd):/nvbandwidth
nvidia/cuda:12.2.0-devel-ubuntu22.04
# within docker
cd /nvbandwidth
apt update
apt install libboost-program-options-dev
./debian_install.sh
./nvbandwidth -t 0
# next test
./nvbandwidth -t 1
# all tests can be listed with ./nvbandwidth -l
以下是示例系统上先前两个命令的输出
注意
带宽数字取决于特定的 Grace Hopper SKU,并且还受 IOMMU 设置、GPU 时钟设置和其他系统特定参数等因素的影响。在任何带宽基准测试活动期间,应仔细考虑这些因素。
# ./nvbandwidth -t 0
nvbandwidth Version: v0.2
Built from Git version:
NOTE: This tool reports current measured bandwidth on your system.
Additional system-specific tuning may be required to achieve maximal peak bandwidth.
CUDA Runtime Version: 12020
CUDA Driver Version: 12020
Driver Version: 535.82
Device 0: GH200 120GB
Running host_to_device_memcpy_ce.
memcpy CE CPU(row) -> GPU(column) bandwidth (GB/s)
0
0 416.34
SUM host_to_device_memcpy_ce 416.34
# ./nvbandwidth -t 1
nvbandwidth Version: v0.2
Built from Git version:
NOTE: This tool reports current measured bandwidth on your system.
Additional system-specific tuning may be required to achieve maximal
peak bandwidth.
CUDA Runtime Version: 12020
CUDA Driver Version: 12020
Driver Version: 535.82
Device 0: GH200 120GB
Running device_to_host_memcpy_ce.
memcpy CE CPU(row) <- GPU(column) bandwidth (GB/s)
0
0 295.47
SUM device_to_host_memcpy_ce 295.47
对于使用 CUDA 复制引擎 (CE) 的内存副本,您可以预期对于具有 120 GB 或 240 GB LPDDR5 内存的系统,其值与输出中的值相似。与上面显示的第一个测试输出相比,具有 480 GB LPDDR5 内存的系统对于主机到设备副本可能具有较低的带宽。在健康的系统上,此带宽应约为 350-360 GB/s。具有 480 GB LPDDR5 的系统应具有与上面第二个测试中显示的类似的设备到主机带宽,但 Grace-Hopper x4 系统除外,由于保留了更多的 CE 用于饱和 GPU 之间的 NVLink 带宽,因此该带宽应约为 170 GB/s。要使用 GPU 的流式微处理器 (SM) 运行带宽测试,请运行 ./nvbandwidth -l 命令以获得确切的测试数字。实现的带宽应至少与基于 CE 的测试显示的输出一样大。