CentOS 7.6下的HPL2.3安装、配置和测试总结

    本文前提是系统中安装好了MPICH和GotoBLAS2库函数。关于MPICH和GotoBLAS2,请参考之前的Blog。

1、设置MPI环境变量

[root@hpc ~]# more .bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
 . /etc/bashrc
fi
#export PATH="/usr/local/mpich-4.1.2/bin:$PATH" 
export MPI_HOME=/usr/local/mpich-4.1.2/                 (以下增加环境变量部分)
export PATH=$MPI_HOME/bin:$PATH
export PATH=$PATH:$MPI_HOME/include
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MPI_HOME/lib
export MANPATN=$MANPATH:$MPI_HOME/man
[root@hpc ~]# 

 后面如果执行xhpl如下报错,则说明LIB库的环境变量没有设置正确。

[root@hpc uec]# mpirun -np 4 ./xhpl
./xhpl: error while loading shared libraries: libmpi.so.12: cannot open shared object file: No such file or directory
./xhpl: error while loading shared libraries: libmpi.so.12: cannot open shared object file: No such file or directory
./xhpl: error while loading shared libraries: libmpi.so.12: cannot open shared object file: No such file or directory
./xhpl: error while loading shared libraries: libmpi.so.12: cannot open shared object file: No such file or directory

2、下载HPL软件包。

[root@hpc tmp]# wget https://www.netlib.org/benchmark/hpl/hpl-2.3.tar.gz  --no-check-certificate
--2023-11-07 19:27:35--  https://www.netlib.org/benchmark/hpl/hpl-2.3.tar.gz
Resolving www.netlib.org (www.netlib.org)... 160.36.239.231
Connecting to www.netlib.org (www.netlib.org)|160.36.239.231|:443... connected.
WARNING: cannot verify www.netlib.org's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’:
  Issued certificate has expired.
HTTP request sent, awaiting response... 200 OK
Length: 660871 (645K) [application/x-gzip]
Saving to: ‘hpl-2.3.tar.gz’

100%[==============================================================================================================================>] 660,871      408KB/s   in 1.6s   

2023-11-07 19:27:38 (408 KB/s) - ‘hpl-2.3.tar.gz’ saved [660871/660871]

[root@hpc tmp]# 

3、解压HPC软件包到目录/linpack。

#cd /linpack

# tar zxvf hpl-2.3.tar.gz

4、配置编译参数,开始编译

#cd hpl-2.3/setup

#cp Make.Linux_PII_FBLAS /linpack/hpc-2.3/Make.uec

#vi Make.uec  (主要修改内容如下)

[root@hpc hpl-2.3]# cat Make.uec | grep -v "#"
SHELL        = /bin/sh
CD           = cd
CP           = cp
LN_S         = ln -s
MKDIR        = mkdir
RM           = /bin/rm -f
TOUCH        = touch
ARCH         = uec           #随便写一个
TOPdir       = /linpack/hpl-2.3           # (HPL软件目录)
INCdir       = $(TOPdir)/include
BINdir       = $(TOPdir)/bin/$(ARCH)
LIBdir       = $(TOPdir)/lib/$(ARCH)
HPLlib       = $(LIBdir)/libhpl.a 
MPdir        = /usr/local/mpich-4.1.2            #(MPI安装目录)
MPinc        = -I$(MPdir)/include
MPlib        = $(MPdir)/lib/libmpich.so   # (默认不是这个文件名是a结尾的一个,MPI库没有)
LAdir        = /root/GotoBLAS2            #GotoBLAS2函数库位置
LAinc        =
LAlib        = $(LAdir)/libgoto2.a $(LAdir)/libgoto2.so      #BLAS2库文件
F2CDEFS      = -DAdd__ -DF77_INTEGER=int -DStringSunStyle
HPL_INCLUDES = -I$(INCdir) -I$(INCdir)/$(ARCH) $(LAinc) $(MPinc)
HPL_LIBS     = $(HPLlib) $(LAlib) $(MPlib)
HPL_OPTS     =
HPL_DEFS     = $(F2CDEFS) $(HPL_OPTS) $(HPL_INCLUDES)
CC           = /usr/bin/gcc
CCNOOPT      = $(HPL_DEFS)
CCFLAGS      = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -W -Wall  
LINKER       = /usr/bin/gfortran    #语言
LINKFLAGS    = $(CCFLAGS)
ARCHIVER     = ar
ARFLAGS      = r
RANLIB       = echo
[root@hpc hpl-2.3]# 

参数说明:

​ARCH :系统架构名称

TOPdir :hpl程序包解压后所在的路径

HPLlib :libhpl.a文件所在位置,一般都在hpl程序目录下

MPdir :mpi环境所在的路径

LAdir :GotoBlas库所在路径

LAlib :GotoBlas库文件所在路径

LINKEY :gfortran编译器所在位置

设置好hpl的编译参数之后,执行编译命令

#make arch=uec

编译完成后,将在hpl/bin/test/下生成HPL.dat和xhpl两个文件,其中HPL.dat是hpl测试时参数的配置文件,xhpl是hpl测试时被执行的mpi程序。

正常的结果如下:

echo /linpack/hpl-2.3/lib/uec/libhpl.a 
/linpack/hpl-2.3/lib/uec/libhpl.a
touch lib.grd
make[2]: Leaving directory `/linpack/hpl-2.3/testing/ptimer/uec'
( cd testing/ptest/uec;     make )
make[2]: Entering directory `/linpack/hpl-2.3/testing/ptest/uec'
/usr/bin/gcc -o HPL_pddriver.o -c -DAdd__ -DF77_INTEGER=int -DStringSunStyle  -I/linpack/hpl-2.3/include -I/linpack/hpl-2.3/include/uec  -I/usr/local/mpich-4.1.2/include -fomit-frame-pointer -O3 -funroll-loops -W -Wall  ../HPL_pddriver.c
/usr/bin/gcc -o HPL_pdinfo.o -c -DAdd__ -DF77_INTEGER=int -DStringSunStyle  -I/linpack/hpl-2.3/include -I/linpack/hpl-2.3/include/uec  -I/usr/local/mpich-4.1.2/include -fomit-frame-pointer -O3 -funroll-loops -W -Wall  ../HPL_pdinfo.c
/usr/bin/gcc -o HPL_pdtest.o -c -DAdd__ -DF77_INTEGER=int -DStringSunStyle  -I/linpack/hpl-2.3/include -I/linpack/hpl-2.3/include/uec  -I/usr/local/mpich-4.1.2/include -fomit-frame-pointer -O3 -funroll-loops -W -Wall  ../HPL_pdtest.c
/usr/bin/gfortran -DAdd__ -DF77_INTEGER=int -DStringSunStyle  -I/linpack/hpl-2.3/include -I/linpack/hpl-2.3/include/uec  -I/usr/local/mpich-4.1.2/include -fomit-frame-pointer -O3 -funroll-loops -W -Wall -o /linpack/hpl-2.3/bin/uec/xhpl HPL_pddriver.o         HPL_pdinfo.o           HPL_pdtest.o /linpack/hpl-2.3/lib/uec/libhpl.a  /root/GotoBLAS2/libgoto2.a /root/GotoBLAS2/libgoto2.so /usr/local/mpich-4.1.2/lib/libmpich.so
make /linpack/hpl-2.3/bin/uec/HPL.dat
make[3]: Entering directory `/linpack/hpl-2.3/testing/ptest/uec'
( cp ../HPL.dat /linpack/hpl-2.3/bin/uec )
make[3]: Leaving directory `/linpack/hpl-2.3/testing/ptest/uec'
touch dexe.grd
make[2]: Leaving directory `/linpack/hpl-2.3/testing/ptest/uec'
make[1]: Leaving directory `/linpack/hpl-2.3'
[root@hpc hpl-2.3]# echo $?
0
[root@hpc hpl-2.3]# cd bin
[root@hpc bin]# ls
uec
[root@hpc bin]# cd uec
[root@hpc uec]# ls
HPL.dat  xhpl
[root@hpc uec]# pwd
/linpack/hpl-2.3/bin/uec

如果出现如下报错,

 /usr/lib64//libpthread.so.0: error adding sumbols: DSO missing from command line

在 make.uec文件的CCFLAGS这行,末尾添加参数 -lpthread

CCFLAGS      = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -W -Wall  -lpthread

5、测试xhpl运行

   使用默认参数运行测试xhpl。没问题后续再根据机器的配置来调整HPL.dat中的计算参数。

这个参数比较复杂,等另外开个博客说明吧。

[root@hpc uec]# mpirun -np 4 ./xhpl
================================================================================
HPLinpack 2.3  --  High-Performance Linpack benchmark  --   December 2, 2018
Written by A. Petitet and R. Clint Whaley,  Innovative Computing Laboratory, UTK
Modified by Piotr Luszczek, Innovative Computing Laboratory, UTK
Modified by Julien Langou, University of Colorado Denver
================================================================================

An explanation of the input/output parameters follows:
T/V    : Wall time / encoded variant.
N      : The order of the coefficient matrix A.
NB     : The partitioning blocking factor.
P      : The number of process rows.
Q      : The number of process columns.
Time   : Time in seconds to solve the linear system.
Gflops : Rate of execution for solving the linear system.

The following parameter values will be used:

N      :      29       30       34       35 
NB     :       1        2        3        4 
PMAP   : Row-major process mapping
P      :       2        1        4 
Q      :       2        4        1 
PFACT  :    Left    Crout    Right 
NBMIN  :       2        4 
NDIV   :       2 
RFACT  :    Left    Crout    Right 
BCAST  :   1ring 
DEPTH  :       0 
SWAP   : Mix (threshold = 64)
L1     : transposed form
U      : transposed form
EQUIL  : yes
ALIGN  : 8 double precision words

--------------------------------------------------------------------------------

- The matrix A is randomly generated for each test.
- The following scaled residual check will be computed:
      ||Ax-b||_oo / ( eps * ( || x ||_oo * || A ||_oo + || b ||_oo ) * N )
- The relative machine precision (eps) is taken to be               1.110223e-16
- Computational tests pass if scaled residuals are less than                16.0

================================================================================
T/V                N    NB     P     Q               Time                 Gflops
--------------------------------------------------------------------------------
WR00L2L2          29     1     2     2               2.65             6.6096e-06
HPL_pdgesv() start time Tue Nov  7 18:33:48 2023

HPL_pdgesv() end time   Tue Nov  7 18:33:51 2023

--------------------------------------------------------------------------------
||Ax-b||_oo/(eps*(||A||_oo*||x||_oo+||b||_oo)*N)=   1.72533487e-02 ...... PASSED
================================================================================
T/V                N    NB     P     Q               Time                 Gflops
--------------------------------------------------------------------------------
WR00L2L4          29     1     2     2               2.87             6.0960e-06
HPL_pdgesv() start time Tue Nov  7 18:33:51 2023

HPL_pdgesv() end time   Tue Nov  7 18:33:54 2023

--------------------------------------------------------------------------------
||Ax-b||_oo/(eps*(||A||_oo*||x||_oo+||b||_oo)*N)=   1.72533487e-02 ...... PASSED
================================================================================
T/V                N    NB     P     Q               Time                 Gflops
--------------------------------------------------------------------------------
WR00L2C2          29     1     2     2               3.01             5.8250e-06
HPL_pdgesv() start time Tue Nov  7 18:33:55 2023

HPL_pdgesv() end time   Tue Nov  7 18:33:58 2023

--------------------------------------------------------------------------------
||Ax-b||_oo/(eps*(||A||_oo*||x||_oo+||b||_oo)*N)=   1.72533487e-02 ...... PASSED
================================================================================
T/V                N    NB     P     Q               Time                 Gflops
--------------------------------------------------------------------------------
WR00L2C4          29     1     2     2               2.87             6.0944e-06
HPL_pdgesv() start time Tue Nov  7 18:33:58 2023

HPL_pdgesv() end time   Tue Nov  7 18:34:01 2023

6、关于HPL.dat参数说明:

[root@hpc1 uec]# cat HPL.dat
HPLinpack benchmark input file
Innovative Computing Laboratory, University of Tennessee
HPL.out      output file name (if any)
6            device out (6=stdout,7=stderr,file)
1          # of problems sizes (N)
30000  Ns                #跟节点内存有关系,
矩阵占用系统总内存的80%左右为最佳,即N×N×8=系统总内存×80%(其中总内存的单位为字节)。
1            # of NBs
192     NBs     #常见参数是32-384之间 ,NB表示求解矩阵过程中矩阵分块的大小
0            PMAP process mapping (0=Row-,1=Column-major)
1            # of process grids (P x Q)
1        Ps    #P*Q代表进程数,一般等于节点的CPU核数。如果是集群,就是集群总CPU数。P要小于等于Q
4        Qs
16.0         threshold
3            # of panel fact
0 1 2        PFACTs (0=left, 1=Crout, 2=Right)
2            # of recursive stopping criterium
2 4          NBMINs (>= 1)
1            # of panels in recursion
2            NDIVs
3            # of recursive panel fact.
0 1 2        RFACTs (0=left, 1=Crout, 2=Right)
1            # of broadcast
0            BCASTs (0=1rg,1=1rM,2=2rg,3=2rM,4=Lng,5=LnM)
1            # of lookahead depth
0            DEPTHs (>=0)
2            SWAP (0=bin-exch,1=long,2=mix)
64           swapping threshold
0            L1 in (0=transposed,1=no-transposed) form
0            U  in (0=transposed,1=no-transposed) form
1            Equilibration (0=no,1=yes)
8            memory alignment in double (> 0)
[root@hpc1 uec]# 

7 、集群测试注意事项

1、集群测试需要所有节点上都准备好MPI和GotoBLAS2函数库。可以不需要重新编译,把第一个节点上编译好的目录拷过去也可以,或者建议直接把MPI和函数库编译安装到共享存储的目录,所有节点都可以访问,当时环境变量也要设置和运行进程首个节点一样。

2、当前运行任务首节点目录的创建Hostfile文件,指定linpack运行的节点名称,所有节点之前要做好ssh免密登录。同时关闭系统的防火墙firewalld。

#[root@hpc1 uec]# more hostfile
hpc1
hpc2

#mpirun  -np 8 -hostfile hostfile /linpack/hpl-2.3/bin/uec/xhpl     (在定义的2个节点上运行)

一般这个NP值和P*Q的值相等即可,

3、运行测试过程要不断测试N的值以及PQ的值,能寻找最优结果。建议所有节点取消swap分区,避免出现页面交换。(swapoff -a)。

4、运行时候找几个节点top监控一下,一般来说,CPU是100%,表示全部调度起来了,如果CPU不到100%,可能是进程数不够,,内存达到80%为好。

5、理论值的CPU浮点运算能力=物理CPU数*核心数*CPU频率*CPU每周期执行浮点运算的次数(通常intel是16), 实际值除以理论值就是linpack测试效率,结果是越高越好了。

6、所有节点建议是在BIOS中关闭CPU超线程选项。

7、单节点测试,建议用P和Q等于都等于1,然后1个进程多个线程的方式测试。

         单节点linpack测试采用单核多线程方式运行

         #export OMP_THREAD_NUM=28   (线程数量等于CPU核心数量)

         # mpirun -np 1 ./xhpl

8、测试过程中可以用top或turbostat查看CPU的负载。

[root@hpctest ~]# turbostat  
Package Core    CPU     Avg_MHz Busy%   Bzy_MHz TSC_MHz IRQ     SMI     CPU%c1  CPU%c3  CPU%c6  CPU%c7  CoreTmp PkgTmp  RAMWatt PKG_%   RAM_%
-       -       -       1596    100.00  1600    1596    60299   0       0.00    0.00    0.00    0.00    39      45      8.67    0.00    0.00
0       0       0       1597    100.00  1600    1597    5023    0       0.00    0.00    0.00    0.00    37      45      3.91    0.00    0.00
0       1       1       1597    100.00  1600    1597    5018    0       0.00    0.00    0.00    0.00    39
0       2       2       1597    100.00  1600    1597    5011    0       0.00    0.00    0.00    0.00    37
0       3       3       1597    100.00  1600    1597    5015    0       0.00    0.00    0.00    0.00    38
0       4       4       1596    100.00  1600    1596    5019    0       0.00    0.00    0.00    0.00    39
0       5       5       1596    100.00  1600    1596    5151    0       0.00    0.00    0.00    0.00    37
1       0       6       1596    100.00  1600    1596    5008    0       0.00    0.00    0.00    0.00    37      42      4.76    0.00    0.00
1       1       7       1596    100.00  1600    1596    5008    0       0.00    0.00    0.00    0.00    36
1       2       8       1596    100.00  1600    1596    5009    0       0.00    0.00    0.00    0.00    37
1       3       9       1596    100.00  1600    1596    5007    0       0.00    0.00    0.00    0.00    39
1       4       10      1596    100.00  1600    1596    5007    0       0.00    0.00    0.00    0.00    38
1       5       11      1596    100.00  1600    1596    5023    0       0.00    0.00    0.00    0.00    36

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值