毕昇编译器
介绍¶
毕昇编译器是华为编译器实验室针对鲲鹏等通用处理器架构场景,打造的一款高性能、高可信及易扩展的编译器工具链,增强和引入了多种编译优化技术,支持C/C++/Fortran等编程语言及对应编程语言的OpenMP扩展。
华为高性能通信库(Hyper MPI,hmpi)是整个高性能计算解决方案的关键组件,它实现了并行计算的网络通讯功能,可以用来支持制造、气象、分子动力学等应用场景。
集群上配置了华为毕昇编译器以及Hyper MPI,使用以下命令加载。
module purge
source /share/software/HPCKit/latest/setvars.sh
module use /share/software/HPCKit/latest/modulefiles
module load bisheng/compiler/bishengmodule bisheng/hmpi/hmpi
或
module load arm/hyper-mpi/24.6.30_bisheng
$ mpicc -show
clang -I/share/software/HPCKit/24.6.30/hmpi/bisheng/hmpi/include -I/share/software/HPCKit/24.6.30/hmpi/bisheng/hmpi/include/openmpi -I/share/software/HPCKit/24.6.30/hmpi/bisheng/hmpi/include/openmpi/opal/mca/hwloc/hwloc201/hwloc/include -I/share/software/HPCKit/24.6.30/hmpi/bisheng/hmpi/include/openmpi/opal/mca/event/libevent2022/libevent -I/share/software/HPCKit/24.6.30/hmpi/bisheng/hmpi/include/openmpi/opal/mca/event/libevent2022/libevent/include -L/share/software/HPCKit/24.6.30/hmpi/bisheng/hmpi/lib -Wl,-rpath -Wl,/share/software/HPCKit/24.6.30/hmpi/bisheng/hmpi/lib -Wl,--enable-new-dtags -lmpi
编译 lammps¶
这里以 lammps 编译安装为例,介绍毕昇编译器以及Hyper MPI的使用。
加载编译环境¶
module load arm/hyper-mpi/24.6.30_bisheng
编译配置 fftw¶
安装 fftw,样例安装目录:/path/to/FFTW
wget http://www.fftw.org/fftw-3.3.8.tar.gz
tar -xvf fftw-3.3.8.tar.gz
cd fftw-3.3.8
export CC=`which clang`
export CXX=`which clang++`
export FC=`which flang`
./configure --prefix=/path/to/FFTW --enable-shared --enable-static --enable-fma --enable-neon
make -j 96
make install
配置fftw环境变量
export PATH=/path/to/FFTW/bin:$PATH
export LD_LIBRARY_PATH=/path/to/FFTW/lib:$LD_LIBRARY_PATH
编译 lammps¶
下载lammps源码包:https://www.lammps.org/download.html
tar -xzf lammps-stable.tar.gz
cd lammps-29Aug2024/src
MAKE/Makefile.mpi
文件,修改CCFLAGS
、LINKFLAGS
、FFT_INC
、FFT_PATH
、FFT_LIB
这5行的内容: CC = mpicxx
CCFLAGS = -g -O3 -I/path/to/BISHENG/include/c++/v1 -L/path/to/BISHENG/lib -std=c++11 -stdlib=libc++ -lc++ -lc++abi
SHFLAGS = -fPIC
DEPFLAGS = -M
LINK = mpicxx
LINKFLAGS = -g -O -L/path/to/BISHENG/lib -std=c++11 -stdlib=libc++ -lc++ -lc++abi
LIB =
SIZE = size
……
ARCHIVE = ar
ARFLAGS = -rc
SHLIBFLAGS = -shared
FFT_INC = -DFFT_FFTW -I/path/to/FFTW/include
FFT_PATH = -L/path/to/FFTW/lib
FFT_LIB = -lfftw3
make yes-KSPACE
make yes-MPIIO
make yes-MOLECULE
make yes-MANYBODY
make mpi -j
编译 lapack¶
加载编译环境¶
module load arm/hyper-mpi/24.6.30_bisheng
编译 lapack¶
tar xf lapack-3.12.0.tar.gz
cd lapack-3.12.0
cp INSTALL/make.inc.gfortran make.inc
将 make.inc
中的 CC = gcc
改为 CC = clang
,FC = gfortran
改为 FC = flang
。
TIMER = INT_ETIME
注释掉,# TIMER = INT_CPU_TIME
取消注释,否则编译报错 etime is not an intrinsic function
。
修改后的 make.inc
如下所示。
make.inc
####################################################################
# LAPACK make include file. #
####################################################################
SHELL = /bin/sh
# CC is the C compiler, normally invoked with options CFLAGS.
#
CC = clang
CFLAGS = -O3
# Modify the FC and FFLAGS definitions to the desired compiler
# and desired compiler options for your machine. NOOPT refers to
# the compiler options desired when NO OPTIMIZATION is selected.
#
# Note: During a regular execution, LAPACK might create NaN and Inf
# and handle these quantities appropriately. As a consequence, one
# should not compile LAPACK with flags such as -ffpe-trap=overflow.
#
FC = flang
FFLAGS = -O2 -frecursive
FFLAGS_DRV = $(FFLAGS)
FFLAGS_NOOPT = -O0 -frecursive
# Define LDFLAGS to the desired linker options for your machine.
#
LDFLAGS =
# The archiver and the flag(s) to use when building an archive
# (library). If your system has no ranlib, set RANLIB = echo.
#
AR = ar
ARFLAGS = cr
RANLIB = ranlib
# Timer for the SECOND and DSECND routines
#
# Default: SECOND and DSECND will use a call to the
# EXTERNAL FUNCTION ETIME
#TIMER = EXT_ETIME
# For RS6K: SECOND and DSECND will use a call to the
# EXTERNAL FUNCTION ETIME_
#TIMER = EXT_ETIME_
# For gfortran compiler: SECOND and DSECND will use a call to the
# INTERNAL FUNCTION ETIME
#TIMER = INT_ETIME
# If your Fortran compiler does not provide etime (like Nag Fortran
# Compiler, etc...) SECOND and DSECND will use a call to the
# INTERNAL FUNCTION CPU_TIME
TIMER = INT_CPU_TIME
# If none of these work, you can use the NONE value.
# In that case, SECOND and DSECND will always return 0.
#TIMER = NONE
...
BLASLIB = $(TOPSRCDIR)/librefblas.a
CBLASLIB = $(TOPSRCDIR)/libcblas.a
LAPACKLIB = $(TOPSRCDIR)/liblapack.a
TMGLIB = $(TOPSRCDIR)/libtmglib.a
LAPACKELIB = $(TOPSRCDIR)/liblapacke.a
# DOCUMENTATION DIRECTORY
# If you generate html pages (make html), documentation will be placed in $(DOCSDIR)/explore-html
# If you generate man pages (make man), documentation will be placed in $(DOCSDIR)/man
DOCSDIR = $(TOPSRCDIR)/DOCS
编译 make -j20 lapacklib
。
如编译有报错,修改后 make clean
再编译。
本站总访问量 次