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

Hands-On: Origin Wukong (本源悟空)

◐ Design-level API
This page documents qalgora-Q API design, architecture, or adaptation workflows. Code examples illustrate intended usage and are not guaranteed to run in the current reference implementation.

Origin Wukong is China's home-grown superconducting quantum computer, open to the world over a public cloud. This page shows how to prepare a kernel and submit it through Origin's own SDK; the qalgora-Q reference build itself runs locally and does not submit natively. The latest Wukong-180 carries 180 compute qubits.

1 · Get cloud access

  1. Register on the Origin Quantum cloud and obtain an access token.
  2. Export it: export QALGORA_ORIGIN_TOKEN="..."

2 · Validate locally, then submit (adapter workflow · planned)

import qalgora

@qalgora.kernel
def bell():
    q = qalgora.qvector(2)
    h(q[0]); x.ctrl(q[0], q[1]); mz(q)

qalgora.set_target("qpp-cpu")                              # reference implementation, local validation
print(qalgora.sample(bell, shots_count=1000))
Specification interface / planned · not in the open reference build
Origin submission is a planned async adapter workflow requiring the Origin SDK and credentials. It is not part of the open CPU reference implementation. The lines below are commented out to show the intended shape.
# qalgora.set_target("origin", machine="wukong")          # planned adapter — needs Origin SDK + credentials
# job = qalgora.sample_async(bell, shots_count=4000)
# print(job.status())
# print(job.get())                                        # adapter future; blocks until the remote job finishes
Reference build runs locally — not real hardware
This example targets a remote cloud/QPU, but the open reference build does not submit to a real machine — it warns and falls back to the local CPU statevector simulator, returning simulated results. Submitting to an actual device (e.g. 天衍/TianYan, IBM, IonQ, Origin) requires the vendor’s own SDK and credentials.
On job.get()
This is the intended semantics of the adapter layer's job/future — it blocks until the remote job finishes. The open reference implementation does not produce a real remote job.

3 · Gate-based — but not zero-adaptation

Wukong runs standard gate-based kernels, so a qalgora-Q program targets it by switching the target name — but submission is not zero-adaptation: the adapter still performs gate-set translation, routing to the device's coupling map, and shot/queue handling. Coupler qubits boost connectivity.

4 · Why Origin for learning

  • Open public cloud — accessible worldwide, good for first hardware runs.
  • Self-contained stack — operating system and SDK provided by Origin.
  • Hundreds of thousands of jobs have already run through it (tens of millions of visits), so the queue and tooling are mature.
Tips
Coming from pyQPanda? Import your programs via pyQPanda interop, then submit to Wukong through the adapter. Validate on qpp-cpu first to save queue time.

实战:Origin Wukong(本源悟空)

◐ 设计接口
本页描述的是 qalgora-Q 的接口设计、架构设计或适配工作流。相关代码用于说明预期用法,当前参考实现不保证可以直接运行。

本源悟空是中国自主研发的超导量子计算机,通过公有云向全球开放。本页演示如何准备内核并经本源自己的 SDK 提交;qalgora-Q 参考实现本身在本地运行,不提供原生真机提交。最新的 Wukong-180 搭载 180 个计算量子比特。

1 · 获取云端访问权限

  1. 在本源量子云平台注册账号并获取访问令牌。
  2. 导出令牌:export QALGORA_ORIGIN_TOKEN="..."

2 · 本地验证,然后提交(适配器工作流·规划中)

import qalgora

@qalgora.kernel
def bell():
    q = qalgora.qvector(2)
    h(q[0]); x.ctrl(q[0], q[1]); mz(q)

qalgora.set_target("qpp-cpu")                              # 参考实现本地验证
print(qalgora.sample(bell, shots_count=1000))
规范接口/规划中 · 参考实现暂未包含
本源提交是规划中的异步适配器工作流,需本源 SDK 与凭据;开源 CPU 参考实现暂未包含。下方代码已注释,仅示意预期形态。
# qalgora.set_target("origin", machine="wukong")          # 规划中 / 适配示意:需本源 SDK 与凭据
# job = qalgora.sample_async(bell, shots_count=4000)
# print(job.status())
# print(job.get())                                        # 适配器 future;阻塞直到远程任务完成
参考实现仅本地运行 · 非真机
此示例虽指向远程云端/QPU,但开放参考实现不会真正提交到真机 —— 它会给出告警并回退到本地 CPU 态矢量模拟器,返回模拟结果,不会真正提交到天衍等真机。真正提交真机需使用对应厂商的 SDK 与凭证。
关于 job.get()
这是适配器层 job/future 的预期语义——它会阻塞直到远程任务完成;开放参考实现不会产生真实远程 job。

3 · 基于门的架构——但并非零适配

本源悟空运行标准的基于门的内核,因此 qalgora-Q 程序只需切换目标名称即可指向它——但提交并非零适配:适配器仍需进行门集编译、按设备耦合图布线,以及采样次数/排队处理。耦合量子比特提升了连通性。

4 · 为何用本源来学

  • 开放公有云——面向全球开放,适合首次真机运行。
  • 自成一体的技术栈——操作系统与 SDK 均由本源提供。
  • 已有数十万个任务在此运行(数千万次访问),排队机制与工具链均已成熟。
小贴士
从 pyQPanda 迁移?通过 pyQPanda 互操作导入现有程序, 再经适配器提交至本源悟空。建议先在 qpp-cpu 上验证,节省排队时间。