转载一篇不错的关于Linpack测试的博文:http://longgeek.com/2012/07/18/hpc-high-performance-cluster-power-standard-linpack-test-the-installation-configuration/
云计算系统的一个重要作用是向用户提供计算力,评价一个系统的总体计算力的方法就是采用一个统一的测试标准作为评判,现在评判一个系统计算力的方法中最为 知名的就是Linpack测试,世界最快500台巨型机系统的排名采用的就是这一标准。掌握Linpack测试技术对于在云计算时代评判一个云系统的计算 力也有着重要意义。
1.Linpack安装
在安装之前,我们需要做一些软件准备,相关的软件及下载地址如下。
(1)Linux平台,最新稳定内核的Linux发行版最佳,可以选择Red hat, Centos等。
(2)MPICH2,这是个并行计算的软件,可以到http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/1.4.1p1/mpich2-1.4.1p1.tar.gz下载最新的源码包。
(3)Gotoblas,BLAS库(Basic Linear Algebra Subprograms)是执行向量和矩阵运算的子程序集合,这里我们选择公认性能最好的Gotoblas,最新版可到http://www.tacc.utexas.edu/docum … 2-b5f1-5a5843b4d47b
(4)HPL,linpack测试的软件,可在http://www.netlib.org/benchmark/hpl/下载最新版本。
安装方法和步骤如下。
(1)安装MPICH2,并配置好环境变量,后期增加—
(2)进入Linux系统,建议使用root用户,在/opt/app下建立linpack文件夹,解压下载的Gotoblas和HPL文件到linpack文件夹下,改名为Gotoblas和hpl。
- #tar xvf GotoBLAS-*.tar.gz
- #mv GotoBLAS-* /opt/app/linpack/Gotoblas
- #tar xvf hpl-*.tar.gz
- #mv hpl-* /opt/app/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库。
cp Make.Linux_PII_FBLAS Make.Linux_xeon
编辑刚刚复制的文件,根据说明修改各个选项,使之符合自己的系统,比如我们系统的详细情况为,Intel xeon平台,mpich2安装目录为/opt/app/mpi/mpich2,hpl和gotoblas安装目录为/opt/app/linpack, 下面是我们的配置文件Make.Linux_xeon,对需要修改的部分我们做了注解,大家可以参考修改:
- # – shell ————————————————————–
- # ———————————————————————-
- #
- SHELL = /bin/sh
- #
- CD = cd
- CP = cp
- LN_S = ln -s
- MKDIR = mkdir
- RM = /bin/rm -f
- TOUCH = touch
- #
- # ———————————————————————-
- # – Platform identifier ————————————————
- # ———————————————————————-
- #
- ARCH = Linux_xeon //设置平台类型
- #
- # ———————————————————————-
- # – HPL Directory Structure / HPL library ——————————
- # ———————————————————————-
- #
- TOPdir = /opt/app/linpack/hpl //设置测试软件的根目录
- INCdir = $(TOPdir)/include
- BINdir = $(TOPdir)/bin/$(ARCH)
- LIBdir = $(TOPdir)/lib/$(ARCH)
- #
- HPLlib = $(LIBdir)/libhpl.a
- #
- # ———————————————————————-
- # – Message Passing library (MPI) ————————————–
- # ———————————————————————-
- # MPinc tells the C compiler where to find the Message Passing library
- # header files, MPlib is defined to be the name of the library to be
- # used. The variable MPdir is only used for defining MPinc and MPlib.
- #
- MPdir = /opt/app/mpi/mpich2 //设置mpich的安装目录
- MPinc = -I$(MPdir)/include
- MPlib = $(MPdir)/lib/libmpich.a
- #
- # ———————————————————————-
- # – Linear Algebra library (BLAS or VSIPL) —————————–
- # ———————————————————————-
- # LAinc tells the C compiler where to find the Linear Algebra library
- # header files, LAlib is defined to be the name of the library to be
- # used. The variable LAdir is only used for defining LAinc and LAlib.
- #
- LAdir = /opt/app/linpack/Gotoblas //设置gotoblas的目录
- LAinc =
- LAlib = $(LAdir)/libgoto2.a $(LAdir)/libgoto2.so //加入库支持
- #
- # ———————————————————————-
- # – F77 / C interface ————————————————–
- # ———————————————————————-
- # You can skip this section if and only if you are not planning to use
- # a BLAS library featuring a Fortran 77 interface. Otherwise, it is
- # necessary to fill out the F2CDEFS variable with the appropriate
- # options. **One and only one** option should be chosen in **each** of
- # the 3 following categories:
- #
- # 1) name space (How C calls a Fortran 77 routine)
- #
- # -DAdd_ : all lower case and a suffixed underscore (Suns,
- # Intel, …), [default]
- # -DNoChange : all lower case (IBM RS6000),
- # -DUpCase : all upper case (Cray),
- # -DAdd__ : the FORTRAN compiler in use is f2c.
- #
- # 2) C and Fortran 77 integer mapping
- #
- # -DF77_INTEGER=int : Fortran 77 INTEGER is a C int, [default]
- # -DF77_INTEGER=long : Fortran 77 INTEGER is a C long,
- # -DF77_INTEGER=short : Fortran 77 INTEGER is a C short.
- #
- # 3) Fortran 77 string handling
- #
- # -DStringSunStyle : The string address is passed at the string loca-
- # tion on the stack, and the string length is then
- # passed as an F77_INTEGER after all explicit
- # stack arguments, [default]
- # -DStringStructPtr : The address of a structure is passed by a
- # Fortran 77 string, and the structure is of the
- # form: struct {char *cp; F77_INTEGER len;},
- # -DStringStructVal : A structure is passed by value for each Fortran
- # 77 string, and the structure is of the form:
- # struct {char *cp; F77_INTEGER len;},
- # -DStringCrayStyle : Special option for Cray machines, which uses
- # Cray fcd (fortran character descriptor) for
- # interoperation.
- #
- F2CDEFS = -DAdd__ -DF77_INTEGER=int -DStringSunStyle
- #
- # ———————————————————————-
- # – HPL includes / libraries / specifics ——————————-
- # ———————————————————————-
- #
- HPL_INCLUDES = -I$(INCdir) -I$(INCdir)/$(ARCH) $(LAinc) $(MPinc)
- HPL_LIBS = $(HPLlib) $(LAlib) $(MPlib)
- #
- # – Compile time options ———————————————–
- #
- # -DHPL_COPY_L force the copy of the panel L before bcast;
- # -DHPL_CALL_CBLAS call the cblas interface;
- # -DHPL_CALL_VSIPL call the vsip library;
- # -DHPL_DETAILED_TIMING enable detailed timers;
- #
- # By default HPL will:
- # *) not copy L before broadcast,
- # *) call the BLAS Fortran 77 interface,
- # *) not display detailed timing information.
- #
- HPL_OPTS =
- #
- # ———————————————————————-
- #
- HPL_DEFS = $(F2CDEFS) $(HPL_OPTS) $(HPL_INCLUDES)
- #
- # ———————————————————————-
- # – Compilers / linkers – Optimization flags —————————
- # ———————————————————————-
- #
- CC = /opt/app/mpi/mpich2/bin/mpicc //设置gcc编译器为mpicc
- CCNOOPT = $(HPL_DEFS)
- CCFLAGS = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -W -Wall
- #
- # On some platforms, it is necessary to use the Fortran linker to find
- # the Fortran internals used in the BLAS library.
- #
- LINKER = /opt/app/mpich2/bin/mpif77 //设置fortran编译器为mpif77
- LINKFLAGS = $(CCFLAGS)
- #
- ARCHIVER = ar
- ARFLAGS = r
- RANLIB = echo
- #
- # —————————–/opt/app/mpi/mpich2/bin/mpicc———————
修改好文件以后,对其进行编译:
- #make arch=Linux_xeon
如果编译正常,在hpl/bin/Linux_xeon目录下就会生成两个文件HPL.dat和xhpl。 HPL.dat文件是Linpack测试的优化配置文件,这个对测试的结果十分重要,xhpl为可执行程序。
如果是集群测试,就将linpack目录复制到机群中其余节点相同的目录下。
至此,安装就算完成了。现在可以进行简单的测试.
进入hpl/bin/Linux_xeon目录,我用的hydra所以不需要启动mpd服务,在终端运行以下命令启动测试:
- #mpirun -np 4 xhpl
就会看到测试开始了,但得到的数据会比较差,有时可能连最佳值的1%都达不到,这就需要根据自己平台的情况进行测试优化,这也是进行Linpack测试的核心技术。
后期更新优化方法