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

Backends & Simulators

◐ 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.

Select a target to choose where kernels execute — from CPU simulators to GPU statevector engines to physical QPUs.

Simulator targets

TargetDescriptionReference-build status
qpp-cpuCPU statevector simulator (default)Available in reference build
density-matrix-cpuNoisy simulation with density matricesAvailable in reference build
gpuSingle-GPU statevector simulatorPlanned
gpu-mqpuMulti-GPU / multi-QPU distributionPlanned
tensornetTensor-network simulator for large, low-entanglement circuitsPlanned
tensornet-mpsMatrix-product-state simulator for 1D / low-entanglement circuitsPlanned
stimClifford / stabilizer simulator (QEC)Planned
photonicsQudit / photonic operationsPlanned

cpu is an alias of qpp-cpu.

Selecting a target

Only qpp-cpu (and its cpu alias) and density-matrix-cpu run on the open reference build today; the GPU and tensor-network targets below are the specified interface and are not included yet.

import qalgora
qalgora.set_target("qpp-cpu")        # runnable today; "cpu" is an alias
counts = qalgora.sample(kernel)

# Planned backends (spec interface — not in the open reference build):
# qalgora.set_target("gpu")
# counts = qalgora.sample(kernel, target="tensornet")

Hardware QPUs

qalgora-Q documents vendor-SDK-mediated workflows for the same kernel on physical quantum hardware via cloud providers — the target name selects the vendor and device. The open reference build does not natively submit to a real QPU; it runs locally and falls back to the CPU simulator. Real execution requires the vendor SDK and credentials, supplied through environment variables.

# Planned adapter — real-QPU submission needs the vendor SDK and credentials:
# qalgora.set_target("quantinuum", machine="H2-1")
# qalgora.set_target("ionq")
# qalgora.set_target("iqm", qpu="Adonis")
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.

后端与模拟器

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

选择目标后端来决定内核的执行位置——从 CPU 模拟器、GPU 态矢量引擎,到实体 QPU。

模拟器目标后端

目标后端说明当前参考实现状态
qpp-cpuCPU 态矢量模拟器(默认)参考实现可用
density-matrix-cpu基于密度矩阵的噪声模拟参考实现可用
gpu单 GPU 态矢量模拟器规划中
gpu-mqpu多 GPU / 多 QPU 分布式执行规划中
tensornet适用于大规模低纠缠线路的张量网络模拟器规划中
tensornet-mps面向一维 / 低纠缠线路的矩阵乘积态模拟器规划中
stimClifford / 稳定子模拟器(QEC)规划中
photonics多能级量子位(qudit)与光子操作规划中

cpuqpp-cpu 的别名。

选择目标后端

当前只有 qpp-cpu(及其 cpu 别名)与 density-matrix-cpu 能在开放参考实现上运行;下面的 GPU 与张量网络目标属于规范接口,参考实现暂未包含。

import qalgora
qalgora.set_target("qpp-cpu")        # 当前可运行;"cpu" 是其别名
counts = qalgora.sample(kernel)

# 规划中后端(规范接口——参考实现暂未包含):
# qalgora.set_target("gpu")
# counts = qalgora.sample(kernel, target="tensornet")

硬件 QPU

qalgora-Q 记录的是经厂商 SDK 中介的工作流——目标后端名称用于指定厂商和设备,凭据通过环境变量传入。开放参考实现不会原生提交真机,而是在本地运行并回退到 CPU 模拟器;真机执行需厂商 SDK 与凭证。

# 规划中适配:真实 QPU 提交需厂商 SDK 与凭据
# qalgora.set_target("quantinuum", machine="H2-1")
# qalgora.set_target("ionq")
# qalgora.set_target("iqm", qpu="Adonis")
参考实现仅本地运行 · 非真机
此示例虽指向远程云端/QPU,但开放参考实现不会真正提交到真机 —— 它会给出告警并回退到本地 CPU 态矢量模拟器,返回模拟结果,不会真正提交到天衍等真机。真正提交真机需使用对应厂商的 SDK 与凭证。