Validate your Installation
Confirm qalgora-Q is installed correctly and detect the available backends.
Check the version
import qalgora
print(qalgora.__version__)
print(qalgora.get_targets()) # list available simulation/hardware targets
Run a smoke test
import qalgora
@qalgora.kernel
def ghz(n: int):
q = qalgora.qvector(n)
h(q[0])
for i in range(1, n):
x.ctrl(q[0], q[i])
mz(q)
print(qalgora.sample(ghz, 3)) # expect ~{ 000, 111 }
If you see a roughly even split between the all-zeros and all-ones bitstrings, your installation is working.
GPU target (planned · future validation)
GPU is not in the open reference build
The gpu target is a planned backend — the open reference build is CPU-only, so set_target("gpu") falls back to the CPU statevector simulator today. The snippet below documents the intended future GPU validation.# planned — GPU is not in the open reference build; kept commented out
# qalgora.set_target("gpu") # single-GPU statevector
# qalgora.set_target("gpu", option="mqpu") # multi-GPU / multi-QPU
验证安装
确认 qalgora-Q 安装无误,并查看当前可用的后端。
查看版本信息
import qalgora
print(qalgora.__version__)
print(qalgora.get_targets()) # list available simulation/hardware targets
跑一个最小示例
import qalgora
@qalgora.kernel
def ghz(n: int):
q = qalgora.qvector(n)
h(q[0])
for i in range(1, n):
x.ctrl(q[0], q[i])
mz(q)
print(qalgora.sample(ghz, 3)) # expect ~{ 000, 111 }
如果输出里 000 和 111 两种结果各约占一半,就说明安装一切正常。
GPU 目标(规划中 · 未来验证)
GPU 暂不可用
GPU 不在开放参考实现中;参考实现仅 CPU,set_target("gpu") 当前会回退到 CPU 态矢量模拟器;下方代码仅说明未来 GPU 验证的预期用法。# 规划中——GPU 不在开放参考实现中;保留为注释
# qalgora.set_target("gpu") # 单 GPU 态矢量
# qalgora.set_target("gpu", option="mqpu") # 多 GPU / 多 QPU