容器的md5值:aafa51b68fadb751545be3dd16eddf15

使用方法：
(注：“/path/to”表示举例路径，现网需要根据实际情况调整，建议部署在共享路径中，后续章节凡是遇到安装路径的命令，都以现网实际规划的安装路径为准进行替换，不再单独说明。)

一、安装装singularity
yum -y install libatomic libstdc++ libstdc++-devel libseccomp-devel glib2-devel gcc squashfs-tools tar
cd /path/to/go_build 
wget https://go.dev/dl/go1.19.linux-arm64.tar.gz --no-ch 
tar -C /path/to/go_install -xf go1.19.linux-arm64.tar.gz 
export PATH=/path/to/go_install/go/bin:$PATH
source ~/.bashrc

cd /path/to/singularity_build 
wget https://github.com/sylabs/singularity/releases/download/v3.10.2/singularity-ce-3.10.2.tar.gz --no-ch 
tar -xf singularity-ce-3.10.2.tar.gz 
cd singularity-ce-3.10.2 
./mconfig --prefix=/path/to/singularity_install
make -C ./builddir 
make -C ./builddir install 
export PATH=/path/to/singularity_install/bin:$PATH

二、安装hmpi
cd /path/to/bs_build
wget https://mirrors.huaweicloud.com/kunpeng/archive/compiler/bisheng_compiler/BiShengCompiler-3.2.0-aarch64-linux-mini.tar.gz
tar xzvf BiShengCompiler-3.2.0-aarch64-linux-mini.tar.gz -C /path/to/bs_install --strip-components=1
export PATH=/path/to/bs_install/bin:$PATH
export LD_LIBRARY_PATH=/path/to/bs_install/lib:/path/to/bs_install/lib/clang/15.0.4/lib:$LD_LIBRARY_PATH
export INCLUDE=/path/to/bs_install/include:/path/to/bs_install/lib/clang/15.0.4/include:$INCLUDE
export CC=clang CXX=clang++ FC=flang

yum install -y perl-Data-Dumper autoconf automake libtool binutils flex cmake
cd /path/to/hucx_build
wget https://gitee.com/kunpengcompute/hucx/repository/archive/v2.3.0-huawei.tar.gz -f hucx-2.3.0-huawei.tar.gz
tar xf hucx-2.3.0-huawei.tar.gz
cd hucx-v2.3.0-huawei
./autogen.sh
./contrib/configure-opt --prefix=/path/to/hucx_install --disable-numa --enable-mt CFLAGS="-Wno-unused-but-set-variable -Wno-error=int-conversion" CXXFLAGS="-Wno-unused-but-set-variable -Wno-error=int-conversion"
make -j
make -j install
export PATH=/path/to/hucx_install/bin:$PATH
export LD_LIBRARY_PATH=/path/to/hucx_install/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=/path/to/hucx_install/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/path/to/hucx_install/include:$CPLUS_INCLUDE_PATH
export CFLAGS="-Wno-unused-but-set-variable -Wno-error=int-conversion" CXXFLAGS="-Wno-unused-but-set-variable -Wno-error=int-conversion" FFLAGS="-Wno-error=int-conversion"

cd /path/to/xucg_build
wget https://gitee.com/kunpengcompute/xucg/repository/archive/v2.3.0-huawei.tar.gz -f xucg-2.3.0-huawei.tar.gz
tar xf xucg-2.3.0-huawei.tar.gz
cd xucg-v2.3.0-huawei
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/xucg_install -DCMAKE_BUILD_TYPE=Release -DUCG_BUILD_WITH_UCX=/path/to/hucx_install -DUCG_ENABLE_MT=ON -DUCG_BUILD_TESTS=OFF -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_Fortran_COMPILER=$FC
make -j
make -j install
export PATH=/path/to/xucg_install/bin:$PATH
export LD_LIBRARY_PATH=/path/to/xucg_install/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=/path/to/xucg_install/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/path/to/xucg_install/include:$CPLUS_INCLUDE_PATH

cd /path/to/hmpi_build
wget https://gitee.com/kunpengcompute/hmpi/repository/archive/v2.3.0-huawei.tar.gz -f hmpi-2.3.0-huawei.tar.gz
tar xf hmpi-2.3.0-huawei.tar.gz
cd hmpi-v2.3.0-huawei/
./autogen.pl
./configure --prefix=/path/to/hmpi_install --with-platform=contrib/platform/mellanox/optimized --enable-mpi1-compatibility --with-ucx=/path/to/hucx_install --with-ucg=/path/to/xucg_install
make -j
make -j install
export PATH=/path/to/hmpi_install/bin:$PATH
export LD_LIBRARY_PATH=/path/to/hmpi_install/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=/path/to/hmpi_install/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/path/to/hmpi_install/include:$CPLUS_INCLUDE_PATH

三、获取容器sif
在本页面下载CP2K_8.2_SVE_v1.sif文件，并上传到服务器目录/path/to/sif

四、获取测试算例case
在本页面下载H2O-256.inp.tar.gz算例，并上传到服务器目录/path/to/case

五、运行容器
1、单节点运行：
cd /path/to/case
mpirun --hostfile $HOSTFILE --mca btl ^openib -np 128 -x OMP_NUM_THREADS=1 -x PATH -x LD_LIBRARY_PATH singularity  exec -B  /path/to/case /path/to/sif/CP2K_8.2_SVE_v1.sif cp2k.psmp /path/to/case/H2O-256.inp 2>&1 |tee cp2k.log
（说明：-B：绑定本地算例目录，exec命令进入容器为只读模式，不可在容器内对文件进行读写操作。np为MPI进程数量，如果没有开启超线程技术，MPI进程数乘以OMP线程数应该小于等于CPU核数，例如命令中MPI进程数128乘以OMP线程数1应该小于等于环境上CPU核数。程序运行结束时，在当前目录生成cp2k.log，需要查看日志文件cp2k.log中的“PROGRAM STARTED AT”与“PROGRAM ENDED AT”的时间差值，时间越少性能越优。）

2、多节点运行：
mpirun --hostfile $HOSTFILE --mca btl ^openib -np 128 -N 64 -x OMP_NUM_THREADS=1 -x PATH -x LD_LIBRARY_PATH singularity  exec -B /path/to/case /path/to/sif/CP2K_8.2_SVE_v1.sif cp2k.psmp /path/to/case/H2O-256.inp 2>&1 |tee cp2k.log

