容器的md5值: 72ef4b81e10da6edfb9a44b35af0a45b

使用方法：
(注：“/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
在本页面下载dl_poly_1.1_SVE_v1.sif文件，并上传到服务器目录/path/to/sif

四、获取测试算例TEST41.tar.gz
wget https://gitlab.com/DL_POLY_Classic/tests/-/raw/master/TEST41.tar.gz
算例目录解压后在 /path/to/TEST41/NHC/ 目录层运行二进制


五、运行容器
1、单节点运行：
cd /path/to/TEST41/NHC/
可选命令1（使用外部mpi运行）：
time -p mpirun --allow-run-as-root -np 128  -mca btl ^openib singularity exec -B /path/to/sif/TEST41/NHC /path/to/sif/dl_poly_1.1_SVE_v1.sif DLPOLY.X

可选命令2（使用容器内部mpi运行）：
singularity exec -B /path/to/sif/TEST41/NHC /path/to/sif/dl_poly_1.1_SVE_v1.sif mpirun --allow-run-as-root --mca btl ^openib -np 128 DLPOLY.X


（说明：-B：绑定本地算例目录，exec命令进入容器为只读模式，不可在容器内对文件进行读写操作。np为MPI进程数量。程序运行结束时，在当前目录生成roms_examples.log，单节点可不依赖物理机上的mpi直接运行，对不需>要进行多节点运行的用户可选择命令2，即不需要额外安装mpi）

2、多节点运行：
time -p mpirun --allow-run-as-root -np 256 -N 128 --hostfile hostfile -x OMP_NUM_THREADS=1  -x PATH -x LD_LIBRARY_PATH -mca btl ^openib singularity exec -B /path/to/sif/TEST41/NHC /path/to/sif/dl_poly_1.1_SVE_v1.sif DLPOLY.X



