Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make the pairwise DPRc model 2x faster #2833

Merged
merged 9 commits into from
Sep 19, 2023

Conversation

njzjz
Copy link
Member

@njzjz njzjz commented Sep 17, 2023

This PR does a trick to speed up the pairwise DPRc model. Considering #2618 is not ready and is quite difficult to implement, in this PR, multiple frames are merged into one frame before feed to prod_env_mat OP, and the mesh is faked to make it perform the same behavior as the multiple frames.
A new mesh shape is proposed. The first element stores nloc, and the following 15 elements store nothing to distinguish it from other mesh. The (16 : 16 + nloc) elements store ilist, (16 + nloc : 16 + nloc * 2) store numneigh, and the rest elements (in the shape of sum(numneigh)) store neighbors. The nei_mode is 4 for this situation.

prod_env_mat OP is not a bottleneck anymore, as shown below.
image

Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
@codecov
Copy link

codecov bot commented Sep 17, 2023

Codecov Report

Patch coverage: 82.63% and project coverage change: +0.06% 🎉

Comparison is base (0d5737f) 75.45% compared to head (f25cbb6) 75.52%.
Report is 6 commits behind head on devel.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #2833      +/-   ##
==========================================
+ Coverage   75.45%   75.52%   +0.06%     
==========================================
  Files         242      242              
  Lines       24205    24370     +165     
  Branches     1537     1571      +34     
==========================================
+ Hits        18265    18405     +140     
- Misses       5023     5037      +14     
- Partials      917      928      +11     
Files Changed Coverage Δ
source/op/prod_env_mat_multi_device.cc 70.96% <57.89%> (-0.40%) ⬇️
deepmd/model/pairwise_dprc.py 93.49% <80.00%> (-3.00%) ⬇️
source/op/pairwise.cc 85.95% <87.61%> (+1.34%) ⬆️

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wanghan-iapcm wanghan-iapcm merged commit a735bed into deepmodeling:devel Sep 19, 2023
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants