diff options
author | Marian Gläser <mglaeser@me.com> | 2016-12-22 12:25:46 -0800 |
---|---|---|
committer | Cyprien Noel <cyprien.noel@gmail.com> | 2017-01-06 14:57:04 -0800 |
commit | 0d27efc7e3d3d2edbf45cccb73bad03ad655c164 (patch) | |
tree | 8595c74ebc4007d2c2d8ffef1407b854b66100e6 /python | |
parent | e21b42004001879b232daed8f142fbc5a7e0b75d (diff) | |
download | caffeonacl-0d27efc7e3d3d2edbf45cccb73bad03ad655c164.tar.gz caffeonacl-0d27efc7e3d3d2edbf45cccb73bad03ad655c164.tar.bz2 caffeonacl-0d27efc7e3d3d2edbf45cccb73bad03ad655c164.zip |
Python layers should build on multiprocess & solver_cnt; enable with bindings
Diffstat (limited to 'python')
-rw-r--r-- | python/caffe/__init__.py | 2 | ||||
-rw-r--r-- | python/caffe/_caffe.cpp | 1 | ||||
-rw-r--r-- | python/train.py | 5 |
3 files changed, 5 insertions, 3 deletions
diff --git a/python/caffe/__init__.py b/python/caffe/__init__.py index dde2e986..43a0c49b 100644 --- a/python/caffe/__init__.py +++ b/python/caffe/__init__.py @@ -1,5 +1,5 @@ from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer -from ._caffe import init_log, log, set_mode_cpu, set_mode_gpu, set_device, Layer, get_solver, layer_type_list, set_random_seed, solver_count, set_solver_count, solver_rank, set_solver_rank, Layer, get_solver +from ._caffe import init_log, log, set_mode_cpu, set_mode_gpu, set_device, Layer, get_solver, layer_type_list, set_random_seed, solver_count, set_solver_count, solver_rank, set_solver_rank, set_multiprocess, Layer, get_solver from ._caffe import __version__ from .proto.caffe_pb2 import TRAIN, TEST from .classifier import Classifier diff --git a/python/caffe/_caffe.cpp b/python/caffe/_caffe.cpp index 04dac234..3589e476 100644 --- a/python/caffe/_caffe.cpp +++ b/python/caffe/_caffe.cpp @@ -359,6 +359,7 @@ BOOST_PYTHON_MODULE(_caffe) { bp::def("set_solver_count", &Caffe::set_solver_count); bp::def("solver_rank", &Caffe::solver_rank); bp::def("set_solver_rank", &Caffe::set_solver_rank); + bp::def("set_multiprocess", &Caffe::set_multiprocess); bp::def("layer_type_list", &LayerRegistry<Dtype>::LayerTypeList); diff --git a/python/train.py b/python/train.py index 730dbe70..5897f5dc 100644 --- a/python/train.py +++ b/python/train.py @@ -44,10 +44,10 @@ def time(solver, nccl): if solver.iter % display == 0: s = '\n' for i in range(len(solver.net.layers)): - s += 'forw %3d %8s ' % (i, solver.net.layers[i].layer_param.name) + s += 'forw %3d %8s ' % (i, solver.net._layer_names[i]) s += ': %.2f\n' % fprop[i].ms for i in range(len(solver.net.layers) - 1, -1, -1): - s += 'back %3d %8s ' % (i, solver.net.layers[i].layer_param.name) + s += 'back %3d %8s ' % (i, solver.net._layer_names[i]) s += ': %.2f\n' % bprop[i].ms s += 'solver total: %.2f\n' % total.ms s += 'allreduce: %.2f\n' % allrd.ms @@ -67,6 +67,7 @@ def solve(proto, snapshot, gpus, timing, uid, rank): caffe.set_device(gpus[rank]) caffe.set_solver_count(len(gpus)) caffe.set_solver_rank(rank) + caffe.set_multiprocess(True) solver = caffe.SGDSolver(proto) if snapshot and len(snapshot) != 0: |