-
Notifications
You must be signed in to change notification settings - Fork 526
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
Perf: print summary on rank 0 #4434
Conversation
📝 WalkthroughWalkthroughThe changes involve a modification to the Changes
Sequence Diagram(s)sequenceDiagram
participant MainProcess as Main Process (rank 0)
participant OtherProcesses as Other Processes (rank > 0)
MainProcess->>+MainProcess: Execute print_summary()
MainProcess-->>-MainProcess: Print summary
OtherProcesses->>+OtherProcesses: Attempt to execute print_summary()
OtherProcesses-->>-OtherProcesses: Skip printing
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
deepmd/pt/utils/dataloader.py (1)
188-202
: LGTM! Clean implementation of rank-based printing.The changes correctly ensure that summary printing only occurs on the main process (rank 0) in distributed settings, while maintaining the original functionality in non-distributed mode. This will help reduce log clutter in distributed training.
Consider adding debug logging for non-rank-0 processes to maintain logging consistency:
rank = dist.get_rank() if dist.is_initialized() else 0 if rank == 0: print_summary( name, len(self.systems), [ss.system for ss in self.systems], [ss._natoms for ss in self.systems], self.batch_sizes, [ ss._data_system.get_sys_numb_batch(self.batch_sizes[ii]) for ii, ss in enumerate(self.systems) ], prob, [ss._data_system.pbc for ss in self.systems], ) + else: + log.debug(f"Skipping print_summary on rank {rank}")
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## devel #4434 +/- ##
=======================================
Coverage 84.64% 84.64%
=======================================
Files 614 614
Lines 57138 57138
Branches 3487 3486 -1
=======================================
Hits 48367 48367
+ Misses 7646 7644 -2
- Partials 1125 1127 +2 ☔ View full report in Codecov by Sentry. |
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Adjusted the summary printing functionality to ensure it only executes from the main process in distributed settings, preventing duplicate outputs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> (cherry picked from commit 4b92b6d)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Adjusted the summary printing functionality to ensure it only executes from the main process in distributed settings, preventing duplicate outputs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> (cherry picked from commit 4b92b6d)
Summary by CodeRabbit