Skip to content

[DONOTMERGE] (mostly) Python PoC for GPU objects in Ray - #51902

Closed
stephanie-wang wants to merge 1 commit into
ray-project:masterfrom
stephanie-wang:ray-gpu-python
Closed

stephanie-wang wants to merge 1 commit into
ray-project:masterfrom
stephanie-wang:ray-gpu-python

Conversation

@stephanie-wang

Copy link
Copy Markdown
Contributor

Why are these changes needed?

Compared to #51078, same functionality but implemented mainly in Python. For this to work, the user needs to add an annotation to actor methods that return a torch.Tensor, similar to the with_tensor_transport hint in compiled graphs. This allows the driver to check when ObjectRefs that contain a torch.Tensor are passed to a downstream task. Before the downstream task is submitted, the driver submits send/recv tasks to the src/dst actors.

In contrast, #51078 works transparently without any user annotations. However, this means that we can't use normal Ray tasks to submit the send/recv tasks, so these have to be implemented as RPCs in C++ instead.

Signed-off-by: Stephanie wang <[email protected]>
Comment thread test_gpu.py
@ray.remote
class Actor:

def register_custom_serializer(self):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a one-line call from the driver that enables the custom serialization.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe can do this as part of the ray.init_communicator call.

@stephanie-wang

Copy link
Copy Markdown
Contributor Author

TODOs before merge:

  1. One call to set up the actor communicator group, register custom serializers etc. This will be the "feature flag"
  2. Set the correct ObjectRef during deserialization.
  3. Basic GC - only allow the object to be used once, otherwise throw an error.

@kevin85421 kevin85421 mentioned this pull request May 1, 2025
8 tasks
@mascharkh mascharkh added community-contribution Contributed by the community python Pull requests that update Python code core Issues that should be addressed in Ray Core labels May 15, 2025
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Jun 11, 2025
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no more activity in the 14 days
since being marked stale.

Please feel free to reopen or open a new pull request if you'd still like this to be addressed.

Again, you can always ask for help on our discussion forum or Ray's public slack channel.

Thanks again for your contribution!

@github-actions github-actions Bot closed this Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community core Issues that should be addressed in Ray Core python Pull requests that update Python code stale The issue is stale. It will be closed within 7 days unless there are further conversation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants