summaryrefslogtreecommitdiff
path: root/tools/caffe.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/caffe.cpp')
-rw-r--r--tools/caffe.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/caffe.cpp b/tools/caffe.cpp
index 9bf4214a..3587d8aa 100644
--- a/tools/caffe.cpp
+++ b/tools/caffe.cpp
@@ -195,6 +195,7 @@ int train() {
// If the gpus flag is not provided, allow the mode and device to be set
// in the solver prototxt.
if (FLAGS_gpu.size() == 0
+ && solver_param.has_solver_mode()
&& solver_param.solver_mode() == caffe::SolverParameter_SolverMode_GPU) {
if (solver_param.has_device_id()) {
FLAGS_gpu = "" +
@@ -244,11 +245,15 @@ int train() {
CopyLayers(solver.get(), FLAGS_weights);
}
+ LOG(INFO) << "Starting Optimization";
if (gpus.size() > 1) {
- caffe::P2PSync<float> sync(solver, NULL, solver->param());
- sync.Run(gpus);
+#ifdef USE_NCCL
+ caffe::NCCL<float> nccl(solver);
+ nccl.Run(gpus, FLAGS_snapshot.size() > 0 ? FLAGS_snapshot.c_str() : NULL);
+#else
+ LOG(FATAL) << "Multi-GPU execution not available - rebuild with USE_NCCL";
+#endif
} else {
- LOG(INFO) << "Starting Optimization";
solver->Solve();
}
LOG(INFO) << "Optimization Done.";