speed up compute_small_box#1122
Merged
brucefan1983 merged 1 commit intobrucefan1983:masterfrom Aug 15, 2025
Merged
Conversation
Owner
|
Very nice speedup! |
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
In the original implementation of
compute_small_box()in theNEPclass, several newGPU_Vectorobjects are created usingcudaMallocand then destroyed bycudaFree, which introduces a significant computational cost:GPUMD/src/force/nep.cu
Lines 1387 to 1391 in ef31657
Modification
I added a new member variable
small_box_datato store the relative information at the beginning to avoid recreating these newGPU_Vectors:https://github.com/MoseyQAQ/GPUMD/blob/c00ef6d62c4a33cc922d2779b12f22d8e64753e1/src/force/nep.cuh#L111-L117
Verifications
For a given
model.xyz, and a givennep.txt, I performed the following calculations using the old and new implementations separately :All the tests mentioned above have been passed, yielding the same results. All original input files and output files are attached.
Small_Cell_PR_test_upload.zip
(Note: raw trajectory files for NPT simulations are deleted, since they are too huge to be uploaded in GitHub issue)
Speed Benchmark