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

WIP: Threading upgrade #1350

Merged
merged 4 commits into from
May 26, 2017
Merged

WIP: Threading upgrade #1350

merged 4 commits into from
May 26, 2017

Conversation

dogancan
Copy link
Contributor

@dogancan dogancan commented Jan 18, 2017

This is work in progress. See #1234 for earlier discussion. Note that this PR includes the changes from #1249 and is mainly for comments and discussion. Threading related changes are at the end of the commit list.

To-do list:

  • Reimplement Semaphore and multi-threaded parallelization utilities (MultiThreader, TaskSequencer) using STL thread support library instead of pthread.
  • Reorganize the code in src/thread/.
    • Move the code in src/thread/kaldi-task-sequence.h to src/thread/kaldi-thread.h. Move the tests in src/thread/kaldi-task-sequence-test.cc to src/thread/kaldi-thread-test.cc.
    • Move src/thread/kaldi-semaphore.{h,cc}, src/thread/kaldi-thread.{h,cc} and src/thread/kaldi-thread-test.cc to src/util/.
    • Remove the remaning code in src/thread/ (kaldi-mutex.{h,cc}, kaldi-barrier.{h,cc}) that is no longer used/needed.
  • Update codebase to use STL thread support library and the new threading code under src/util.
  • Update build system to build and link with the new threading code under src/util.
  • Improve the implementation of multi-threaded parallelization utilities (MultiThreader, TaskSequencer) ?
  • A good amount of pthread related error checking code was removed. Do we need/want to introduce try/catch blocks to handle exceptions thrown by std::thread? Decided not to handle exceptions.
  • Regression tests.

@danpovey, @jtrmal: I think this is more or less ready for review.

@danpovey
Copy link
Contributor

@dogancan, are you still planning to work on this?

@dogancan
Copy link
Contributor Author

@danpovey, @jtrmal: As far as I recall, I left this in a state ready for test/review.

Since threading code can be error prone and some changes in this PR are non-trivial, I would appreciate if someone can do a careful review. I would also appreciate if someone can test the new threading code on example setups.

The other item left on the list is the refactoring/rewrite of the multi-threaded parallelization utilities (MultiThreader, TaskSequencer), which I guess is somewhat orthogonal to the changes in this PR so that can be done later.

@danpovey
Copy link
Contributor

Oh, great. I didn't realize it was ready for review.
I just had a look through it and it looks straightforward.
Would you mind resolving the Makefile conflict? Then I can merge.
It will cause "make" to complain about unmet dependencies, but people need to learn to do "make depend" when that happens.

@dogancan
Copy link
Contributor Author

Sure, I can take care of the conflicts. Please note that although most of the changes are straightforward, as far as I recall there were some non-trivial changes in this PR.

Also, what do you think about the following items?

  • Removing the remaining code in src/thread/ (kaldi-mutex.{h,cc}, kaldi-barrier.{h,cc}) that is no longer used/needed. I don't think there is any point in keeping these around after this change.
  • A good amount of pthread related error checking code was removed. Do we need/want to introduce try/catch blocks to handle exceptions thrown by std::thread? I don't think we want to catch those exceptions.

@danpovey
Copy link
Contributor

danpovey commented May 24, 2017 via email

@dogancan
Copy link
Contributor Author

@danpovey I resolved the conflicts and removed the src/thread directory.

@danpovey
Copy link
Contributor

OK, thanks. Merging.

@danpovey danpovey merged commit 6cc8e3a into kaldi-asr:master May 26, 2017
Skaiste pushed a commit to Skaiste/idlak that referenced this pull request Sep 26, 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.

2 participants