Skip to content

perf(lcao): release Bessel workspace after EXX initialization - #8437

Open
Stardust0831 wants to merge 1 commit into
deepmodeling:developfrom
Stardust0831:experiment/bessel-cache-lifetime
Open

Stardust0831 wants to merge 1 commit into
deepmodeling:developfrom
Stardust0831:experiment/bessel-cache-lifetime

Conversation

@Stardust0831

Copy link
Copy Markdown
Collaborator

What's changed?

LCAO EXX retains a large spherical-Bessel table after its radial interpolation tables have been built. Release the D2 value buffers at the end of EXX initialization, retaining the table objects, grid and request history so a later access can reconstruct the original values. Serialize lazy reconstruction for concurrent readers and add focused tests for release, exact reconstruction, subsequent growth, and copy/move behavior.

Unit Tests and/or Case Tests for my changes

TiO2-48 HSE MD: one matched pair on the same node, 16 MPI ranks / 16 V100 GPUs, one OpenMP/BLAS thread per rank, Gamma FP64 cuSOLVER with GPU XC/EXX. Both use the same inputs, screening and scf_thr=1e-9. NVE at initially 300 K, md_dt=0.5 fs, fixed seed; md_nstep=3 is the initial frame plus two integration advances (1 fs total).

Metric Before After
Host memory peak, frame 1 (GiB) 132.07 117.96
Host memory peak, frame 2 (GiB) 160.72 146.31
Host memory peak, frame 3 / whole run (GiB) 174.81 157.94
Maximum GPU process memory per card (MiB) 2542 2542
Full run wall time, including forces and output (s) 834.38 810.35

All three SCFs converged with identical iteration counts. Maximum differences: energy 0 at printed precision, DM element 6.75e-11, force component 1.59e-8 eV/Angstrom; positions and velocities agree at output precision. Maximum |Tr(DS)-384| is 5.68e-14. Acceptance tolerances were respectively 1e-6 eV, 1e-8, 1e-5 eV/Angstrom, and 1e-7 electrons.

Temporary counters in the candidate MD build recorded zero reconstructions on all 16 ranks after releasing 0.962 GiB of value-buffer capacity per rank. The six C++11 unit tests passed, including a positive control that performed seven reconstructions. Earlier matched Si8 and TiO2-48 SCF/force checks also passed.

Host peaks are sampled job memory.current values (about 2 s cadence; lower bounds). Candidate wall time includes counter logging. This single pair does not establish a repeatable speedup; total RAM still grows across MD frames, and the cost of a production-size reconstruction was not exercised here.

Reproduction details and verification commands

Tested base a56706f5790dcd4e12a76abab334e635ed1fef29, candidate 17432fae40d121bdd02781424f97fc0c6e38fa4c.

Both sides use identical LibRI 210ba55377567f76d62e3ec7c8bea31d8e42a50b and the same pre-existing dependency optimizations.

Commands run with the task-local harness:

sbatch build.sbatch
ctest --test-dir build-unit --output-on-failure -V
sbatch run.sbatch
python3 check_md.py 2975461
python3 verify_raw.py

All passed (SAI jobs 2975407 and 2975461). Diff, governance and CMake-format checks passed with header-dependency warnings explained below. The full repository test suite was outside this focused validation.

Linked Issue

No linked issue; this addresses the measured EXX host-memory footprint.

Governance Notes

  • No INPUT changes; no documentation update required for this internal cache-lifetime change.
  • Core impact: D2 workspace ownership and its EXX initialization release point. Release occurs between value consumers; lazy reconstruction preserves the original calculation order.
  • Added includes supply the request array, shared mutex ownership and explicit Bessel types used by the changed code. No governance exceptions requested.

@mohanchen mohanchen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants