|
1 | | -# Execution Backends |
| 1 | +# Backends |
2 | 2 |
|
3 | | -RQM supports multiple execution backends. All backends consume the same `u1q` IR produced by `rqm-compiler`, so the same program runs on any backend without modification. |
| 3 | +RQM is **backend-agnostic at the public circuit boundary** and **explicit about backend targeting later**. |
4 | 4 |
|
5 | | ---- |
6 | | - |
7 | | -## Available Backends |
8 | | - |
9 | | -| Backend | Package | Runtime | |
10 | | -|---|---|---| |
11 | | -| `"qiskit"` | `rqm-qiskit` | Qiskit Aer simulator / IBM hardware | |
12 | | -| `"braket"` | `rqm-braket` | Amazon Braket local simulator / AWS hardware | |
13 | | -| `"pennylane"` | `rqm-pennylane` | PennyLane default device / hardware plugins | |
14 | | - |
15 | | ---- |
16 | | - |
17 | | -## Selecting a Backend |
18 | | - |
19 | | -Pass the backend name string to `rqm_api.run`: |
20 | | - |
21 | | -```python |
22 | | -from rqm_api import run |
23 | | - |
24 | | -result = run(qc, backend="qiskit") |
25 | | -result = run(qc, backend="braket") |
26 | | -result = run(qc, backend="pennylane") |
27 | | -``` |
28 | | - |
29 | | -Or use a backend instance directly: |
30 | | - |
31 | | -```python |
32 | | -from rqm_qiskit import QiskitBackend |
33 | | - |
34 | | -backend = QiskitBackend() |
35 | | -result = run(qc, backend=backend) |
36 | | -``` |
| 5 | +This page documents backend families from the perspective of the current stack, not from the perspective of internal compiler IR. |
37 | 6 |
|
38 | 7 | --- |
39 | 8 |
|
40 | | -## rqm-qiskit |
41 | | - |
42 | | -[`rqm-qiskit`](https://github.com/RQM-Technologies-dev/rqm-qiskit) translates the `u1q` IR into Qiskit circuits and executes them on the Aer simulator or IBM hardware. |
43 | | - |
44 | | -**Install:** |
45 | | - |
46 | | -```bash |
47 | | -pip install rqm-qiskit |
48 | | -``` |
49 | | - |
50 | | -**Key class:** `QiskitBackend` |
51 | | - |
52 | | -```python |
53 | | -from rqm_qiskit import QiskitBackend |
54 | | - |
55 | | -backend = QiskitBackend() |
56 | | -result = backend.run_local(program) # local Aer simulator |
57 | | -result = backend.run_device(program, device="ibm_nairobi") # IBM hardware |
58 | | -``` |
59 | | - |
60 | | -**IR mapping:** `u1q` → Qiskit `U` gate (ZYZ decomposition) |
61 | | - |
62 | | ---- |
63 | | - |
64 | | -## rqm-braket |
65 | | - |
66 | | -[`rqm-braket`](https://github.com/RQM-Technologies-dev/rqm-braket) translates the `u1q` IR into Amazon Braket circuits and executes them locally or on AWS quantum hardware. |
| 9 | +## Current backend families exposed through the API |
67 | 10 |
|
68 | | -**Install:** |
69 | | - |
70 | | -```bash |
71 | | -pip install rqm-braket |
72 | | -``` |
73 | | - |
74 | | -**Key class:** `BraketBackend` |
75 | | - |
76 | | -```python |
77 | | -from rqm_braket import BraketBackend |
78 | | - |
79 | | -backend = BraketBackend() |
80 | | -result = backend.run_local(program) # local simulator |
81 | | -result = backend.run_device(program, device_arn="arn:...") # AWS hardware |
82 | | -``` |
83 | | - |
84 | | -**IR mapping:** `u1q` → Braket arbitrary rotation gate |
85 | | - |
86 | | ---- |
87 | | - |
88 | | -## rqm-pennylane |
89 | | - |
90 | | -[`rqm-pennylane`](https://github.com/RQM-Technologies-dev/rqm-pennylane) provides a PennyLane integration, exposing RQM circuits as PennyLane devices and supporting differentiable quantum workflows. |
91 | | - |
92 | | -**Install:** |
93 | | - |
94 | | -```bash |
95 | | -pip install rqm-pennylane |
96 | | -``` |
97 | | - |
98 | | -**Key class:** `PennyLaneBackend` |
99 | | - |
100 | | -```python |
101 | | -from rqm_pennylane import PennyLaneBackend |
102 | | - |
103 | | -backend = PennyLaneBackend() |
104 | | -result = backend.run_local(program) |
105 | | -``` |
| 11 | +| Backend hint or route | Current role | |
| 12 | +|---|---| |
| 13 | +| `generic` | Backend-neutral optimization/output posture | |
| 14 | +| `qiskit` | Qiskit-facing optimization hint and execution route | |
| 15 | +| `braket` | Braket-facing optimization hint and execution route | |
106 | 16 |
|
107 | | -**IR mapping:** `u1q` → PennyLane native rotation operation |
| 17 | +At the API layer, these appear in optimization and execution workflows. |
108 | 18 |
|
109 | 19 | --- |
110 | 20 |
|
111 | | -## Backend Interface Contract |
112 | | - |
113 | | -All backends implement the same interface: |
| 21 | +## Important distinction |
114 | 22 |
|
115 | | -| Method | Description | |
116 | | -|---|---| |
117 | | -| `run_local(program)` | Execute on a local simulator | |
118 | | -| `run_device(program, **kwargs)` | Execute on hardware | |
| 23 | +A backend hint on `/v1/circuits/optimize` is not the same thing as execution routing, and neither is the same thing as internal compiler IR. |
119 | 24 |
|
120 | | -All backends return a `Result` object with a `counts` attribute: |
| 25 | +RQM keeps these concerns separate: |
121 | 26 |
|
122 | | -```python |
123 | | -result.counts # {"00": 512, "11": 512} |
124 | | -``` |
125 | | - |
126 | | -This normalized contract means programs are fully portable across backends. |
| 27 | +1. public circuit intake |
| 28 | +2. internal optimization |
| 29 | +3. optional explicit backend lowering |
| 30 | +4. execution routing and readiness checks |
127 | 31 |
|
128 | 32 | --- |
129 | 33 |
|
130 | | -## Swapping Backends |
131 | | - |
132 | | -Swapping backends requires only one change: |
133 | | - |
134 | | -```python |
135 | | -# Before |
136 | | -result = run(qc, backend="qiskit") |
| 34 | +## What to document conservatively |
137 | 35 |
|
138 | | -# After |
139 | | -result = run(qc, backend="braket") |
140 | | -``` |
| 36 | +- some backend-hint behavior may be reserved or equivalent in the current release |
| 37 | +- execution availability should be inspected through capabilities, not assumed from a backend name alone |
| 38 | +- hardware-oriented flows still depend on provider readiness, credentials, and billing state |
141 | 39 |
|
142 | | -The circuit, compiler pipeline, and result interface are identical in both cases. |
143 | | - |
144 | | ---- |
| 40 | +See: |
145 | 41 |
|
146 | | -!!! tip "See also" |
147 | | - - [Quickstart](../quickstart.md) — minimal working example |
148 | | - - [rqm-api API guide](rqm-api-api.md) — full `run()` function reference |
149 | | - - [Canonical IR (u1q)](../compiler/canonical-ir.md) — how backends consume the IR |
| 42 | +- [Execution](execution.md) |
| 43 | +- [Execution Capabilities](execution-capabilities.md) |
| 44 | +- [Optimization](../optimization.md) |
0 commit comments