qalgora-Q Docs Hub量子文档 ✦ Ask AI✦ 问问文档

Serverless Execution

○ Planned · Not yet implemented
The capabilities described on this page are planned and not yet implemented or released. They explain future design directions and should not be interpreted as delivered features.

Long hybrid workloads — parameter sweeps, multi-hour VQE — can outlive a local session. Serverless execution uploads your program and runs it as a managed remote job.

Planned interface · 规划接口
qalgora.serverless is a planned interface; it is not bundled in the open reference build. The snippet below is illustrative and is commented out so it will not run as-is.

Define and run a program

# Planned interface — not in the reference build; shown commented out.
# import qalgora
# from qalgora.serverless import QalgoraFunction
#
# # package a hybrid workload as a function
# fn = QalgoraFunction(title="vqe-sweep", entrypoint="vqe_sweep.py")
# fn.upload()
#
# job = fn.run(molecule="H2", bond_lengths=[0.5, 0.7, 0.9, 1.1])
# print(job.status())
# result = job.result()        # retrieve when finished
Specification API — not in the open reference build yet
This example shows a qalgora-Q specification API (or a third-party library) that the open reference build does not bundle today. It documents the intended interface; to run code now, use the reference build’s supported core API.

When to go serverless

  • Workloads longer than an interactive session.
  • Sweeps that interleave heavy classical compute with QPU calls.
  • Pipelines you want to launch and monitor remotely.
Managed compute
The classical part runs on managed compute next to the QPU, so data does not round-trip to your laptop between iterations.
Still subject to backend limits
Serverless suits managed, long-running hybrid workflows, but the actual QPU calls are still subject to backend queueing, quotas, and per-job time limits.

Serverless 执行

○ 规划中
本页所述能力属于规划功能,当前尚未发布或尚未实现。相关内容仅用于说明未来设计方向,不应理解为已交付能力。

长时间运行的混合负载——参数扫描、跑上几个小时的 VQE——往往撑不到本地会话结束就被掐断。Serverless 执行把你的程序上传到云端,作为托管的远程作业来跑。

规划接口
qalgora.serverless 属于规划接口,开放参考实现暂未内置。下方代码仅用于示意,已注释掉,无法直接运行。

定义并运行程序

# 规划接口——参考实现暂未包含;以下代码已注释掉。
# import qalgora
# from qalgora.serverless import QalgoraFunction
#
# # package a hybrid workload as a function
# fn = QalgoraFunction(title="vqe-sweep", entrypoint="vqe_sweep.py")
# fn.upload()
#
# job = fn.run(molecule="H2", bond_lengths=[0.5, 0.7, 0.9, 1.1])
# print(job.status())
# result = job.result()        # retrieve when finished
规范接口 · 参考实现暂未包含
此示例展示的是 qalgora-Q 规范中的接口(或第三方库),开放参考实现目前尚未内置,仅用于说明预期用法;如需立即运行,请使用参考实现已支持的核心 API。

何时选择 Serverless

  • 负载运行时间超过交互式会话的上限。
  • 需要在大量经典计算和 QPU 调用之间反复切换的参数扫描。
  • 想要远程启动、远程盯进度的流水线任务。
托管算力
经典计算部分就跑在紧挨 QPU 的托管算力上,每轮迭代的数据不必再往返本地机器。
仍受后端限制
Serverless 适合托管长时间混合工作流,但实际 QPU 调用仍受后端队列、配额和任务时限限制。