Skip to content

Commit

Permalink
tested ring allreduce for msallreduce
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Sep 4, 2019
1 parent 66305fa commit 03e225d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/test_msallreduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ def test_horovod_multiple_allreduce_gpu(self):
size = hvd.size()

all_tensors = []
for i in range(4):
all_tensors.append([np.asarray([[(1.0+i)*(i==0), (2.0+i)*(i==1)], [(3.0+i)*(i==2), (4.0+i)*(i==3)]]), np.asarray([[(5.0+i)*(i==0), (6.0+i)*(i==1)], [(7.0+i)*(i==2), (8.0+i)*(i==3)]])])
for i in range(8):
# all_tensors.append([np.asarray([[(1.0), (2.0)], [(3.0), (4.0)]]), np.asarray([[(5.0), (6.0)], [(7.0), (8.0)]])])
# all_tensors.append([np.asarray([[(1.0+i), (2.0+i)], [(3.0+i), (4.0+i)]]), np.asarray([[(5.0+i), (6.0+i)], [(7.0+i), (8.0+i)]])])
all_tensors.append([np.asarray([(1.0+i), (1.0+i)])])
# all_tensors.append([np.asarray([[(1.0+i)*(i==0), (2.0+i)*(i==1)], [(3.0+i)*(i==2), (4.0+i)*(i==3)]]), np.asarray([[(5.0+i)*(i==0), (6.0+i)*(i==1)], [(7.0+i)*(i==2), (8.0+i)*(i==3)]])])


# rank0_tensors = [np.asarray([[1.0, 2.0], [3.0, 4.0]]), np.asarray([[9.0, 10.0], [11.0, 12.0]])]
Expand All @@ -91,10 +94,9 @@ def test_horovod_multiple_allreduce_gpu(self):
# rank1_tensors = [np.asarray([[9.0, 10.0], [11.0, 12.0]])]

expected = all_tensors[0]
for i in range(1,4):
for i in [3, 2, 1, 5, 6, 7, 4]:
answer0 = parasail_reference_operation(expected[0], all_tensors[i][0])
answer1 = parasail_reference_operation(expected[1], all_tensors[i][1])
expected = [answer0, answer1]
expected = [answer0]
rank_num = hvd.local_rank()
for dtype in [tf.float32]:
with tf.device("/gpu:{}".format(rank_num)):
Expand Down

0 comments on commit 03e225d

Please sign in to comment.