Skip to content

Commit

Permalink
fix usage of collective_ops.nccl
Browse files Browse the repository at this point in the history
  • Loading branch information
ppwwyyxx committed Jul 22, 2020
1 parent 6151e04 commit fa0b0ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tensorpack/graph_builder/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,10 @@ def allreduce_grads(all_grads, average, mode="nccl"):
for t in grads:
with tf.device(t.device):
t = collective_ops.all_reduce(
t, len(grads), shared_cnt, shared_cnt + 100,
'Add', 'Id')
t, len(grads),
42, # group key is any fixed integer for a fixed group of devices
shared_cnt + 100,
'Add', 'Id', communication_hint='nccl')
summed.append(t)

grads_for_devices = [] # K
Expand Down

0 comments on commit fa0b0ca

Please sign in to comment.