Skip to content

Execution

Execute an algorithm on 2300. This is only allowed when 2300 is in non-interruption mode. So for a single execution three commands are required, "initialize", "execute", "terminate".

Execute

This message requests a backend to execute a user generated circuit. This can only be done when the system has been initialized (in reality "locked").

Info

The schemas for validation inherit from the extended schema and can be found in:

  • /schemas/execute/request.schema.json
  • /schemas/execute/reply_success.schema.json
  • /schemas/execute/reply_failure.schema.json

Execute request payload

Key Type Value
job_id int Client defined identifier for the execution.
circuit str Circuit description in cQASM language, see below for more information.
include_raw_data bool Whether or not to return all bitstrings in the order in which they were measured.
number_of_shots int Number of shots to be executed for the circuit.

The cQASM language is described in detail here. Different implementations of 2300 might impose different requirements. These will be described on a per case basis.

Execute request example

execute_request.json
{
    "session_id": "eb4fdc2c-755b-47d8-af76-bbca2dce554d",
    "command": "execute",
    "payload": {
        "job_id": 1,
        "circuit": "version 3.0\n\nqubits[2] q",
        "include_raw_data": true,
        "number_of_shots": 4
    },
    "version": "0.2.0"
}

Execute reply payload

Key Type Value
job_id int Client defined identifier for the execution.
results dict[str, int] Mapping of measured bitstring (for a circuit with n measurements; q[n]...q[0]) to count of occurrences. Limited to m results.
raw_data list[str] A list of bitstrings (little endian notation; q[n]...q[0]) ordered by the shot in which it was measured. If include_raw_data is set to false the list is left empty.

Execute reply example

execute_reply.json
{
    "session_id": "eb4fdc2c-755b-47d8-af76-bbca2dce554d",
    "status": "success",
    "payload": {
        "job_id": 1,
        "results": {
            "000": 3,
            "001": 1
        },
        "raw_data": [
            "000",
            "001",
            "000",
            "000"
        ]
    },
    "version": "0.2.0"
}