软件性能实测

GPUMD:如何按原子数和晶胞形状选卡数

比较 6.4 万和 21.6 万原子硅体系的并行吞吐,复现长晶胞的单卡和多卡计算。

更新于 2026-12-06约 9 分钟阅读按任务与环境选择适用配置
阅读本篇目录

扩卡前先看晶胞尺寸。长晶胞 Si216000 在 V100 16 GB 从单卡扩到四卡约快 2.42 倍,八卡约快 2.61 倍;Si64000 的长晶胞在四卡达到约 2.28 倍,到八卡降至约 1.93 倍。输入名带 long 表示改变了盒形,图中只在同一盒形内比较。

建立长晶胞与 NVE 输入#

在登录节点建立新的工作目录,运行 yskit,选择 GPUMD 5.9.1 → V100,将对应的 Slurm 脚本复制到当前目录。

mkdir -p ~/benchmarks/gpumd-si64000
cd ~/benchmarks/gpumd-si64000
yskit
cat sub_gpumd_5.9.1_v100.sh
cp /public/yskj-ai-agent/examples/_packages/gpumdkit-examples-443eb1bb66/gpumdkit-examples/reference/plt-dimer/si-nep.txt nep.txt
cat > run.in <<'END_INPUT'
potential nep.txt
velocity 300 seed 27101
time_step 1
ensemble nve
dump_thermo 100
run 4000
END_INPUT
python3 - <<'PY'
from itertools import product
shape = (40, 10, 20)
a = 5.431
lx, ly, lz = [a*n for n in shape]
sites = [(x+t, y+t, z+t) for x,y,z in ((0,0,0),(0,.5,.5),(.5,0,.5),(.5,.5,0)) for t in (0,.25)]
with open('model.xyz','w') as f:
    print(8*shape[0]*shape[1]*shape[2],file=f)
    print(f'Lattice="{lx} 0 0 0 {ly} 0 0 0 {lz}" Properties=species:S:1:pos:R:3 pbc="T T T"',file=f)
    for x,y,z in product(*(range(n) for n in shape)):
        for u,v,w in sites:
            print('Si', *(f'{a*q:.8f}' for q in (x+u,y+v,z+w)), file=f)
PY
head -2 model.xyz

run 4000 固定积分步数,time_step 1 固定时间步。将相同的三个输入放入独立目录,用一个 GPUMD 进程管理分配的多张卡。

mkdir one two
for d in one two; do cp model.xyz nep.txt run.in sub_gpumd_5.9.1_v100.sh "$d/"; done
vim two/sub_gpumd_5.9.1_v100.sh

按 i 把第二份脚本的 --gres=gpu:v100-16g:1 改为 --gres=gpu:v100-16g:2,保持 --ntasks=1。按 Esc,输入 :wq 并回车。分别提交后读取程序原生的每秒原子步数,数值越大越快。

(cd one && sbatch sub_gpumd_5.9.1_v100.sh)
(cd two && sbatch sub_gpumd_5.9.1_v100.sh)
squeue -u "$USER"
grep 'Speed of this run' one/*.out two/*.out

要测 21.6 万原子的长晶胞,将 shape 改为 (40, 25, 27),在新的目录重新生成并比较。GPUMD 环境与提交

V100 多卡与晶胞形状#

输入 基线 对照 基线 · 原子步/秒 对照 · 原子步/秒 相对速度
si64000 V100 16 GB 1 卡 V100 16 GB 2 卡 5.6995e+06 8.2293e+06 1.44×
si64000 V100 16 GB 1 卡 V100 16 GB 4 卡 5.6995e+06 9.6633e+06 1.70×
si216000 V100 16 GB 1 卡 V100 16 GB 2 卡 5.8395e+06 9.5197e+06 1.63×
si216000 V100 16 GB 1 卡 V100 16 GB 4 卡 5.8395e+06 1.3637e+07 2.34×
si64000-long V100 16 GB 1 卡 V100 16 GB 2 卡 5.7143e+06 8.0656e+06 1.41×
si64000-long V100 16 GB 1 卡 V100 16 GB 4 卡 5.7143e+06 1.3049e+07 2.28×
si64000-long V100 16 GB 1 卡 V100 16 GB 8 卡 5.7143e+06 1.1046e+07 1.93×
si216000-long V100 16 GB 1 卡 V100 16 GB 2 卡 5.8989e+06 9.4144e+06 1.60×
si216000-long V100 16 GB 1 卡 V100 16 GB 4 卡 5.8989e+06 1.4296e+07 2.42×
si216000-long V100 16 GB 1 卡 V100 16 GB 8 卡 5.8989e+06 1.5374e+07 2.61×

V100 多卡与晶胞形状,横轴为相对速度,逐项数值见上表

P100 双卡与单卡的吞吐#

输入 基线 对照 基线 · 原子步/秒 对照 · 原子步/秒 相对速度
si64000 P100 1 卡 P100 2 卡 2.3564e+06 3.724e+06 1.58×
si216000 P100 1 卡 P100 2 卡 2.4758e+06 4.1046e+06 1.66×
si64000-long P100 1 卡 P100 2 卡 2.3636e+06 3.8338e+06 1.62×
si216000-long P100 1 卡 P100 2 卡 2.4839e+06 4.0846e+06 1.64×

P100 双卡与单卡的吞吐,横轴为相对速度,逐项数值见上表

选卡时也可计算单位工作量的核时。以长晶胞 Si216000 为例,八卡吞吐约为单卡的 2.61 倍,相同工作量的卡时约为单卡的 8 ÷ 2.61 ≈ 3.07 倍。

读取数据与画图#

配套文件 comparison.csv 保存本篇表格的完整精度。reference_median 和 comparison_median 对应基线与对照的中位数;speedup 使用同一指标计算。批工具中部分配置只做了一次。下面默认绘制 CSV 中第一组实验;要画其他组,将 family 换成对应的 experiment 值。 在有 Matplotlib 的 Python 环境中,将下列代码和 CSV 放在同一目录。也可以将自己的计时或吞吐按相同列名填入 CSV。 也可以直接在空目录建立下面的 CSV 并画图。

cat > comparison.csv <<'END_INPUT'
experiment,model,reference,comparison,metric,reference_median,comparison_median,speedup
GPUMD multi-GPU,si64000,v100 1 GPU,v100 2 GPUs,atom_steps_per_second,5699505.0,8229275.0,1.4439
GPUMD multi-GPU,si64000,v100 1 GPU,v100 4 GPUs,atom_steps_per_second,5699505.0,9663320.0,1.6955
GPUMD multi-GPU,si216000,v100 1 GPU,v100 2 GPUs,atom_steps_per_second,5839515.0,9519720.0,1.6302
GPUMD multi-GPU,si216000,v100 1 GPU,v100 4 GPUs,atom_steps_per_second,5839515.0,13637150.0,2.3353
GPUMD multi-GPU,si64000-long,v100 1 GPU,v100 2 GPUs,atom_steps_per_second,5714275.0,8065635.0,1.4115
GPUMD multi-GPU,si64000-long,v100 1 GPU,v100 4 GPUs,atom_steps_per_second,5714275.0,13049450.0,2.2837
GPUMD multi-GPU,si64000-long,v100 1 GPU,v100 8 GPUs,atom_steps_per_second,5714275.0,11046450.0,1.9331
GPUMD multi-GPU,si216000-long,v100 1 GPU,v100 2 GPUs,atom_steps_per_second,5898900.0,9414365.0,1.596
GPUMD multi-GPU,si216000-long,v100 1 GPU,v100 4 GPUs,atom_steps_per_second,5898900.0,14296250.0,2.4235
GPUMD multi-GPU,si216000-long,v100 1 GPU,v100 8 GPUs,atom_steps_per_second,5898900.0,15373550.0,2.6062
GPUMD multi-GPU (SSH),si64000,P100 1 GPU,P100 2 GPUs,atom_steps_per_second,2356450.0,3723975.0,1.5803
GPUMD multi-GPU (SSH),si216000,P100 1 GPU,P100 2 GPUs,atom_steps_per_second,2475830.0,4104580.0,1.6579
GPUMD multi-GPU (SSH),si64000-long,P100 1 GPU,P100 2 GPUs,atom_steps_per_second,2363570.0,3833785.0,1.622
GPUMD multi-GPU (SSH),si216000-long,P100 1 GPU,P100 2 GPUs,atom_steps_per_second,2483925.0,4084640.0,1.6444
END_INPUT
module load ase/3.29.0
cat > plot.py <<'END_INPUT'
import csv
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
with open('comparison.csv', encoding='utf-8') as stream:
    data = list(csv.DictReader(stream))
family = data[0]['experiment']
rows = [r for r in data if r['experiment'] == family]
labels = [r['model'] + ' / ' + r['reference'] + ' to ' + r['comparison'] for r in rows]
ratios = [float(r['speedup']) for r in rows]
fig, ax = plt.subplots(figsize=(10, max(3, 1.5 + 0.5 * len(rows))))
ax.barh(range(len(rows)), ratios)
ax.set_yticks(range(len(rows)), labels=labels)
ax.invert_yaxis()
ax.axvline(1, color='gray', linestyle='--')
ax.set_xlabel('Speedup')
fig.savefig('comparison.png', dpi=160, bbox_inches='tight')
END_INPUT
python3 plot.py

查看 60 项软件的实测总览 · 使用技巧

下载本篇实测数据与绘图示例(ZIP)

需要根据你的体系选择资源?联系讨论计算需求。实际可用软件与权限,以当前账户和运行环境为准。

查看配图

放大后可滚动查看细节,按 Esc 关闭。

100%查看原图 ↗