Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Avoid multiple blocking calls by gathering UCX frames (#5487)" #5505

Merged
merged 1 commit into from
Nov 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions distributed/comm/ucx.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

.. _UCX: https://github.com/openucx/ucx
"""
import asyncio
import functools
import logging
import os
Expand Down Expand Up @@ -279,6 +278,16 @@ async def write(

# Send meta data

# Send close flag and number of frames (_Bool, int64)
await self.ep.send(struct.pack("?Q", False, nframes))
# Send which frames are CUDA (bool) and
# how large each frame is (uint64)
await self.ep.send(
struct.pack(nframes * "?" + nframes * "Q", *cuda_frames, *sizes)
)

# Send frames

# It is necessary to first synchronize the default stream before start
# sending We synchronize the default stream because UCX is not
# stream-ordered and syncing the default stream will wait for other
Expand All @@ -287,22 +296,8 @@ async def write(
if any(cuda_send_frames):
synchronize_stream(0)

tasks = []

# Send close flag and number of frames (_Bool, int64)
tasks.append(self.ep.send(struct.pack("?Q", False, nframes)))
# Send which frames are CUDA (bool) and
# how large each frame is (uint64)
tasks.append(
self.ep.send(
struct.pack(nframes * "?" + nframes * "Q", *cuda_frames, *sizes)
)
)

# Send frames
for each_frame in send_frames:
tasks.append(self.ep.send(each_frame))
await asyncio.gather(*tasks)
await self.ep.send(each_frame)
return sum(sizes)
except (ucp.exceptions.UCXBaseException):
self.abort()
Expand Down Expand Up @@ -359,10 +354,8 @@ async def read(self, deserializers=("cuda", "dask", "pickle", "error")):
if any(cuda_recv_frames):
synchronize_stream(0)

tasks = []
for each_frame in recv_frames:
tasks.append(self.ep.recv(each_frame))
await asyncio.gather(*tasks)
await self.ep.recv(each_frame)
msg = await from_frames(
frames,
deserialize=self.deserialize,
Expand Down