HPL+CBLAS+MPICH的搭建及测试流程

集群管理 0 1997 跨栏背心儿 收藏

一、环境介绍

系统环境:

本文主要介绍HPL+CBLAS+MPICH的搭建及测试流程,和HPCG的搭建及测试流程,其中CBLAS可换成OpenBLAS或Intel的MKL或GotoBLAS2,MPICH可换成OpenMPI,HPL和HPCG分别使用稠密矩阵计算和稀疏矩阵计算的方式评估服务器的性能的宏基准测试程序。

类别内容
环境:物理机
系统:CentOS release 6.10 (Final)
软件安装目录:/root/Linpack/
测试权限:root
软件版本:blas-3.8.0、cblas、mpich-3.2.1、hpl-2.3、HPCG-3.1

下载地址:

BLAS:http://www.netlib.org/blas/blas-3.8.0.tgz
CBLAS:http://www.netlib.org/blas/blast-forum/cblas.tgz
MPICH:http://www.mpich.org/static/downloads/3.2.1/mpich-3.2.1.tar.gz
HPL:https://www.netlib.org/benchmark/hpl/hpl-2.3.tar.gz
HPCG:https://codeload.github.com/hpcg-benchmark/hpcg/zip/refs/heads/master

替换软件下载地址:

GotoBLAS2 :https://www.tacc.utexas.edu/research-development/tacc-software/gotoblas2
OpenBLAS:https://github.com/xianyi/OpenBLAS
MKL:https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html
Lapack :http://www.netlib.org/lapack/
OpenMPI:https://www.open-mpi.org/

二、环境搭建流程

1、安装依赖包

yum install gcc gcc-c++ patch make glibc-static gcc-gfortran

2、安装BLAS

cd /root/Linpack
tar xf blas-3.8.0.tar.gz
cd BLAS-3.8.0
make -j 8
ar rv libblas.a *.o

3、安装CBLAS

cd /root/Linpack
tar xf cblas.tar.gz
cd CBLAS
cp /root/Linpack/BLAS-3.8.0/blas_LINUX.a /root/Linpack/CBLAS
cp blas_LINUX.a lib/

修改 Makefile.in

BLLIB = /root/Linpack/CBLAS/blas_LINUX.a
CBLIB = ../lib/cblas_$(PLAT).a

编译:

make

测试:

/root/Linpack/CBLAS/testing/xzcblat1

测试结果:

Complex CBLAS Test Program Results
 Test of subprogram number  1         CBLAS_ZDOTC    
                                    ----- PASS -----
 Test of subprogram number  2         CBLAS_ZDOTU    
                                    ----- PASS -----
 Test of subprogram number  3         CBLAS_ZAXPY    
                                    ----- PASS -----
 Test of subprogram number  4         CBLAS_ZCOPY    
                                    ----- PASS -----
 Test of subprogram number  5         CBLAS_ZSWAP    
                                    ----- PASS -----
 Test of subprogram number  6         CBLAS_DZNRM2   
                                    ----- PASS -----
 Test of subprogram number  7         CBLAS_DZASUM   
                                    ----- PASS -----
 Test of subprogram number  8         CBLAS_ZSCAL    
                                    ----- PASS -----
 Test of subprogram number  9         CBLAS_ZDSCAL   
                                    ----- PASS -----
 Test of subprogram number 10         CBLAS_IZAMAX   
                                    ----- PASS -----

4、安装MPICH

cd /root/Linpack
tar xf mpich-3.2.1.tar.gz
mkdir mpich
cd mpich-3.2.1
./configure --prefix=/root/Linpack/mpich
make -j 8
make install

修改环境变量/root/.bashrc:

export PATH=/root/Linpack/mpich/bin:$PATH
export LD_LIBRARY_PATH=/root/Linpack/mpich/lib:$LD_LIBRARY_PATH

加载环境变量并查找mpirun & mpiexec:

source /root/.bashrc
which mpirun && which mpiexec

5、安装HPL

cd /root/Linpack
tar xf hpl-2.3.tar.gz
cd hpl-2.3
cp setup/Make.Linux_PII_FBLAS Make.test
sed -i 's/UNKNOWN/test/g' Make.top
sed -i 's/UNKNOWN/test/g' Makefile

修改Make.test

ARCH         = test
TOPdir       = /root/Linpack/hpl-2.3
MPdir        = /root/Linpack/mpich
MPlib        = $(MPdir)/lib/libmpi.so
LAdir        = /root/Linpack/CBLAS/lib
LAlib        = $(LAdir)/cblas_LINUX.a $(LAdir)/blas_LINUX.a
CC           = /root/Linpack/mpich/bin/mpicc
LINKER       = /root/Linpack/mpich/bin/mpif77

安装:

make arch=test

6、安装HPCG

cd /root/Linpack
unzip hpcg-master.zip
cd /root/Linpack/hpcg-master/setup

修改 Make.Linux_MPI

MPdir        = /root/Linpack/mpich
MPlib        = $(MPdir)/lib/libmpi.a
CXX          = /root/Linpack/mpich/bin/mpicxx
cd /root/Linpack/hpcg-master/
mkdir build
cd build
/root/Linpack/hpcg-master/configure Linux_MPI
make

三、测试流程

1、HPL测试流程

cd /root/Linpack/hpl-2.3/bin/test/
mpirun -np 4 ./xhpl > test.log        #-np 4是服务器核心数量,可使用服务器实际cpu线程数,如:-np 64

其中,使用默认HPL.dat测试,结果会很不理想,所以在运行前需调整HPL.dat的参数,手动更改参数时可参考官方说明

官放说明:

https://www.netlib.org/benchmark/hpl/tuning.html

如需根据服务器硬件配置自动生成HPL.dat文件,可参考如下两个网站

https://www.advancedclustering.com/act_kb/tune-hpl-dat-file/
http://hpl-calculator.sourceforge.net/

2、HPCG测试流程

cd /root/Linpack/hpcg-master/build/bin
mpirun -np 4 ./xhpcg    ##-np 4是服务器核心数量,可使用服务器实际cpu线程数,如:-np 64

注意标准 HPCG 是要至少跑满半个小时的,因此hpcg.dat第四行至少要设置成1800;根据README,问题的三维都要是 8 的倍数,并且至少要是 24。

hpc.dat默认内容如下:

HPCG benchmark input file
Sandia National Laboratories; University of Tennessee, Knoxville
104 104 104
60

测试生成的结果文件:

如:HPCG-Benchmark_3.1_2022-04-14_11-17-52.txt

打开结果文件,主要关注########## Performance Summary (times in sec) ##########=下面的几行数据

Benchmark Time Summary::Total=64.0872
Floating Point Operations Summary::Total with convergence overhead=3.34222e+11
GB/s Summary::Total with convergence and optimization phase overhead=38.3224
User Optimization Overheads::Optimization phase time vs reference SpMV+MG time=9.34363e-07
Final Summary::HPCG result is VALID with a GFLOP/s rating of=5.05272

其中,在运行前需调整HPL.dat的参数,手动更改参数时可参考官方说明

官方文档:

https://github.com/hpcg-benchmark/hpcg/blob/master/TUNING



相关推荐:

网友留言:

您需要 登录账户 后才能发表评论

我要评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
验证码