File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -134,9 +134,13 @@ int train() {
134134 // If the gpus flag is not provided, allow the mode and device to be set
135135 // in the solver prototxt.
136136 if (FLAGS_gpu.size () == 0
137- && solver_param.solver_mode () == caffe::SolverParameter_SolverMode_GPU
138- && solver_param.has_device_id ()) {
139- FLAGS_gpu = " " + boost::lexical_cast<string>(solver_param.device_id ());
137+ && solver_param.solver_mode () == caffe::SolverParameter_SolverMode_GPU) {
138+ if (solver_param.has_device_id ()) {
139+ FLAGS_gpu = " " +
140+ boost::lexical_cast<string>(solver_param.device_id ());
141+ } else { // Set default GPU if unspecified
142+ FLAGS_gpu = " " + boost::lexical_cast<string>(0 );
143+ }
140144 }
141145
142146 vector<int > gpus;
You can’t perform that action at this time.
0 commit comments