Skip to content

Implement device and context properties for Event #618

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

NaderAlAwar
Copy link
Contributor

Description

closes #491

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Copy link
Contributor

copy-pr-bot bot commented May 6, 2025

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@NaderAlAwar
Copy link
Contributor Author

/ok to test

@leofang leofang self-requested a review May 7, 2025 17:34
@leofang leofang added enhancement Any code-related improvements P1 Medium priority - Should do cuda.core Everything related to the cuda.core module labels May 7, 2025
@leofang leofang added this to the cuda.core beta 4 milestone May 7, 2025
Comment on lines 116 to 117
self._device_id = int(handle_return(driver.cuCtxGetDevice()))
self._ctx_handle = handle_return(driver.cuStreamGetCtx(self._mnff.handle))
Copy link
Member

Choose a reason for hiding this comment

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

Let's avoid driver calls if possible to reduce overhead. The same info can be passed in from within the two public constructors (I think!) Device.create_event and Stream.record.

def test_event_device(init_cuda):
event = Device().create_event(options=EventOptions())
device = event.device
assert isinstance(device, Device)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The docstring ...

Return the :obj:`~_device.Device` singleton associated with this event.

mentions "singleton". → Could this be

device = Device()
event  = device.create_event(options=EventOptions())
assert event.device is device

?

@NaderAlAwar
Copy link
Contributor Author

/ok to test

Copy link

@NaderAlAwar
Copy link
Contributor Author

/ok to test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda.core Everything related to the cuda.core module enhancement Any code-related improvements P1 Medium priority - Should do
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Event should provide an inverse lookup to its origin Device/Context
3 participants