-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Solver device #69
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
Merged
Merged
Solver device #69
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ab8b5f3
Added device_id to solver.prototxt and to solver.cpp
sguada 4a72528
Added device_query.cpp to examples/ to get basic information about th…
sguada c767129
Update devicequery.cpp
sguada 5962c59
Update caffe.proto
sguada 55cd18d
Update solver.cpp
sguada File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2014 Sergio Guadarrama | ||
|
||
|
||
#include "caffe/common.hpp" | ||
#include "caffe/net.hpp" | ||
|
||
|
||
using namespace caffe; | ||
|
||
int main(int argc, char** argv) { | ||
if (argc > 2) { | ||
LOG(ERROR) << "device_query [device_id=0]"; | ||
return 0; | ||
} | ||
if (argc == 2) { | ||
LOG(INFO) << "Querying device_id=" << argv[1]; | ||
Caffe::SetDevice(atoi(argv[1])); | ||
Caffe::DeviceQuery(); | ||
} else { | ||
Caffe::DeviceQuery(); | ||
} | ||
return 0; | ||
} |
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that a slightly safer way is to do
if (param_.has_device_id()) {
Caffe::SetDevice(param_.device_id());
}
just in case a user has hard-coded a device id outside the solver and does not specify the device id in the solver param. Currently, if nothing is set, the solver will always use the 0th device, which might not be desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea behind the condition was to set device_id only if solver_mode was set to 1 or GPU mode. In CPU mode we don't want to try SetDevice since it can fail if there is not GPU device.
But we could check both conditions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, sorry for the confusion - I meant two if's nested together, so
effectively it is
if (param_.solver_mode() && param_.has_device_id())
thanks for the changes :)
Yangqing
On Mon, Feb 3, 2014 at 1:12 PM, Sergio Guadarrama
[email protected]: