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

Add example for unrolling iterative blocks #920

Merged
merged 1 commit into from
Jan 2, 2024
Merged

Conversation

kwen2501
Copy link
Contributor

@kwen2501 kwen2501 commented Dec 19, 2023

Description

Demonstrate PiPPy's functionality in unrolling iterative blocks.

For details, please see README.

Many thanks to @mortzur 's inspiration!

@kwen2501 kwen2501 changed the title Add example for unrolling a model Add example for unrolling iterative blocks Dec 19, 2023
Copy link
Member

@H-Huang H-Huang left a comment

Choose a reason for hiding this comment

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

Very cool! And good, easy to understand example

## How can this functionality help?
Increase throughput of your model.

Imagine your for loop needs to iterate on the data for `n` times, and it takes time `t` to process 1 sample (yielding a throughput of `1/t`). If we were to unroll the for loop onto `n` devices, then we can push `n` microbatches into the pipeline, each microbatch containing 1 sample. Then at any timeslot, the pipeline is processing `n` samples, yielding a throughput of `n/t`.
Copy link
Member

Choose a reason for hiding this comment

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

does this only work if the batch size can be split into n microbatches?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's right.

@kwen2501 kwen2501 merged commit bb90773 into main Jan 2, 2024
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.

None yet

3 participants