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

decompress pickled messages #8216

Merged
merged 3 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
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
19 changes: 19 additions & 0 deletions distributed/comm/tests/test_ucx.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,22 @@ async def test_comm_closed_on_read_error():
await wait_for(reader.read(), 0.01)

assert reader.closed()


@gen_test()
async def test_embedded_cupy_array(
ucx_loop,
):
cupy = pytest.importorskip("cupy")
da = pytest.importorskip("dask.array")
np = pytest.importorskip("numpy")

async with LocalCluster(
protocol="ucx", n_workers=1, threads_per_worker=1, asynchronous=True
) as cluster:
async with Client(cluster, asynchronous=True) as client:
assert cluster.scheduler_address.startswith("ucx://")
a = cupy.arange(10000)
x = da.from_array(a, chunks=(10000,))
b = await client.compute(x)
cupy.testing.assert_array_equal(a, b)
2 changes: 2 additions & 0 deletions distributed/protocol/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ def _decode_default(obj):
sub_header = msgpack.loads(frames[offset])
offset += 1
sub_frames = frames[offset : offset + sub_header["num-sub-frames"]]
if "compression" in sub_header:
sub_frames = decompress(sub_header, sub_frames)
if allow_pickle:
return pickle.loads(sub_header["pickled-obj"], buffers=sub_frames)
else:
Expand Down
Loading