-
Notifications
You must be signed in to change notification settings - Fork 165
clean up device initialization in test #507
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
Conversation
/ok to test |
This comment has been minimized.
This comment has been minimized.
I think we miss an |
I only have a minute right now. Just quick, I saw this in one of the failing tests:
I see this elsewhere:
We have the Maybe @leofang saw something else? |
@rwgk You're totally right, I didn't test locally before running the CI since it was so small but I missed some obvious issues |
/ok to test |
cuda_core/tests/test_device.py
Outdated
buffer = device.allocate(1024) | ||
device.sync() | ||
assert buffer.handle != 0 | ||
assert buffer.size == 1024 | ||
assert buffer.device_id == 0 | ||
assert buffer.device_id == handle_return(runtime.cudaGetDevice()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this with a fresh eye, I'm wondering:
- We're in cuda.core but we're reaching back into a cuda.bindings API (
runtime
). Do we have to? - Could/should we do this instead? (does it matter?)
assert buffer.device_id == int(device)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that also works. I'll add it, and also a new test for the device id against our guarantee
/ok to test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reapproving, assuming tests pass.
The new test looks great.
|
I suspect the issue was related to the fact that we had a dangling device initialization. In any case we should test against our actual guarantee which is that Device() is current device when device_ordinal is unsupplied