SolverPool for MultiGPU in Python #2957
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.
A simple interface which allows you to use the new MultiGPU functionality from inside python. Begin by calling
pool=get_solver_pool(solver_file,gpu_list)
, where solver_file is a string for the file name of the solver definition prototxt, and gpu_list is a python list of ints specifying the gpus to use. pool will then have the methodspool.step(int)
, which lets you step all solvers in the pool in parallel for the specified number of iterations, andpool.solvers
which is a list of python solver objects.There is currently no documentation or tests. This has been well tested on an older version of the MultiGPU version of caffe. There have been several boilerplate changes since that version (most notably,
P2Psync::run
is no longer static, which changed howSolverPool
interacts with it). I have updated this PR such that it compiles and the tests pass, but it is still possible that I made some mistake while updating the boilerplate. Feedback is appreciated.@cypof parallel.cpp line 396 now calls
SetDevice
, since I couldn't find another good place to do this. This means thatSetDevice
gets called twice when you run tools/caffe, which is maybe a bit confusing. Let me know if I can get rid of theSetDevice
call in tools/caffe.