| 69 | static std::unique_ptr<LinkedLibraryHolder> holder; |
| 70 | |
| 71 | NB_MODULE(_quakeDialects, m) { |
| 72 | holder = std::make_unique<LinkedLibraryHolder>(); |
| 73 | |
| 74 | bindRegisterDialects(m); |
| 75 | |
| 76 | auto cudaqRuntime = m.def_submodule("cudaq_runtime"); |
| 77 | cudaqRuntime.def( |
| 78 | "registerLLVMDialectTranslation", |
| 79 | [](MlirContext ctx) { |
| 80 | mlir::registerLLVMDialectTranslation(*unwrap(ctx)); |
| 81 | }, |
| 82 | "Utility function for Python clients to register all LLVM Dialect " |
| 83 | "Translation passes with the provided MLIR Context. Primarily used by " |
| 84 | "kernel_builder and ast_bridge when created new MLIR Contexts."); |
| 85 | cudaqRuntime.def( |
| 86 | "initialize_cudaq", |
| 87 | [&](std::optional<std::string> option, std::optional<bool> emulate, |
| 88 | std::optional<std::string> target) { |
| 89 | CUDAQ_INFO("Calling initialize_cudaq."); |
| 90 | |
| 91 | std::map<std::string, std::string> extraConfig; |
| 92 | if (emulate && *emulate) { |
| 93 | extraConfig.insert({"emulate", "true"}); |
| 94 | } |
| 95 | if (option && !option->empty()) { |
| 96 | extraConfig.insert({"option", *option}); |
| 97 | } |
| 98 | if (target && !target->empty()) { |
| 99 | CUDAQ_INFO("Processing Python Arg: target - {}", *target); |
| 100 | holder->setTarget(*target, extraConfig); |
| 101 | } |
| 102 | }, |
| 103 | nanobind::arg("option") = nanobind::none(), |
| 104 | nanobind::arg("emulate") = nanobind::none(), |
| 105 | nanobind::arg("target") = nanobind::none(), |
| 106 | "Initialize the CUDA-Q environment."); |
| 107 | |
| 108 | bindRuntimeTarget(cudaqRuntime, *holder.get()); |
| 109 | bindMeasureCounts(cudaqRuntime); |
| 110 | bindResources(cudaqRuntime); |
| 111 | bindObserveResult(cudaqRuntime); |
| 112 | bindComplexMatrix(cudaqRuntime); |
| 113 | bindScalarWrapper(cudaqRuntime); |
| 114 | bindSpinWrapper(cudaqRuntime); |
| 115 | bindFermionWrapper(cudaqRuntime); |
| 116 | bindBosonWrapper(cudaqRuntime); |
| 117 | bindOperatorsWrapper(cudaqRuntime); |
| 118 | bindHandlersWrapper(cudaqRuntime); |
| 119 | bindSuperOperatorWrapper(cudaqRuntime); |
| 120 | bindPauliWord(cudaqRuntime); |
| 121 | bindOptimizerWrapper(cudaqRuntime); |
| 122 | bindNoise(cudaqRuntime); |
| 123 | bindExecutionContext(cudaqRuntime); |
| 124 | bindExecutionManager(cudaqRuntime); |
| 125 | bindPyState(cudaqRuntime, *holder.get()); |
| 126 | bindPyDataClassRegistry(cudaqRuntime); |
| 127 | bindPyEvolve(cudaqRuntime); |
| 128 | bindEvolveResult(cudaqRuntime); |
nothing calls this directly
no test coverage detected