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

[Small] Disable summary for non-master processes in DDP training mode #954

Closed

Conversation

breakds
Copy link
Contributor

@breakds breakds commented Jul 30, 2021

Description

Similar to only having process 0 (master process) writing checkpoint, we want to have only process 0 writing the summary. This is done by not enabling summary unless the process rank is 0 (or -1) when setting up PolicyTrainer.

Testing

Tested training in dual GPU settings with this PR. There are still 2 events file generated but only one is being written to.

@breakds breakds added the enhancement New feature or request label Jul 30, 2021
@@ -138,7 +138,10 @@ def __init__(self, config: TrainerConfig, ddp_rank: int = -1):
def train(self):
"""Perform training."""
self._restore_checkpoint()
alf.summary.enable_summary()
if self._rank <= 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Algorithm._train_experience(), enable_summary() is also called, so this will not be effective.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may consider to change run_under_record_context so that _cond() always returns False.

@breakds
Copy link
Contributor Author

breakds commented Aug 2, 2021

Based on the feedback, I will replace this PR with a new one.

@breakds breakds closed this Aug 2, 2021
@breakds breakds deleted the PR_breakds_disable_summary_except_master_ddp branch August 2, 2021 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
ALF improvement
  
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

2 participants