CentOS7 单节点和多节点 HPL测试

前置工作:安装OpenBLAS; 安装Mpich (可参考首页博客)

  • 官网下载压缩包到/opt目录

    cd /opt && wget //www.netlib.org/benchmark/hpl/hpl-2.3.tar.gz
    

    image-20220512104017520

  • 解压到 /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 = Linux
    
    TOPdir = /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 # compiler
    CCFLAGS = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -pthread
    
    LINKER = /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
    
    1. 单节点测试

      mpiexec -np 4 ./xhpl
      
    2. 多节点测试

      编辑节点文件,输入节点主机名或IP地址

      vim nodes
      

      eg:

      image-20220512103037665

      修改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)
      1200         Ns
      1            # of NBs
      232          NBs
      0            PMAP process mapping (0=Row-,1=Column-major)
      1            # of process grids (P x Q)
      1            Ps
      4            Qs
      16.0         threshold
      1            # of panel fact
      0            PFACTs (0=left, 1=Crout, 2=Right)
      1            # of recursive stopping criterium
      2            NBMINs (>= 1)
      1            # of panels in recursion
      2            NDIVs
      1            # of recursive panel fact.
      0            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
      1            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)
      

      运行hpl

      mpiexec -np 4 -machinefile ./nodes ./xhpl
      

      image-20220512103517848

    3. 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)     # 输出方式选择(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 right
      1            # 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)     # 指出程序运行时内存分配中的采用的对齐方式
      

Tags: