Repository navigation
Start all interleaved iterators on the first next() of InterleaveDatasetIterator. - #1483
Open
copybara-service[bot] wants to merge 1 commit into
Open
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
…atasetIterator`. `get_state()` and `set_state()` before the first `next()` create the iterators in use without starting them, e.g. when a `ThreadPrefetchIterDataset` (or `grain.experimental.device_put`) on top reads the state before it starts, or when restoring a checkpoint. Each of them was then only started when the interleave first read from it. With `mp_prefetch` (one iterator per worker process), every worker therefore only started after the previous one delivered its first element, i.e. the workers started one after another instead of in parallel. The first `next()` now calls `start_prefetch()`, which starts all iterators in use, as `TunableInterleaveDatasetIterator` already does. PiperOrigin-RevId: 1027222911
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Start all interleaved iterators on the first
next()ofInterleaveDatasetIterator.get_state()andset_state()before the firstnext()create the iteratorsin use without starting them, e.g. when a
ThreadPrefetchIterDataset(orgrain.experimental.device_put) on top reads the state before it starts, orwhen restoring a checkpoint. Each of them was then only started when the
interleave first read from it. With
mp_prefetch(one iterator per workerprocess), every worker therefore only started after the previous one delivered
its first element, i.e. the workers started one after another instead of in
parallel.
The first
next()now callsstart_prefetch(), which starts all iterators inuse, as
TunableInterleaveDatasetIteratoralready does.📚 Documentation preview 📚: https://google-grain--1483.org.readthedocs.build/