Skip to content

Commit

Permalink
Document frames_to_gpumemoryview
Browse files Browse the repository at this point in the history
  • Loading branch information
pentschev committed Mar 4, 2025
1 parent 5649f73 commit d041ddd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions python/cudf_polars/cudf_polars/experimental/dask_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@


def frames_to_gpumemoryview(frames):
"""
Convert the elements of `frames` to gpumemoryview.
UCX transfers produce `rmm.DeviceBuffer` objects instead of `gpumemoryview`.
This function leverages CUDA array interface to convert the elements of
`frames` to `gpumemoryview`, if necessary.
Parameters
----------
frames: list[Any]
List of frames to convert to `gpumemoryview` if they implement CUDA
array interface.
Returns
-------
converted: list[Any]
List of frames where all frames implementing CUDA array interface have
been converted to `plc.gpumemoryview`.
"""
return [
plc.gpumemoryview(f) if hasattr(f, "__cuda_array_interface__") else f
for f in frames
Expand Down

0 comments on commit d041ddd

Please sign in to comment.