jason--liu/Blog

服务器CPU内存性能测试

Opened this issue · 0 comments

内存测试

STREAM为业界公认的内存性能测试工具,项目地址为http://www.cs.virginia.edu/stream/。
主要用于测试CPU访问内存的带宽,代码有C语言和FORTRAN语言两种版本.

访问http://www.cs.virginia.edu/stream/FTP/Code/ 网站,获取stream.c文件
编译, 编译参数仅供参数

gcc -O3 -fopenmp -DSTREAM_ARRAY_SIZE=100000000 -DNTIME=30 stream.c -o stream.o

为了避免单次执行的误差,建议执行3次以上

[root@node-23 tmp]# ./stream.o
-------------------------------------------------------------
STREAM version $Revision: 5.10 $
-------------------------------------------------------------
This system uses 8 bytes per array element.
-------------------------------------------------------------
Array size = 100000000 (elements), Offset = 0 (elements)
Memory per array = 762.9 MiB (= 0.7 GiB).
Total memory required = 2288.8 MiB (= 2.2 GiB).
Each kernel will be executed 10 times.
 The *best* time for each kernel (excluding the first iteration)
 will be used to compute the reported bandwidth.
-------------------------------------------------------------
Number of Threads requested = 64
Number of Threads counted = 64
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 102803 microseconds.
   (= 102803 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:           19724.2     0.099451     0.081119     0.125636
Scale:          39392.4     0.050777     0.040617     0.098748
Add:            50251.2     0.063932     0.047760     0.093933
Triad:          47744.2     0.122141     0.050268     0.607938
-------------------------------------------------------------
Solution Validates: avg error less than 1.000000e-13 on all three arrays
-------------------------------------------------------------

CPU测试

下载编译

wget https://s3.amazonaws.com/cloudbench/software/UnixBench5.1.3.tgz
tar -xvf UnixBench5.1.3.tgz
cd UnixBench/
make all

运行

./Run

对于多cpu系统的性能测试策略,需要统计单任务,多任务及其并行的性能增强。
以4个cpu的PC为例,需要测试两次,4个CPU就是要并行执行4个copies,

      Run -q -c 1 -c 4

最后会在result目录下保存测试报告,比如下面这样.
image

参考

https://bbs.huaweicloud.com/forum/thread-5424-1-1.html
https://cloud.tencent.com/developer/article/1198139