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

Function get_state_async_impl

python/runtime/cudaq/algorithms/py_state.cpp:182–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182static std::future<state> get_state_async_impl(const std::string &shortName,
183 MlirModule module,
184 std::size_t qpu_id,
185 nanobind::args args) {
186 // Launch the asynchronous execution.
187 auto mod = unwrap(module);
188 std::string kernelName = shortName;
189 auto &platform = get_platform();
190 auto fnOp = getKernelFuncOp(mod, shortName);
191 auto opaques = marshal_arguments_for_module_launch(mod, args, fnOp);
192
193 nanobind::gil_scoped_release release;
194 auto clonedMod = std::shared_ptr<mlir::ModuleOp>(
195 new mlir::ModuleOp(mod.clone()), [](mlir::ModuleOp *p) {
196 p->erase();
197 delete p;
198 });
199 return detail::runGetStateAsync(
200 detail::make_copyable_function(
201 [opaques = std::move(opaques), kernelName, clonedMod]() mutable {
202 [[maybe_unused]] auto result =
203 clean_launch_module(kernelName, *clonedMod, opaques);
204 }),
205 platform, qpu_id);
206}
207
208/// @brief Python implementation of the `QPUState`.
209// Note: Python kernel arguments are wrapped hence need to be unwrapped

Callers 1

bindPyStateMethod · 0.85

Calls 5

getKernelFuncOpFunction · 0.85
runGetStateAsyncFunction · 0.85
make_copyable_functionFunction · 0.85
eraseMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected