编译和安装
操作步骤
- 使用PuTTY工具,以root用户登录服务器。
- 执行以下命令进入主程序安装目录。
cd /path/to/LAMMPS
- 执行以下命令解压安装包。
tar -xvf lammps-10Feb2021.tar.gz
- 执行以下命令进入解压后路径。
cd lammps-10Feb21
- 编辑GPU模块,执行以下命令修改配置文件“Makefile.linux”。
- 打开配置文件“Makefile.linux”。
cd lib/gpu vi Makefile.linux
- 按“i”进入编辑模式,修改如下内容。
CUDA_HOME = /usr/local/cuda-11.4 NVCC=nvcc CUDA_ARCH=-arch=sm_80 #显卡对应的型号,当前环境使用A100(Ampere架构) CUDA_PRECISION=-D_DOUBLE_DOUBLE #计算精度
- 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。
- 打开配置文件“Makefile.linux”。
- 执行以下命令编译Lammps GPU模块。
make -f Makefile.linux -j 16
- 执行以下命令查看GPU信息。
./nvc_get_devices
回显显示如下内容,表示编译成功。
Found 1 platform(s). Using platform: NVIDIA Corporation NVIDIA CUDA Driver CUDA Driver Version: 11.40 Device 0: "NVIDIA A100-PCIE-40GB" Type of device: GPU Compute capability: 8 Double precision support: Yes Total amount of global memory: 39.5861 GB Number of compute units/multiprocessors: 108 Number of cores: 20736 Total amount of constant memory: 65536 bytes Total amount of local/shared memory per block: 49152 bytes Total number of registers available per block: 65536 Warp size: 32 Maximum number of threads per block: 1024 Maximum group size (# of threads per block) 1024 x 1024 x 64 Maximum item sizes (# threads for each dim) 2147483647 x 65535 x 65535 Maximum memory pitch: 2147483647 bytes Texture alignment: 512 bytes Clock rate: 1.41 GHz Run time limit on kernels: No Integrated: No Support host page-locked memory mapping: Yes Compute mode: Default Concurrent kernel execution: Yes Device has ECC support enabled: Yes
- 执行以下命令进入“src”目录。
cd ../../src
- 执行以下命令修改“MAKE/OPTIONS/Makefile.g++_openmpi”文件。
- 执行以下命令开始编译。
make yes-std make no-lib make yes-gpu make -j 96 g++_openmpi
