Repository navigation
perf(xc): distribute Libxc batches across OpenMP threads - #35
Draft
Stardust0831 wants to merge 1 commit into
Draft
Stardust0831 wants to merge 1 commit into
Stardust0831 wants to merge 1 commit into
Conversation
This was referenced Nov 2, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's changed?
Libxc loops already process 1024 grid points per iteration. Scheduling another 1024 iterations per OpenMP chunk can leave most threads idle. Use
schedule(static)in the four existing loops so batches are distributed across threads.This changes four pragmas in
libxc_pot.cpp. It applies to the shared CPU Libxc evaluation used by LCAO and PW; there is no new option or dependency.Performance
Ranges cover two paired runs in separate allocations; speedups are computed within each pair.
HSE SCF, forces and stress on Si32 and CsPbI3 (5 atoms), using one V100, one MPI rank, four physical CPU cores/OpenMP threads and serial BLAS on SAI. Libxc 7.0.0; cuSOLVER diagonalization and CPU LibRI contractions in both versions. Each candidate is compared with unmodified
d20090cc137f; two repetitions reverse the execution order. Reported performance pairs have identical SCF iteration counts.The Libxc timer measures the changed evaluation loops.
Potential::cal_veffincludes other potential work. These nested timers are reported separately.Unit Tests and/or Case Tests for my changes
Maximum differences across the 29 completed calculations are 2.2e-11 eV/atom, 2.3e-09 eV/Angstrom and 9.6e-09 kbar. These checks establish agreement with the baseline, not absolute force accuracy. All matched SCF iteration counts agree. Validation includes one-thread controls, CPU execution, a build with CUDA disabled, and complex tensors on a 2x1x1 k mesh with two MPI ranks/GPUs.
The standalone CUDA executable and existing XC tests pass. Commands, with paths relative to the build root:
Inputs, individual timings, numerical comparisons and test logs. All benchmark executables enable the same existing full-precision timer JSON output; that instrumentation is absent from these PRs.
Linked Issue
Related performance study: #30. Independently reviewable part of #32.
Governance Notes
Companion changes: integral evaluation and radial tables. All three branches start at the same frozen develop commit, have no prerequisite PR, and merge in all six orders without conflicts or differences in the resulting tree.
No documentation update required: numerical settings, INPUT metadata and interfaces are unchanged. Core impact is limited to OpenMP scheduling in XC evaluation. No governance exception is requested.