MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / get_state_async

Function get_state_async

python/cudaq/runtime/state.py:55–79  ·  view source on GitHub ↗

Asynchronously retrieve the state generated by the given quantum kernel. When targeting a quantum platform with more than one QPU, the optional `qpu_id` allows for control over which QPU to enable. Will return a future whose results can be retrieved via `future.get()`. Args:

(kernel, *args, qpu_id=0)

Source from the content-addressed store, hash-verified

53
54@trace.traced
55def get_state_async(kernel, *args, qpu_id=0):
56 """
57 Asynchronously retrieve the state generated by the given quantum kernel.
58 When targeting a quantum platform with more than one QPU, the optional
59 `qpu_id` allows for control over which QPU to enable. Will return a future
60 whose results can be retrieved via `future.get()`.
61
62 Args:
63 kernel (:class:`Kernel`): The :class:`Kernel` to execute on the QPU.
64 *arguments (Optional[Any]): The concrete values to evaluate the kernel
65 function at. Leave empty if the kernel doesn't accept any arguments.
66 `qpu_id` (Optional[int]): The optional identification for which QPU
67 on the platform to target. Defaults to zero. Key-word only.
68
69 Returns:
70 :class:`AsyncStateResult`: Quantum state data. (state vector or density
71 matrix)
72 """
73 if isa_kernel_decorator(kernel):
74 decorator = kernel
75 else:
76 decorator = mk_decorator(kernel)
77 processedArgs, module = decorator.prepare_call(*args)
78 return cudaq_runtime.get_state_async_impl(decorator.uniqName, module,
79 qpu_id, *processedArgs)
80
81
82def to_cupy(state, dtype=None):

Callers 4

CUDAQ_TESTFunction · 0.50
TESTFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50

Calls 3

isa_kernel_decoratorFunction · 0.90
mk_decoratorFunction · 0.90
prepare_callMethod · 0.80

Tested by 2

CUDAQ_TESTFunction · 0.40
TESTFunction · 0.40