Linpack性能测试环境搭建

搭建好SSH无密码访问,NFS和NIS后可以搭建Linpack性能测试环境

云计算系统的一个重要作用是向用户提供计算力,评价一个系统的总体计算力的方 法就是采用一个统一的测试标准作为评判,现在评判一个系统计算力的方法中最为知名的就是Linpack测试,世界最快500台巨型机系统的排名采用的就是 这一标准。掌握Linpack测试技术对于在云计算时代评判一个云系统的计算力也有着重要意义。本附录将对Linpack测试技术作详细的介绍。(mpi,GotoBlas,Linpack都要安装在nfs共享目录下,或者所有节点都统一目录安装)

1.Linpack安装

在安装之前,我们需要做一些软件准备,相关的软件及下载地址如下。

(1)Linux平台,最新稳定内核的Linux发行版最佳,可以选择Red hat, Centos等。

(2)MPICH2,这是个并行计算的软件,可以到http://www.mcs.anl.gov/research/projects/mp ich2/downloads/index.php?s=downloads下载最新的源码包。

(3)Gotoblas,BLAS库(Basic Linear Algebra Subprograms)是执行向量和矩阵运算的子程序集合,这里我们选择公认性能最好的Gotoblas,最新版可到http://www.tacc.utexas.edu/tacc - projects/下载,需要注册。

(4)HPL,linpack测试的软件,可在http://www.netlib.org/benchmark/hpl/ 下载最新版本。

安装方法和步骤如下。

(1)安装MPICH2,并配置好环境变量,本书前面已作介绍。

(2)进入Linux系统,建议使用root用户,在/root下建立linpack文件夹,解压下载的Gotoblas和HPL文件到linpack文件夹下,改名为Gotoblas和hpl。

 
 
  1. #tar xvf GotoBLAS-*.tar.gz
  2. #mv GotoBLAS-*  ~/linpack/Gotoblas
  3. #tar xvf  hpl-*.tar.gz
  4. #mv hpl-*  ~/linpack/hpl

(3)安装Gotoblas。

进入Gotoblas文件夹,在终端下执行./ quickbuild.64bit(如果你是32位系统,则执行./ quickbuild.31bit)进行快速安装,当然,你也可以依据README里的介绍自定义安装。如果安装正常,在本目录下就会生成 libgoto2.a和libgoto2.so两个文件。

(4)安装HPL。

进入hpl文件夹从setup文件夹下提取与自己平台相近的Make.<arch>文件,复制到hpl文件夹内,比如我们的平台为 Intel xeon,所以就选择了Make.Linux_PII_FBLAS,它代表Linux操作系统、PII平台、采用FBLAS库。

编辑刚刚复制的文件,根据说明修改各个选项,使之符合自己的系统,比如我们系统的详细情况为,Intel xeon平台,mpich2安装目录为/usr/local/mipch2,hpl和gotoblas安装目录为/root/linpack,下面是我们 的配置文件Make.Linux_xeon,对需要修改的部分我们做了注解,大家可以参考修改:

 
 
  1. # - shell --------------------------------------------------------------
  2. # ----------------------------------------------------------------------
  3. #
  4. SHELL        = /bin/sh  
  5. #
  6. CD           = cd  
  7. CP           = cp  
  8. LN_S        = ln -s  
  9. MKDIR       = mkdir  
  10. RM          = /bin/rm -f  
  11. TOUCH       = touch  
  12. #
  13. # ----------------------------------------------------------------------
  14. # - Platform identifier ------------------------------------------------
  15. # ----------------------------------------------------------------------  
  16. #  
  17. ARCH         = Linux_xeon   //设置平台类型  
  18. #  
  19. # ----------------------------------------------------------------------  
  20. # - HPL Directory Structure / HPL library ------------------------------  
  21. # ----------------------------------------------------------------------  
  22. #  
  23. TOPdir       = $(HOME)/linpack/hpl   //设置测试软件的根目录  
  24. INCdir       = $(TOPdir)/include  
  25. BINdir       = $(TOPdir)/bin/$(ARCH)  
  26. LIBdir       = $(TOPdir)/lib/$(ARCH)  
  27. #  
  28. HPLlib       = $(LIBdir)/libhpl.a   
  29. #  
  30. # ----------------------------------------------------------------------  
  31. # - Message Passing library (MPI) --------------------------------------  
  32. # ----------------------------------------------------------------------  
  33. # MPinc tells the  C  compiler where to find the Message Passing library  
  34. # header files,  MPlib  is defined  to be the name of  the library to be  
  35. # used. The variable MPdir is only used for defining MPinc and MPlib.  
  36. #  
  37. MPdir        = /usr/local/mpich2     //设置mpich的安装目录  
  38. MPinc        = -I$(MPdir)/include  
  39. MPlib        = $(MPdir)/lib/libmpich.a  
  40. #  
  41. # ----------------------------------------------------------------------  
  42. # - Linear Algebra library (BLAS or VSIPL) -----------------------------  
  43. # ----------------------------------------------------------------------  
  44. # LAinc tells the  C  compiler where to find the Linear Algebra  library  
  45. # header files,  LAlib  is defined  to be the name of  the library to be  
  46. # used. The variable LAdir is only used for defining LAinc and LAlib.  
  47. #  
  48. LAdir        = $(HOME)/linpack/GotoBLAS2     //设置gotoblas的目录  
  49. LAinc        =  
  50. LAlib        = $(LAdir)/libgoto2.a $(LAdir)/libgoto2.so  //加入库支持  
  51. #  
  52. # ----------------------------------------------------------------------  
  53. # - F77 / C interface --------------------------------------------------  
  54. # ----------------------------------------------------------------------  
  55. # You can skip this section  if and only if  you are not planning to use  
  56. # a  BLAS  library featuring a Fortran 77 interface.  Otherwise,  it  is  
  57. # necessary  to  fill out the  F2CDEFS  variable  with  the  appropriate  
  58. # options.  **One and only one**  option should be chosen in **each** of  
  59. # the 3 following categories:  
  60. #  
  61. # 1) name space (How C calls a Fortran 77 routine)  
  62. #  
  63. # -DAdd_              : all lower case and a suffixed underscore  (Suns,  
  64. #                       Intel, ...),                           [default]  
  65. # -DNoChange          : all lower case (IBM RS6000),  
  66. # -DUpCase            : all upper case (Cray),  
  67. # -DAdd__             : the FORTRAN compiler in use is f2c.  
  68. #  
  69. # 2) C and Fortran 77 integer mapping  
  70. #  
  71. # -DF77_INTEGER=int   : Fortran 77 INTEGER is a C int,         [default]  
  72. # -DF77_INTEGER=long  : Fortran 77 INTEGER is a C long,  
  73. # -DF77_INTEGER=short : Fortran 77 INTEGER is a C short.  
  74. #  
  75. # 3) Fortran 77 string handling  
  76. #  
  77. # -DStringSunStyle    : The string address is passed at the string loca-  
  78. #                           tion on the stack, and the string length is then  
  79. #                           passed as  an  F77_INTEGER  after  all  explicit  
  80. #                           stack arguments,                       [default]  
  81. # -DStringStructPtr   : The address  of  a  structure  is  passed  by  a  
  82. #                           Fortran 77  string,  and the structure is of the  
  83. #                           form: struct {char *cp; F77_INTEGER len;},  
  84. # -DStringStructVal   : A structure is passed by value for each  Fortran  
  85. #                           77 string,  and  the  structure is  of the form:  
  86. #                           struct {char *cp; F77_INTEGER len;},  
  87. # -DStringCrayStyle   : Special option for  Cray  machines,  which  uses  
  88. #                           Cray  fcd  (fortran  character  descriptor)  for  
  89. #                           interoperation.  
  90. #  
  91. F2CDEFS      = -DAdd__ -DF77_INTEGER= int  -DStringSunStyle  
  92. #  
  93. # ----------------------------------------------------------------------  
  94. # - HPL includes / libraries / specifics -------------------------------  
  95. # ----------------------------------------------------------------------  
  96. #  
  97. HPL_INCLUDES = -I$(INCdir) -I$(INCdir)/$(ARCH) $(LAinc) $(MPinc)  
  98. HPL_LIBS     = $(HPLlib) $(LAlib) $(MPlib)  
  99. #  
  100. # - Compile time options -----------------------------------------------  
  101. #  
  102. # -DHPL_COPY_L           force the copy of the panel L before bcast;  
  103. # -DHPL_CALL_CBLAS       call the cblas interface;  
  104. # -DHPL_CALL_VSIPL       call the vsip  library;  
  105. # -DHPL_DETAILED_TIMING  enable detailed timers;  
  106. #  
  107. # By default HPL will:  
  108. #    *) not copy L before broadcast,  
  109. #    *) call the BLAS Fortran 77 interface,  
  110. #    *) not display detailed timing information.  
  111. #  
  112. HPL_OPTS     =  
  113. #  
  114. # ----------------------------------------------------------------------  
  115. #  
  116. HPL_DEFS     = $(F2CDEFS) $(HPL_OPTS) $(HPL_INCLUDES)  
  117. #  
  118. # ----------------------------------------------------------------------  
  119. # - Compilers / linkers - Optimization flags ---------------------------  
  120. # ----------------------------------------------------------------------  
  121. #  
  122. CC           = /usr/local/mpich2/bin/mpicc   //设置gcc编译器为mpicc  
  123. CCNOOPT      = $(HPL_DEFS)  
  124. CCFLAGS      = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -W -Wall  
  125. #  
  126. # On some platforms,  it is necessary  to use the Fortran linker to find  
  127. # the Fortran internals used in the BLAS library.  
  128. #  
  129. LINKER       = /usr/local/mpich2/bin/mpif77  //设置fortran编译器为mpif77  
  130. LINKFLAGS    = $(CCFLAGS)  
  131. #  
  132. ARCHIVER     = ar  
  133. ARFLAGS      = r  
  134. RANLIB       = echo  
  135. #  
  136. # -----------------------------/usr/local/mpich2/bin/mpicc---------------------

修改好文件以后,对其进行编译:

 
 
  1. #make arch=Linux_xeon

如果编译正常,在hpl/bin/Linux_xeon目录下就会生成两个文件HPL.dat和xhpl。 HPL.dat文件是Linpack测试的优化配置文件,这个对测试的结果十分重要,xhpl为可执行程序。

如果是集群测试,就将linpack目录复制到机群中其余节点相同的目录下。

至此,安装就算完成了。现在可以进行简单的测试.

进入hpl/bin/Linux_xeon目录,先启动mpd服务,在终端运行以下命令启动测试:

 
 
  1. #mpiexec -np 4 ./xhpl

当多台机器时,还可以加入节点配置文件,如machinefile,格式如下:

host1 :1   #Run 1 process on host1,host可以是域名或者是ip地址

host2:2    #Run 2 process on host2

............

需要注意的是:因为通信是双向的,所以需要在所有host上的/etc/hosts上都配置上

可运行命令如下:

#mpiexec -n 4 -f machinefile ./xhpl

运行结果如图

在最后一列中看到Gflops:4.937e-03

实际应该是cat /proc/cpuinfo

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 44
model name      : Intel(R) Xeon(R) CPU           E5649  @ 2.53GHz
stepping        : 2
cpu MHz         : 2533.424
cache size      : 12288 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm arat
bogomips        : 5066.84
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 44
model name      : Intel(R) Xeon(R) CPU           E5649  @ 2.53GHz
stepping        : 2
cpu MHz         : 2533.424
cache size      : 12288 KB
physical id     : 0
siblings        : 2
core id         : 1
cpu cores       : 2
apicid          : 1
initial apicid  : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm arat
bogomips        : 5066.40
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual

双核,每核每个circle内可跑2个process(硬件决定),所以CPU完全利用时应该是2.53GHz*4=10.12

所以跑出的cpu只利用了不到50%

格式编排不好,原文可参看:

http://www.orientsky.com.cn/_new/Read.asp?ID=1495

http://www.orientsky.com.cn/_new/Read.asp?ID=1496

猜你喜欢

转载自canann.iteye.com/blog/1615567