-
Notifications
You must be signed in to change notification settings - Fork 196
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
[RFC] Handle device pointer for state initialization #1982
base: main
Are you sure you want to change the base?
Conversation
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
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.
0269611
to
1678dee
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
@1tnguyen May I please request for you review? |
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.
LGTM 👍 Thanks, @sacpis.
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
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.
Just capturing the offline discussion amongst the 4 of us...
int currentDevice; | ||
HANDLE_CUDA_ERROR(cudaGetDevice(¤tDevice)); | ||
|
||
if (attributes.device != currentDevice) { |
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.
This was discussed offline, but just to capture it here, we think it would be good to add a multi-GPU test somewhere to exercise this new code in this if branch; otherwise, the code in here would never have been tested, and there is some question about whether or not the calls to cudaSetDevice
would work as intended here.
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.
Another alternative would be to throw an "unsupported" error message here, but I think we should still add a test for the "same GPU" functionality as well.
int currentDevice; | ||
HANDLE_CUDA_ERROR(cudaGetDevice(¤tDevice)); | ||
|
||
if (attributes.device != currentDevice) { |
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.
Same comment here.
Here I am blocked on including nvqir/CircuitSimulator in get_state_tester. Seems like the builder is not happy including it in the file as it throws the below error.
|
Thanks, Sachin. I'm definitely open to any other ideas for testing here. I just think that we need to have some sort of test to prove that code changes are working as intended. If a unit test isn't working out, perhaps an application-level test (one where the user is providing a pointer to GPU memory) would work better than a unit test? |
Just had a call with @1tnguyen regarding passing the pointer to GPU memory. Putting this PR into the draft mode and adding RFC here. Seems like it might involve introduction of some new APIs to qvector, something like these
in order to support passing a pointer to the GPU memory. @1tnguyen @amccaskey Would you please add your thoughts here? |
d162912
to
4c6f33b
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
Fixes #1788
This PR checks if the pointer is a device pointer and then does memcpy from device to device.