Refactor: reduce the memory consumption of cal_gint_vlocal #6069
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.
Background
The original
cal_gint_vlocalfunction had each thread duplicate an entire HR matrix to avoid data races, which could lead to high memory usage. This PR replaces that approach with locks to prevent data races, reducing memory consumption but at the cost of some computational efficiency. Testing shows that the calculation efficiency ofcal_gint_vlocalmay decrease by approximately 10%.Perf comparison
Below are the comparison results of testing the si128 example under
tests/performance/on my computer.