Repository navigation
Conversation
Access the symmetric nijbo entry with the inner-loop atom index as the first array index. This preserves the calculated value while improving contiguous memory access in Fortran column-major storage. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Werner Hahn <whahnsr@users.noreply.github.com>
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.
Summary
Improve memory locality in
density_for_MOZYMEby accessing the symmetricnijboentry with the inner-loop atom index as the first array index.Because Fortran arrays are column-major, changing
nijbo(j, k)to the equivalent symmetric entry
nijbo(k, j)makes the inner-loop access contiguous without changing the calculated value.
Performance
Tested with
tests/Crambin_1SCF.mopusing aRelWithDebInfobuild with:-O3 -g -fno-omit-frame-pointer -march=nativeBaseline user time was approximately 28.9 s.
Optimized user times:
Mean optimized user time: approximately 28.07 s.
This is about a 3% whole-program improvement.
perfalso showed the source-line cost atdensity_for_MOZYME.F90:82drop from 5.98% to 2.81% of total sampled cycles.
Validation
ctestCrambin_1SCF.outshowed no numerical differences from baselineGenerative AI usage
OpenAI Codex was used to assist with performance analysis, profiling
interpretation, and preparation of this change.