Skip to content

Commit

Permalink
Fix in-place all-gather input buffer in executor_test (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
yzygitzh authored Oct 24, 2024
1 parent b72decb commit 95ab108
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions python/test/executor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ def dtype_to_mscclpp_dtype(dtype):
raise ValueError(f"Unknown data type: {dtype}")


def determine_input_buf(sendbuf, recvbuf, in_place, execution_plan_name):
if "allgather" in execution_plan_name and in_place:
return recvbuf
else:
return sendbuf


def determine_result_buf(sendbuf, recvbuf, in_place, execution_plan_name):
if "allgather" in execution_plan_name:
return recvbuf
Expand Down Expand Up @@ -126,9 +133,9 @@ def main(

executor_func = lambda stream: executor.execute(
MPI.COMM_WORLD.rank,
sendbuf.data.ptr,
determine_input_buf(sendbuf, recvbuf, in_place, execution_plan_name).data.ptr,
determine_result_buf(sendbuf, recvbuf, in_place, execution_plan_name).data.ptr,
sendbuf.nbytes,
determine_input_buf(sendbuf, recvbuf, in_place, execution_plan_name).nbytes,
determine_result_buf(sendbuf, recvbuf, in_place, execution_plan_name).nbytes,
dtype_to_mscclpp_dtype(dtype),
execution_plan,
Expand Down

0 comments on commit 95ab108

Please sign in to comment.