步骤一:编译LAMMPS
-
登录E-HPC集群。
登录时,请使用具有sudo权限的用户。具体操作,请参见登录集群。
-
执行以下命令,下载最新的LAMMPS源码。
-
从GitHub下载LAMMPS源码。
-
git clone -b release https://github.com/lammps/lammps.git mylammps
-
查看下载的LAMMPS源码文件。
ls -al
预期返回:
...
drwxr-xr-x 15 test users 4096 May 31 16:39 mylammps
...
-
执行以下命令,加载oneAPI模块。
-
将环境变量写入$HOME/.bashrc。
-
vim $HOME/.bashrc
添加以下内容:
source /opt/intel-oneapi-mpi/oneapi/setvars.sh --force
source /opt/intel-oneapi-mkl/oneapi/setvars.sh --force
source /opt/intel-hpckit/oneapi/setvars.sh --force
-
更新$HOME/.bashrc。
source $HOME/.bashrc
-
执行以下命令,编译LAMMPS。
-
使用2个进程进行编译。
-
cd /$HOME/mylammps/src
make package-status
make yes-CLASS2
make yes-KSPACE
make yes-RIGID
make yes-MOLECULE
make yes-EXTRA-MOLECULE
make -j 2 intel_cpu_intelmpi
-
查看当前文件路径下生成的LAMMPS可执行文件。
ll lmp_intel_cpu_intelmpi
预期返回:
-rwxr-xr-x 1 test users 9041824 May 31 16:48 lmp_intel_cpu_intelmpi
-
执行以下命令,将LAMMPS可执行文件配置为共享命令。
mkdir -p $HOME/bin
mv /$HOME/mylammps/src/lmp_intel_cpu_intelmpi /$HOME/bin
步骤二:运行LAMMPS
-
切换到lmp_intel_cpu_intelmpi所在bin目录。
cd /$HOME/bin
-
执行以下命令创建算例文件,算例文件命名为in.intel.lj。
vim in.intel.lj
内容示例如下:
# 3d Lennard-Jones melt
variable x index 1
variable y index 1
variable z index 1
variable xx equal 20*$x
variable yy equal 20*$y
variable zz equal 20*$z
units lj
atom_style atomic
lattice fcc 0.8442
region box block 0 ${xx} 0 ${yy} 0 ${zz}
create_box 1 box
create_atoms 1 box
mass 1 1.0
velocity all create 1.44 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
neighbor 0.3 bin
neigh_modify delay 0 every 20 check no
fix 1 all nve
dump 1 all xyz 100 sample.xyz
run 10000
-
执行以下命令编写测试脚本,脚本命名为test.pbs。
vim test.pbs
脚本内容如下:
#!/bin/bash
#PBS -N testLmp #设置作业名称
#PBS -l nodes=2:ppn=2 #向调度器申请2个计算节点,每个计算节点使用两个进程运行该作业
export I_MPI_HYDRA_BOOTSTRAP=ssh
cd $PBS_O_WORKDIR
mpirun ./lmp_intel_cpu_intelmpi -in ./in.intel.lj
-
执行以下命令,提交作业。
qsub test.pbs
预期返回如下,表示生成的作业ID为0.scheduler。
0.scheduler
查看结果
-
执行以下命令,查看作业状态。
qstat -x 0.scheduler
预期返回如下,当返回信息中S为F时,表示作业已经运行结束。
Job id Name User Time Use S Queue
---------------- ---------------- ---------------- -------- - -----
0.scheduler test.pbs test 00:00:00 F workq
-
执行以下命令,查看日志。
cat log.lammps
预期返回:
...
Per MPI rank memory allocation (min/avg/max) = 11.75 | 11.75 | 11.75 Mbytes
Step Temp E_pair E_mol TotEng Press
0 1.44 -6.7733681 0 -4.6134356 -5.0197073
10000 0.69579461 -5.6648333 0 -4.621174 0.7601771
Loop time of 108.622 on 4 procs for 10000 steps with 32000 atoms
Performance: 39770.920 tau/day, 92.062 timesteps/s
97.0% CPU use with 2 MPI tasks x 2 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 85.42 | 85.632 | 85.844 | 2.3 | 78.83
Neigh | 13.523 | 13.564 | 13.604 | 1.1 | 12.49
Comm | 4.4182 | 4.5452 | 4.6722 | 6.0 | 4.18
Output | 2.1572 | 2.1683 | 2.1793 | 0.7 | 2.00
Modify | 2.1047 | 2.1398 | 2.175 | 2.4 | 1.97
Other | | 0.5734 | | | 0.53
Nlocal: 16000 ave 16007 max 15993 min
Histogram: 1 0 0 0 0 0 0 0 0 1
Nghost: 13030 ave 13047 max 13013 min
Histogram: 1 0 0 0 0 0 0 0 0 1
Neighs: 600054 ave 604542 max 595567 min
Histogram: 1 0 0 0 0 0 0 0 0 1
Total # of neighbors = 1200109
Ave neighs/atom = 37.503406
Neighbor list builds = 500
Dangerous builds not checked
Total wall time: 0:01:48