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

Modify readers to fit the parallel executor #9743

Merged

Conversation

JiayiFeng
Copy link
Collaborator

@JiayiFeng JiayiFeng commented Apr 8, 2018

  1. isolate multi-thread support from 'MultipleReader', making it an independent decorated reader(ThreadedReader).
  2. Add docstring for some Python interfaces.
  3. Combine 'open_files', 'multi_pass_reader' and 'threaded_reader' together to make a new Python open_files() interface.
  4. Simplify Python interface 'create_XXX_reader' names, e.g, rename 'create_double_buffer_reader' to 'double_buffer'.
  5. Remove Readers' HasNext(), for it is unsafe in multi-thread environment.

1. Removes MultipleReader's multi-thread support, for we have got
ThreadedReader.
2. Rename MultipleReader to MultiFileReader
… modify_readers_to_fit_parallel_executor
1. Combine 'open_files', 'multi_pass_reader' and 'threaded_reader'
together to make the new 'open_files' interface.
2. Add some docstring.
3. Simplify interface names of 'create_XXX_reader', e.g, rename
'create_double_buffer_reader' to 'double_buffer'.
… modify_readers_to_fit_parallel_executor
@JiayiFeng JiayiFeng changed the title Modify readers to fit the parallel executor [WIP] Modify readers to fit the parallel executor Apr 9, 2018
@JiayiFeng JiayiFeng changed the title [WIP] Modify readers to fit the parallel executor Modify readers to fit the parallel executor Apr 11, 2018
@JiayiFeng JiayiFeng requested a review from reyoung April 11, 2018 08:10
@@ -171,16 +168,26 @@ void DoubleBufferReader::ReInit() {
StartPrefetcher();
}

bool DoubleBufferReader::HasNext() const {
while (!channel_->IsClosed() && !channel_->CanReceive()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

...We should use a conditional variable to wait here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will fix it in further PRs.

@JiayiFeng JiayiFeng merged commit 90084a2 into PaddlePaddle:develop Apr 11, 2018
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.

None yet

2 participants