[RFC] Handle device pointer for state initialization
Fixes #1788
This PR checks if the pointer is a device pointer and then does memcpy from device to device.
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.
CUDA Quantum Docs Bot: A preview of the documentation can be found here.
@1tnguyen May I please request for you review?
CUDA Quantum Docs Bot: A preview of the documentation can be found 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.
In file included from /workspaces/cuda-quantum/runtime/common/Logger.h:14,
from /workspaces/cuda-quantum/runtime/nvqir/CircuitSimulator.h:13,
from /workspaces/cuda-quantum/unittests/gpu/get_state_tester.cu:12:
/workspaces/cuda-quantum/runtime/common/FmtCore.h:16:10: fatal error: fmt/chrono.h: No such file or directory
16 | #include <fmt/chrono.h>
| ^~~~~~~~~~~~~~
compilation terminated.
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.
In file included from /workspaces/cuda-quantum/runtime/common/Logger.h:14, from /workspaces/cuda-quantum/runtime/nvqir/CircuitSimulator.h:13, from /workspaces/cuda-quantum/unittests/gpu/get_state_tester.cu:12: /workspaces/cuda-quantum/runtime/common/FmtCore.h:16:10: fatal error: fmt/chrono.h: No such file or directory 16 | #include <fmt/chrono.h> | ^~~~~~~~~~~~~~ compilation terminated.
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
qubit::qubit(const vector<complex<double>>&);
qubit::qubit(const initializer_list<complex<double>>&);
qvector::qvector(const vector<complex<double>>&);
qvector::qvector(const initializer_list<complex<double>>&);
in order to support passing a pointer to the GPU memory. This is related to issue #1086.
@1tnguyen @amccaskey Would you please add your thoughts here?
CUDA Quantum Docs Bot: A preview of the documentation can be found here.