| 8 | |
| 9 | |
| 10 | def train( |
| 11 | solver, # solver proto definition |
| 12 | snapshot, # solver snapshot to restore |
| 13 | gpus, # list of device ids |
| 14 | timing=False, # show timing info for compute and communications |
| 15 | ): |
| 16 | # NCCL uses a uid to identify a session |
| 17 | uid = caffe.NCCL.new_uid() |
| 18 | |
| 19 | caffe.init_log() |
| 20 | caffe.log('Using devices %s' % str(gpus)) |
| 21 | |
| 22 | procs = [] |
| 23 | for rank in range(len(gpus)): |
| 24 | p = Process(target=solve, |
| 25 | args=(solver, snapshot, gpus, timing, uid, rank)) |
| 26 | p.daemon = True |
| 27 | p.start() |
| 28 | procs.append(p) |
| 29 | for p in procs: |
| 30 | p.join() |
| 31 | |
| 32 | |
| 33 | def time(solver, nccl): |