Braket SDK Interop
◐ 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.Adapt Amazon Braket SDK circuits to qalgora-Q, and run Braket Hybrid Job-style workloads against a local qalgora-Q simulator (GPU acceleration is a planned plugin).
Importing a Braket circuit
import qalgora
from braket.circuits import Circuit
bell = Circuit().h(0).cnot(0, 1)
qalgora.set_target("qpp-cpu")
# Planned adapter:
# kernel = qalgora.from_braket(bell)
# print(qalgora.sample(kernel, shots_count=1000))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.Hybrid workloads
Braket Hybrid Jobs alternate classical and quantum steps. The same structure runs locally with qalgora-Q, using the local simulator for fast iteration before submitting to a Braket QPU (a planned interface that needs AWS credentials):
import qalgora
qalgora.set_target("qpp-cpu") # local validation in the open reference implementation
# optional: requires the qalgora-gpu plugin (planned)
# qalgora.set_target("gpu")
energy, params = qalgora.vqe(ansatz, hamiltonian, optimizer,
parameter_count=n)
# Planned QPU submission (needs AWS credentials and an S3 output path):
# qalgora.set_target("braket",
# machine="arn:aws:braket:us-east-1::device/qpu/ionq/Forte-1")
# final = qalgora.observe(ansatz, hamiltonian, params) # validate on hardwareSpecification 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.Braket ARNs
Native Braket device ARNs normally include a region (for example
arn:aws:braket:us-east-1::device/qpu/ionq/Forte-1); a short alias, if shown, is a
qalgora-Q alias, not a native Braket ARN. QPU submission needs AWS credentials, an S3 output path,
device availability windows, and cost confirmation.
Braket SDK 互操作
◐ 设计接口
本页描述的是 qalgora-Q 的接口设计、架构设计或适配工作流。相关代码用于说明预期用法,当前参考实现不保证可以直接运行。将 Amazon Braket SDK 电路适配至 qalgora-Q,并在本地 qalgora-Q 模拟器上运行 Braket Hybrid Jobs 风格的工作负载(GPU 加速为规划中的插件)。
导入 Braket 电路
import qalgora
from braket.circuits import Circuit
bell = Circuit().h(0).cnot(0, 1)
qalgora.set_target("qpp-cpu")
# 规划中的适配器:
# kernel = qalgora.from_braket(bell)
# print(qalgora.sample(kernel, shots_count=1000))规范接口 · 参考实现暂未包含
此示例展示的是 qalgora-Q 规范中的接口(或第三方库),开放参考实现目前尚未内置,仅用于说明预期用法;如需立即运行,请使用参考实现已支持的核心 API。混合工作负载
Braket Hybrid Jobs 交替执行经典步骤与量子步骤。相同的结构可在本地通过 qalgora-Q 运行,利用本地模拟器快速迭代,再提交至 Braket QPU(规划接口,需 AWS 凭据):
import qalgora
qalgora.set_target("qpp-cpu") # 在开放参考实现中本地验证
# 可选:需安装 qalgora-gpu 插件(规划中)
# qalgora.set_target("gpu")
energy, params = qalgora.vqe(ansatz, hamiltonian, optimizer,
parameter_count=n)
# 规划中的真机提交(需 AWS 凭据和 S3 输出路径):
# qalgora.set_target("braket",
# machine="arn:aws:braket:us-east-1::device/qpu/ionq/Forte-1")
# final = qalgora.observe(ansatz, hamiltonian, params) # validate on hardware规范接口 · 参考实现暂未包含
此示例展示的是 qalgora-Q 规范中的接口(或第三方库),开放参考实现目前尚未内置,仅用于说明预期用法;如需立即运行,请使用参考实现已支持的核心 API。Braket ARN
原生 Braket 设备 ARN 通常包含区域(如 arn:aws:braket:us-east-1::device/qpu/ionq/Forte-1);若显示短别名,则为 qalgora-Q 别名,而非原生 Braket ARN。真机提交需 AWS 凭据、S3 输出路径、设备可用时段以及费用确认。