提交量子芯片计算任务

URL: https://xxx.com/task/realQuantum/run

向真实的物理量子芯片提交计算任务。 注意:提交至量子芯片的任务**必须**包含测量(Measurement)操作。

请求方法: Post

必选参数: - QProg(str): 量子线路。 - TaskType(int): 任务类型。

  • -1: 未定义 (Undefined)

  • 0: 蒙特卡洛测量 (Monte Carlo Measurement)

  • 2: 量子态重构 (QST)

  • 5: 期望值计算 (Expectation)

  • 10: 分布式任务 (Distributed)

可选参数: - Priority(uint): 优先级。0 表示普通任务(默认值),数值越大优先级越高。 - ChipID(str): 使用的芯片 ID。目前提供 72 和 102 位量子芯片,默认值为 72。 - Configuration(dict): 配置项。

  • shot(uint): 测量次数,默认 1000,范围 10-20000。

  • circuitOptimization(bool): 是否启用线路优化。true 为开启(默认),false 为关闭。

返回值: - taskState(str): 任务状态。

  • 0: 未操作

  • 1: 已发送

  • 2: 运行中

  • 3: 已完成(测控系统已返回结果)

  • 5: 编译完成,未发送至测控系统

  • 6: 编译完成,已发送至测控系统

  • 7: 测控系统计算错误

  • 8: 运行时间超限

  • 9: 编译系统开始执行

  • 10: 结果正返回至编译系统

  • 11: 编译系统已接收任务并开始计算

  • 12: 编译系统已返回结果

  • 22: 编译系统正在处理并行任务

  • 30: 获取并行结算结果,发送至编译系统处理

  • 31: 已接收任务,准备处理

  • 32: 正在处理并行结果

  • 33: 并行结果处理完成

  • 34: 并行结果处理错误

  • taskId(str): 已提交任务的任务 ID。

请求示例:

1. 普通测量任务:

{
  "token": "c3f7fe35-xxxx-xxxx-a178-070cc311d03b",
  "QMachineType": 5,
  "QProg": [
    "QINIT 6\nCREG 6\nH q[0]\nCNOT q[0],q[1]\nMEASURE q[0],c[0]\nMEASURE q[1],c[1]"
  ],
  "ChipID": "72",
  "TaskType": 0,
  "Priority": 0,
  "taskDescribe":"default",
  "Configuration": {
    "shot": 1000,
    "circuitOptimization": true,
    "use_cz_pattern": false,
    "amendFlag": 0,
    "mappingFlag": true,
    "specified_block": [],
    "PointLabel": 1
  }
}

2. 量子态层析任务:

{
  "token": "c3f7fe35-xxxx-xxxx-a178-070cc311d03b",
  "QMachineType": 5,
  "QProg": [
    "QINIT 6\nCREG 6\nH q[0]\nCNOT q[0],q[1]\nMEASURE q[0],c[0]\nMEASURE q[1],c[1]"
  ],
  "ChipID": "72",
  "TaskType": 2,
  "Priority": 0,
  "Configuration": {
    "shot": 1000,
    "circuitOptimization": true,
    "use_cz_pattern": false,
    "amendFlag": 0,
    "mappingFlag": true,
    "specified_block": [],
    "PointLabel": 1
  }
}

3. 分布式任务:

{
    "QMachineType": 5,
    "ChipID": "72",
    "TaskType": 10,
    "token": "c3f7fe35-xxxx-xxxx-a178-070cc311d03b",
    "QProg": [
        "QINIT 6\nCREG 6\nRY(q[0], 0.162461319481123)\nRY(q[1], 1.13411443752956)\nRY(q[2], 0.349219035305167)\nCNOT(q[0], q[1])\nRY(q[0], -1.30314609114098)\nRY(q[1], -0.000403011347911202)\nCNOT(q[1], q[2])\nRY(q[1], -0.0668867624864373)\nRY(q[2], 0.751632608892654)\nCNOT(q[2], q[0])\nRY(q[2], 0.943957761048972) \nRY(q[0], 0.877382733682492)\nCNOT(q[2], q[0])\nCNOT(q[1], q[2])\nCNOT(q[0], q[1])"
    ],
    "Configuration": {
        "shot": 1000,
        "mappingFlag": true,
        "construction_type" : 0,
        "max_supported_qubits" : 2
    }
}

4. 求期望任务:

{
    "token": "c3f7fe35-xxxx-xxxx-a178-070cc311d03b",
    "QMachineType": 5,
    "QProg": ["QINIT 6\nCREG 6\nH q[0]\nCNOT q[0],q[1]"],
    "ChipID": "72",
    "TaskType": 5,
    "Configuration": {
        "shot": 1000,
        "circuitOptimization": true,
        "hamiltonian": "\"\": -1.0534210769165204,\"Z0\": 0.394844363355904,\"Z1\": -0.39484436335590417,\"Z0 Z1\": -0.01124615715082114,\"X0 X1\": 0.18121046201519694"
    }
}

响应示例:

{
    "taskId": "098D12FE69184646BF16DDF53930C569",
    "taskState": 1
}