您的位置:首页 > 其它

Stream benchmark 测试及相关参数说明

2016-07-18 12:29 1686 查看

Stream介绍

Stream测试是内存测试中业界公认的内存带宽性能测试基准工具,作为衡量服务器内存性能指标的通用工具。通过测试过程了解相关参数并记录如下(主要是编译过程的参数值设置),关于stream介绍可以参考如下官方网页


http://www.cs.virginia.edu/stream/ref.html

Stream的源码下载地址

http://www.cs.virginia.edu/stream/FTP/Code/我们下载stream.c源程序即可

编译参数介绍

在介绍测试过程前,需要了解CPU cache memory,L3 cache大小直接决定了编译时的参数值大小。
测试环境2路Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz CPU,首先看下源码中对于编译stream.c的参数介绍:


#ifdef _OPENMP     定义开启多处理器运行环境,
extern int omp_get_num_threads();
#endif

#ifndef STREAM_ARRAY_SIZE   定义计算的数组大小(成员个数)
# define STREAM_ARRAY_SIZE  45000000
#endif
#ifdef NTIMES  定义值非法时,若定义计算次数,10
#if NTIMES<=1
# define NTIMES 10
#endif
#endif
#ifndef NTIMES   若定义计算次数,10
# define NTIMES 10
#endif
#ifndef OFFSET  定义数组偏移量
# define OFFSET 0
#endif

#ifndef STREAM_TYPE  定义数组为双精度,64bit,8Bytes
#define STREAM_TYPE double
#endif


以上是源代码预定义的参数,也可以在编译是指定

icc -mtune=native -march=native -O3 -mcmodel=medium -fopenmp -DSTREAM_ARRAY_SIZE=<num> -DNTIMES=<num> -DOFFSET=<num> stream.c -o stream.o


参数介绍:

1. -mtune=native -march=native

针对CPU指令的优化,由于测试编译机即运行机器,故采用native的优化方法

2. -O3

优化级别

3. -mcmodel=medium

当单个Memory Array Size 大于2GB时需要设置此参数

Version 5.10 changes the loop index variables from "register int"
*          to "ssize_t", which allows array indices >2^32 (4 billion)
*          on properly configured 64-bit systems.  Additional compiler options
*          (such as "-mcmodel=medium") may be required for large memory runs.


-fopenmp

适应多处理器环境;开启后,程序默认线程为CPU线程数,也可以运行时也可以动态指定运行的进程数 :export OMP_NUM_THREADS=12 #12为自定义的要使用的处理器数

-DSTREAM_ARRAY_SIZE

计算方法参考stream.c中的说明 例如本环境中查询cpu资料 L3

缓存 35MB

其值为 35MB*4*2*1000*1000/8 = 35millions (此值为最小值,可以适当大于此值,增大array size会增加测试时间,也会保证经历20个 clock ticks)注意 double 64bit= 8byte

-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 54311 microseconds.
(= 54311 clock ticks)
Increase the size of the arrays if this shows that
you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------


-DNTIMES

执行次数,并从所有结果中取最优

-DOFFSET=4096

数组的偏移,一般可以不设置

注意测试时改变size大小,cpu个数,多测几组数据取平均值

以上学习记录,不定时更新。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息