Skip to content

Commit

Permalink
Update xoscar_cupy.py
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomY-2 committed Jul 24, 2023
1 parent 0979768 commit e1a2774
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/xoscar/collective/xoscar_cupy.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ def gather(
recv(context, temp_recv, peer)
buffs.append(temp_recv)

Check warning on line 154 in python/xoscar/collective/xoscar_cupy.py

View check run for this annotation

Codecov / codecov/patch

python/xoscar/collective/xoscar_cupy.py#L152-L154

Added lines #L152 - L154 were not covered by tests

buffs = cupy.concatenate(buffs)
recvbuf[:] = buffs.reshape(recvbuf.shape)
cupy_buff = cupy.concatenate(buffs)
recvbuf[:] = cupy_buff.reshape(recvbuf.shape)

Check warning on line 157 in python/xoscar/collective/xoscar_cupy.py

View check run for this annotation

Codecov / codecov/patch

python/xoscar/collective/xoscar_cupy.py#L156-L157

Added lines #L156 - L157 were not covered by tests
else:
send(context, sendbuf, root)

Check warning on line 159 in python/xoscar/collective/xoscar_cupy.py

View check run for this annotation

Codecov / codecov/patch

python/xoscar/collective/xoscar_cupy.py#L159

Added line #L159 was not covered by tests

Expand Down Expand Up @@ -217,9 +217,9 @@ def reduce_scatter(
def barrier(
context: Context,
):
barrier_tensors = [None] * len(context.n_devices)
for i, d in enumerate(context.n_devices):
with cupy.cuda.Device(d):
barrier_tensors = [None] * context.n_devices

Check warning on line 220 in python/xoscar/collective/xoscar_cupy.py

View check run for this annotation

Codecov / codecov/patch

python/xoscar/collective/xoscar_cupy.py#L220

Added line #L220 was not covered by tests
for i in range(context.n_devices):
with cupy.cuda.Device(i):
barrier_tensors[i] = cupy.array([1])
allreduce(context, barrier_tensors, barrier_tensors)

Check warning on line 224 in python/xoscar/collective/xoscar_cupy.py

View check run for this annotation

Codecov / codecov/patch

python/xoscar/collective/xoscar_cupy.py#L222-L224

Added lines #L222 - L224 were not covered by tests

Expand Down

0 comments on commit e1a2774

Please sign in to comment.