1.使用的是OPENBLAS

git clone https://github.com/xianyi/OpenBLAS.git
cd OpenBLAS
make
make PREFIX=$HOME/opt/OpenBLAS install

2.oneMPI安装

wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.4.tar.gz
tar xf openmpi-4.1.4.tar.gz
cd openmpi-4.1.4
./configure --prefix=$HOME/opt/OpenMPI  #安装路径
make -j 16
make instal

export MPI_HOME=$HOME/opt/OpenMPI
export PATH=$PATH:$MPI_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MPI_HOME/lib

3.HPL安装

 wget https://netlib.org/benchmark/hpl/hpl-2.3.tar.gz
 tar -xvf hpl-2.3.tar
 rm hpl-2.3.tar
 mv hpl-2.3 ~/hpl
 cd hpl
 cp setup/Make.Linux_PII_CBLAS ./Make.Linux

3.1修改配置文件

#
ARCH         = Linux
#
# ----------------------------------------------------------------------
# - HPL Directory Structure / HPL library ------------------------------
# ----------------------------------------------------------------------
#
TOPdir       = /hpl-2.3  #HPL包路径
INCdir       = $(TOPdir)/include
BINdir       = $(TOPdir)/bin/$(ARCH)
LIBdir       = $(TOPdir)/lib/$(ARCH)
#
HPLlib       = $(LIBdir)/libhpl.a
MPdir        = /opt/OpenMPI
MPinc        = -I$(MPdir)/include
#MPlib        = $(MPdir)/lib/libopenblas.a
MPlib        = -L$(MPdir)/lib -Wl,-rpath=$(MPdir)/lib
#
# ----------------------------------------------------------------------
# - 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/OpenBLAS  #BLAS安装路径
LAinc        =
LAlib        = $(LAdir)/libopenblas.a
#
HPL_OPTS     = -DHPL_CALL_CBLAS
#
# ----------------------------------------------------------------------
#
HPL_DEFS     = $(F2CDEFS) $(HPL_OPTS) $(HPL_INCLUDES)
#
# ----------------------------------------------------------------------
# - Compilers / linkers - Optimization flags ---------------------------
# ----------------------------------------------------------------------
#
CC           = /opt/OpenMPI/bin/mpicc   #调用MPI环境使用MPICC
CCNOOPT      = $(HPL_DEFS)
CCFLAGS      = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops
#
# On some platforms,  it is necessary  to use the Fortran linker to find
# the Fortran internals used in the BLAS library.
#
LINKER       = /opt/OpenMPI/bin/mpif77  ##调用MPI环境使用MPIf77
LINKFLAGS    = $(CCFLAGS)
#
ARCHIVER     = ar
ARFLAGS      = r
RANLIB       = echo

3.2编译

make arch=Linux

3.3编译是否成功,查看bin/Linux下是否有xhpl
在这里插入图片描述
3.4,进入到bin/Linux执行

mpirun -np 4 ./xhpl > HPL-Benchmark.txt
#如果提示--allow-run-as-root 执行
mpirun --allow-run-as-root -np 4 ./xhpl > HPL-Benchmark.txt

4.如果出现以下报错

[1]: Leaving directory '/test/hpl-2.3'
make -f Make.top build_src       arch=Linux_PII_CBLAS
make[1]: Entering directory '/test/hpl-2.3'
( cd src/auxil/Linux_PII_CBLAS;         make )
make[2]: Entering directory '/test/hpl-2.3/src/auxil/Linux_PII_CBLAS'
Makefile:47: Make.inc: No such file or directory
make[2]: *** No rule to make target 'Make.inc'.  Stop.
make[2]: Leaving directory '/test/hpl-2.3/src/auxil/Linux_PII_CBLAS'
make[1]: *** [Make.top:54: build_src] Error 2
make[1]: Leaving directory '/test/hpl-2.3'
make: *** [Makefile:72: build] Error 2

查看路径是否写对,HPL,OpenBLAS库和MPI,还有CC和LINKER。
大概率是CC和LINKER。

Logo

鲲鹏昇腾开发者社区是面向全社会开放的“联接全球计算开发者,聚合华为+生态”的社区,内容涵盖鲲鹏、昇腾资源,帮助开发者快速获取所需的知识、经验、软件、工具、算力,支撑开发者易学、好用、成功,成为核心开发者。

更多推荐