Skip to content

Conversation

@lezwon
Copy link
Contributor

@lezwon lezwon commented Aug 12, 2020

Missed updating the description in the previous PR. This PR updates the description for xm.mark_step() and MpDeviceLoader

API_GUIDE.md Outdated
- `xm.optimizer_step(optimizer)` no longer needs a barrier. ParallelLoader
automatically creates an XLA barrier that evaluates the graph.
- `MpDeviceLoader` loads the training data onto each device.
- `xm.optimizer_step(optimizer)` creates an XLA barrier that evaluates the graph and update the model's parameters.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The description for xm.optimizer_step() should stay as is as it's still the pl.MpDeviceLoader that ends up marking the step (https://github.com/pytorch/xla/blob/master/torch_xla/distributed/parallel_loader.py#L37), unless xm.optimizer_step is called with barrier kwarg.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jysohn23 Since the previous example for running on a single xla device no longer uses xm.optimizer_step(optimizer, barrier=True) it wouldn't make sense to have xm.optimizer_step(optimizer) no longer needs a barrier. in the doc. Would something like xm.optimizer_step(optimizer) consolidates the gradients between cores and issues the XLA device step computation work?

@jysohn23 jysohn23 merged commit 9e9bc80 into pytorch:master Aug 13, 2020
cjolivier01 pushed a commit to cjolivier01/pytorch_xla that referenced this pull request Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants