Behavior of on_epoch and sync_dist in self.log when logging raw tensors under DDP #21608
Unanswered
B-codes-core
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 1 comment
|
Yes, if The default value of self.log(
"metric",
tensor,
on_step=False,
on_epoch=True,
sync_dist=True,
)If |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
When using DDP/DDP Spawn strategies, I’d like to understand how sync_dist works for the following logging call:
self.log("metric", tensor, on_epoch=True, sync_dist=True)Is the synchronization across GPUs performed at every step or does synchronization happen only once at the end of the epoch assuming on_step is False? Understanding this behavior would help me decide whether to use this, since per step synchronization could have significant overhead. I read the relevant code and it seems to me like the synchronization happens only at end of epoch, but I would appreciate confirmation from experts
Thank You!
All reactions