Thread-specific singleton (from @cypof) #2067
Closed
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.
This is the first in a series of PRs pulling some work from the parallel branch/@cypof that's ready for immediate consideration, and that will be also be used by future PRs implementing orthogonal work on synchronous parallelism.
This PR switches from a single, global
Caffe
singleton to a per-thread singleton, and then performs the necessary circumlocutions to avoid boost/nvcc conflicts. This is both necessary and sufficient for most multi-device work. (Further refactoring to eliminate the singleton is possible, but this is a much simpler sufficient step.)Using the same singleton in different threads is pretty certainly a bad idea, so I see no reason not to merge this change as soon it's verified to be in good working order.
@cypof, your other commits seem to be missing your name and have a different email from your github account. I used your github information for the commit I added here; please confirm that the author information is as you desire.