计算化学公社

标题: Zen5桌面端ORCA解析Hessian计算中内存大小对性能的影响 [打印本页]

作者
Author:
Rowena    时间: 3 hour ago
标题: Zen5桌面端ORCA解析Hessian计算中内存大小对性能的影响
本帖最后由 Rowena 于 2026-5-12 15:13 编辑

0. 前言
最近在个人电脑上使用 ORCA 进行解析 Hessian 计算时,发现一个比较反直觉的现象:
在 解析Hessian计算相关的步骤中,给更大的 %maxcore 后,ORCA 会把更多 geometric perturbations 放入同一个 batch 中计算,
按直觉来说,batch 数减少应当更快。但在测试中发现,Chain-of-spheres response operator 这一步反而在较小 batch 下显著加快。

1. 测试平台
CPU: R9 9950X3D2
系统: Ubuntu 24.04
内存: DDR5 6000 MHz CL28, 16 GB × 2
CPU设置:
  CCD0: PBO2, Curve Optimizer -30
  CCD1: PBO2, Curve Optimizer -40

使用 ORCA 6.0.1 8核并行(CCD0)
对附件中类似heme结构的66原子体系作hessian计算
(, 下载次数 Times of downloads: 0)
理论水平: TPSSh def2-SVP(C H O N S) def2-TZVP(Fe) RIJCOSX

2. 测试结果2.1 Geometric perturbations 的 batch 划分
不同 %maxcore 下,ORCA 自动选择了不同的 batch 大小:

%maxcore 600:
  Number of batches: 11
  每个 batch: 18 perturbations

%maxcore 1000:
  Number of batches: 6
  每个 batch: 33 perturbations

%maxcore 3200:
  Number of batches: 2
  Batch 0: 120 perturbations
  Batch 1: 78 perturbations

可以看到,随着 %maxcore 增大,ORCA 会把更多 geometric perturbations 放入同一个 batch 中。

2.2 Geometric perturbations 总耗时
%maxcore 600:
  Geometric perturbations done: 659.6 s
  平均: 3.33 s / perturbation

%maxcore 1000:
  Geometric perturbations done: 687.2 s
  平均: 3.47 s / perturbation

%maxcore 3200:
  Geometric perturbations done: 815.6 s
  平均: 4.12 s / perturbation

单独看 geometric perturbations,%maxcore 600 最快,%maxcore 3200 最慢。这个结果与“更大内存、更少 batch 应该更快”的直觉相反。

2.3 Chain-of-spheres response operator 耗时
将每个 batch 中的 Chain of spheres response operator 累加,可得到:

%maxcore 600:
  CFS response operator total: 226.5 s
  平均: 1.14 s / perturbation

%maxcore 1000:
  CFS response operator total: 308.7 s
  平均: 1.56 s / perturbation

%maxcore 3200:
  CFS response operator total: 480.9 s
  平均: 2.43 s / perturbation

如果把 Chain of spheres derivative integrals 也一并算入:

%maxcore 600:
  Chain-of-spheres total: 289.8 s
  平均: 1.46 s / perturbation

%maxcore 1000:
  Chain-of-spheres total: 369.5 s
  平均: 1.87 s / perturbation

%maxcore 3200:
  Chain-of-spheres total: 535.1 s
  平均: 2.70 s / perturbation

2.4 CP-SCF / Pople linear equation solver 耗时
后续的 Pople linear equation solver 出现相反趋势:

%maxcore 600:
  CP-SCF equations solved in: 1308.7 s
  平均: 6.61 s / perturbation

%maxcore 1000:
  CP-SCF equations solved in: 1443.0 s
  平均: 7.29 s / perturbation

%maxcore 3200:
  CP-SCF equations solved in: 1057.7 s
  平均: 5.34 s / perturbation

这里 %maxcore 3200 反而明显更快。因此,虽然小 %maxcore 加速了前面的 geometric perturbations / CFSO,但后面的 Pople solver 会变慢。
尚不清楚为什么%maxcore 1000反而是最慢的。

2.5 总 wall time
最终总耗时为:

%maxcore 600:
  TOTAL RUN TIME: 39 min 53.960 s

%maxcore 1000:
  TOTAL RUN TIME: 42 min 40.407 s

%maxcore 3200:
  TOTAL RUN TIME: 38 min 46.068 s

因此,完整计算中 %maxcore 3200 仍然最快,虽然它的 geometric perturbations / Chain-of-spheres operator 是最慢的。

3. 温度观察
在 Chain-of-spheres operator 阶段,不同 %maxcore 下 CPU 温度也有明显差异:

%maxcore 600:
  Chain-of-spheres operator阶段最低约 65°C

%maxcore 1000:
  Chain-of-spheres operator阶段最低约 62°C

%maxcore 3200:
  Chain-of-spheres operator阶段温度明显下降,最低约 58°C


相比之下在其他计算阶段CPU温度在67°C上下波动。
另一个值得注意的日常观察是,对于较小体系的Hessian计算,CPU温度一般全程不会出现太大波动,
但体系一旦越过某个尺寸,在Hessian计算时温度会出现显著下降甚至掉到50度以下,计算也需要相当长的时间完成。

4. 分析总结
从这组三个测试看,%maxcore 对 ORCA 解析 Hessian 的影响并不是简单的越大越快。
较大的 %maxcore 会减少 geometric perturbations 的 batch 数,但在本例中反而显著拖慢了 Chain-of-spheres response operator,较小的 %maxcore 虽然 batch 更多,但这一步明显更快。
不过,完整 wall time 并不由这一步单独决定。后续 Pople linear equation solver 在 %maxcore 3200 下明显更快,因此最终总时间仍然是 %maxcore 3200 最短。

个人的猜想是,这可能和 Zen5 桌面端的内存带宽限制以及 9950X3D2 的三级缓存有关。
较小 batch 同时处理的 perturbations 数较少,相关数据的工作集更小,可能更容易在三级缓存中复用,因此 Chain-of-spheres response operator 更快,
较大 batch 虽然减少了批次数,但工作集变大后可能更依赖内存,导致 CPU 等待增多,温度反而下降。

这也能解释温度现象,%maxcore 3200 下 Chain-of-spheres operator 阶段温度最低掉到约 58°C,而 %maxcore 600 下最低约 65°C。
温度下降不等于直接证明瓶颈是三级缓存或内存带宽,但至少说明大 batch 下这一步并没有把 CPU 吃满。

因此,这个现象或许说明:ORCA 的 Chain-of-spheres response operator 在大 L3 cache CPU 上可能更适合较小的内部计算块,但 Pople linear equation solver 又更受益于较大的 %maxcore。
如果 ORCA 能在保持后续线性方程求解效率的同时,让 Chain-of-spheres response operator 使用更能吃满CPU的小块计算,也许可以进一步提高解析 Hessian 的整体效率。























欢迎光临 计算化学公社 (http://bbs.keinsci.com/) Powered by Discuz! X3.3