gpu-burn GPU压力测试工具
前言
CentOS 7 系统上安装部署 gpu-burn
GPU 压力测试能效,该工具安装前需要先安装NVIDIA的cuda工具。
步骤
gpu-burn
是用 C++ 编写的,所以你需要安装编译所需的工具以及 CUDA 开发工具包。
安装编译工具
sudo yum install -y gcc gcc-c++ make
安装 CUDA 开发工具包
如果没安装CUDA开发环境,编译直接会报错
[root@localhost gpu-burn-master]# make g++ -O3 -Wno-unused-result -I/include -std=c++11 -DIS_JETSON=false -c gpu_burn-drv.cpp gpu_burn-drv.cpp:63:23: fatal error: cublas_v2.h: No such file or directory #include "cublas_v2.h"
你可以从 NVIDIA 官方网站下载适合 CentOS 7 的 CUDA 安装包,以下是基本的下载和安装步骤:
- 访问 NVIDIA CUDA 下载页面,选择适合 CentOS 7 的版本。
我这边是安装12.4的cuda,因为在12.4.x之后都不再有支持Centos7的rpm包了,下载地址:https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda-repo-rhel7-12-4-local-12.4.0_550.54.14-1.x86_64.rpm
安装 RPM 包
sudo rpm -ivh cuda-repo-rhel7-12-4-local-12.4.0_550.54.14-1.x86_64.rpm
安装 CUDA Toolkit 和驱动
sudo yum install cuda
配置环境变量
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
验证安装
nvcc --version # 检查 CUDA 版本
nvidia-smi # 检查 GPU 驱动和状态
下载 gpu-burn
源代码,编译源码
# 访问下载gpu-burn源码,并上传到服务器
https://github.com/wilicc/gpu-burn
#在 gpu-burn 目录下,执行 make 命令进行编译
unzip gpu-burn-master.zip
cd gpu-burn-master
make
运行 gpu-burn
编译成功后,你就可以运行 gpu-burn
进行 GPU 压力测试了。以下是一些常用的命令示例:
测试10分钟
./gpu_burn 600
这里的
600
表示测试时间为 600 秒,即 10 分钟。
测试单 GPU
./gpu_burn -d 1 600
这里的
-d 1
表示只对编号为 1 的 GPU 进行测试,600
同样表示测试时间为 10 分钟。
使用nvidia-smi命令查看负载是否生效
全部参数
参考说明:https://github.com/wilicc/gpu-burn
GPU Burn
Usage: gpu_burn [OPTIONS] [TIME]
-m X Use X MB of memory
-m N% Use N% of the available GPU memory
-d Use doubles
-tc Try to use Tensor cores (if available)
-l List all GPUs in the system
-i N Execute only on GPU N
-h Show this help message
Example:
gpu_burn -d 3600