-
Notifications
You must be signed in to change notification settings - Fork 139
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
[StateHandling] State API for remote platforms #1653
[StateHandling] State API for remote platforms #1653
Conversation
…with mlir and library mode
- Add multiple amplitude accessor - Remote implementation of multiple amplitude access. - Code tidy up
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. You'll need additional approval though.
namespace cudaq { | ||
|
||
void pyAltLaunchKernel(const std::string &, MlirModule, OpaqueArguments &, | ||
const std::vector<std::string> &); | ||
|
||
std::tuple<cudaq::ArgWrapper, std::size_t, std::int32_t> |
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.
Should this tuple
have a name?
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.
It's a good idea. Added a struct in c497846 to name this tuple.
@@ -27,6 +27,7 @@ int main() { | |||
assert(std::abs(state[2].real()) < 1e-3); | |||
assert(std::abs(M_SQRT1_2 - state[3].real()) < 1e-3); | |||
} | |||
|
|||
// Skipped test due to a stability issue. See: | |||
// https://github.com/NVIDIA/cuda-quantum/issues/1087 | |||
#if 0 |
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.
nit: delete this block?
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.
We'll keep this block since I haven't had a chance to retest it according to the ticket linked. We probably want to re-enable the test if it's no longer unstable.
Since this would introduce a breaking change to NVQC, it would be rebased to target |
@@ -184,7 +184,7 @@ jobs: | |||
create_function_result=$(ngc-cli/ngc cloud-function function create \ | |||
--container-image nvcr.io/${{ env.NGC_QUANTUM_ORG }}/${{ env.NGC_QUANTUM_TEAM }}/cuda-quantum:nightly \ | |||
--container-environment-variable NUM_GPUS:1 \ | |||
--container-environment-variable NVQC_REST_PAYLOAD_VERSION:1 \ | |||
--container-environment-variable NVQC_REST_PAYLOAD_VERSION:2 \ |
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.
I forget - was this change going to get pulled into a separate PR? Or was it just that we were going to hold off on this full PR until closer to the release.
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.
We will close this PR and migrate the changes to a new branch based on main
with deployment to test the integration. The changes will be merged closer to release.
Superseded by #1803 |
Description
State handling for remote platforms:
Introduce
SimulationState
subclass for remote platform (RemoteSimulationState
andPyRemoteSimulationState
) which is essentially a holder of the kernel IR.Perform a lazy evaluation to resolve the state:
(1) For state accessor, e.g.,
amplitudes
: adding a configurable qubit number threshold. If the number of qubits is less than the threshold, resolve the full state vector to the client. Otherwise, send on amplitude access request. Adding an API tocudaq::state
for batched amplitude access.(2) For overlap, sending job requests with both kernel IRs.
Note: the remote state is implemented for MLIR kernels only (C++ MLIR mode, kernel builder and Python).
Library mode C++ kernel is evaluated as-is (v0.7 mode): state is resolved to a vector by the server for each
get_state
call.