前置工作:安装OpenBLAS; 安装Mpich (可参考首页博客)
官网下载压缩包到/opt目录
cd /opt && wget https://www.netlib.org/benchmark/hpl/hpl-2.3.tar.gz
解压到 /opt 目录
tar -xzf hpl-2.3.tar.gz
复制Make.Linux_PII_CBLAS并重命名
cd /opt/hpl-2.3 && cp setup/Make.Linux_PII_CBLAS Make.Linux
编辑Make.Linux
vim Make.Linux
修改如下内容:
ARCH = LinuxTOPdir = /opt/hpl-2.3 # hpl安装目录MPdir = /opt/mpich # mpich安装目录MPlib = $(MPdir)/lib/libmpi.a # mpi链接库LAdir = /opt/OpenBLAS # openblas安装目录LAlib = $(LAdir)/lib/libopenblas.a # openblas链接库CC = /opt/mpich/bin/mpicc # compilerCCFLAGS = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -pthreadLINKER = /opt/mpich/bin/mpif77 # linker
以上路径根据个人安装时的目录修改
构建hpl
make arch=Linux
若build成功,则会在/opt/hpl-2.3/bin/Linux目录下生成HPL.dat和xhpl文件
测试hpl
cd /opt/hpl-2.3/bin/Linux
单节点测试
mpiexec -np 4 ./xhpl
多节点测试
编辑节点文件,输入节点主机名或IP地址
vim nodes
eg:
修改HPL.dat
HPLinpack benchmark input fileInnovative Computing Laboratory, University of TennesseeHPL.out output file name (if any)6 device out (6=stdout,7=stderr,file)1 # of problems sizes (N)1200 Ns1 # of NBs232 NBs0 PMAP process mapping (0=Row-,1=Column-major)1 # of process grids (P x Q)1 Ps4 Qs16.0 threshold1 # of panel fact0 PFACTs (0=left, 1=Crout, 2=Right)1 # of recursive stopping criterium2 NBMINs (>= 1)1 # of panels in recursion2 NDIVs1 # of recursive panel fact.0 RFACTs (0=left, 1=Crout, 2=Right)1 # of broadcast0 BCASTs (0=1rg,1=1rM,2=2rg,3=2rM,4=Lng,5=LnM)1 # of lookahead depth1 DEPTHs (>=0)2 SWAP (0=bin-exch,1=long,2=mix)64 swapping threshold0 L1 in (0=transposed,1=no-transposed) form0 U in (0=transposed,1=no-transposed) form1 Equilibration (0=no,1=yes)8 memory alignment in double (> 0)
运行hpl
mpiexec -np 4 -machinefile ./nodes ./xhpl
HPL.dat配置项解释
HPLinpack benchmark input file # 文件头,说明Innovative Computing Laboratory, University of TennesseeHPL.out output file name (if any) # 如果使用文件保留输出结果,设定文件名6 device out (6=stdout,7=stderr,file) # 输出方式选择(stdout,stderr或文件)2 # of problems sizes (N) # 指出要计算的矩阵规格有几种1960 2048 Ns # 每种规格分别的数值2 # of NBs # 指出使用几种不同的分块大小60 80 NBs # 分别指出每种大小的具体值2 # of process grids (P x Q-l # 指出用几种进程组合方式2 4 Ps # 每对PQ具体的值2 1 Qs 16.0 threshold # 余数的阈值1 # of panel fact # 用几种分解方法1 PFACTs (0=left, 1=Crout, 2=Right) # 具体用哪种,0 left,1 crout,2 right1 # of recursive stopping criterium # 几种停止递归的判断标准4 NBMINs (>= 1) # 具体的标准数值(须不小于1)1 # of panels in recursion # 递归中用几种分割法2 NDIVs # 这里用一种NDIV值为2,即每次递归分成两块1 # of recursive panel fact. # 用几种递归分解方法2 RFACTs (0=left, 1=Crout, 2=Right) # 这里每种都用到(左,右,crout分解)1 # of broadcast # 用几种广播方法3 BCASTs (0=1rg,1=1rM,2=2rg,3=2rM,4=Lng,5=LnM) # 指定具体哪种(有1-ring,1-ring Modified,2-ring,2ring Modified,Long以及long-Modified)1 # of lookahead depth # 用几种向前看的步数1 DEPTHs (>=0) # 具体步数值(须大于等于0)2 SWAP (0=bin-exch,1=long,2=mix) # 哪种交换算法(bin-exchange,long或者二者混合)64 swapping threshold # 采用混合的交换算法时使用的阈值0 L1 in (0=transposed,1=no-transposed) form # L1是否用转置形式0 U in (0=transposed,1=no-transposed) form # U是否用转置形式表示1 Equilibration (0=no,1=yes) # 是否采用平衡状态8 memory alignment in double (> 0) # 指出程序运行时内存分配中的采用的对齐方式