Configuration files¶
Backend-specific parameters are passed through a single YAML file with
--config, rather than a proliferation of per-backend command-line flags:
netqmpi -n 3 app.py --cunqa --config run.yaml
File layout¶
The file mixes generic settings at the top level with optional per-backend blocks keyed by backend name. Only the block matching the selected backend is read; blocks for other backends are ignored, so one file can carry the settings for every backend you use.
# run.yaml
shots: 1000 # generic: applies whatever the backend
cunqa: # read only with --cunqa
qraise: true
backend: examples/cunqa_backend.json
simulator: Munich
qoala: # read only with --qoala
link_fidelity: 0.8
hardware:
t1: 0
single_qubit_gate_depolar_prob: 0.1
The recognised backend block names are cunqa, netqasm, aer and qoala
(KNOWN_BACKENDS in netqmpi.runtime.run_config). Any other top-level key
is treated as a generic setting and merged into every backend’s config.
The merge is performed by read_config_block():
generic settings first, then the selected backend’s block on top. Reading the
file above with --qoala therefore yields
{"shots": 1000, "link_fidelity": 0.8, "hardware": {...}}.
Typos are errors, not silence¶
Unknown keys are rejected rather than ignored, so a mistyped field surfaces immediately:
ValueError: Unknown config keys for CunqaRunConfig: ['simulater']
Generic settings¶
Key |
Type |
Default |
Meaning |
|---|---|---|---|
|
int |
|
Number of times the program is repeated |
--shots on the command line overrides whatever the file says, so a quick run
can bump the shot count without editing the file.
cunqa block¶
Configures which virtual QPUs the run uses, and whether NetQMPI raises them itself. See the CUNQA backend page for the full story.
Key |
Type |
Default |
Meaning |
|---|---|---|---|
|
bool |
|
Raise the vQPUs for this run and drop them afterwards. When |
|
str |
|
Path to the vQPU definition file the vQPUs are raised with — this is what fixes the qubit budget. Raise-mode only. |
|
str |
|
Simulator backing each vQPU. Raise-mode only. |
|
str |
|
SLURM wall-clock reservation, as |
|
str |
|
Which raised family to attach to, or the name of the family to raise. |
|
bool |
|
Whether the vQPUs are reachable from other nodes (co-located mode) rather than only from the node they run on (hpc mode). Must match how they were raised. |
Raise-only settings are reported, not ignored
Setting backend, simulator or time while attaching to running vQPUs is an
error, not a silent no-op:
ValueError: simulator, time only apply when NetQMPI raises the vQPUs itself.
Either add 'qraise: true' to the cunqa block of the config file, or drop those
settings and raise the vQPUs yourself with qraise before running.
qoala block¶
Key |
Type |
Default |
Meaning |
|---|---|---|---|
|
int |
|
Physical qubits per node. Inferred from the compiled circuits when unset. |
|
float |
|
EPR-pair generation time, in ns |
|
float |
|
Duration of one quantum-processor instruction, in ns |
|
float |
|
EPR-pair fidelity to the ideal Bell state, in |
|
int |
|
NetSquid random seed, for reproducible runs |
|
mapping |
|
qdevice noise model; omit for a perfect device |
A link_fidelity outside [0.25, 1.0] is rejected when the config is built.
qoala.hardware — the qdevice¶
Maps to QoalaQDeviceConfig
and is applied uniformly to every node. Durations are in nanoseconds; t1 == t2 == 0 means “no memory noise”, and zero depolarising probabilities mean noiseless
gates, so the defaults describe a perfect qdevice.
Key |
Default |
Meaning |
|---|---|---|
|
|
Amplitude-damping time (ns); 0 disables it |
|
|
Dephasing time (ns); 0 disables it. Requires |
|
|
Duration of single-qubit gates (ns) |
|
|
Duration of two-qubit gates (ns) |
|
|
Duration of qubit initialization (ns) |
|
|
Duration of measurement (ns) |
|
|
Depolarising probability of single-qubit gates |
|
|
Depolarising probability of two-qubit gates |
Note
Depolarising noise is applied to the gates only. INSTR_INIT and
INSTR_MEASURE carry their own duration but no depolarising error, so there is
no separate readout-flip model.
aer block¶
Key |
Type |
Default |
Meaning |
|---|---|---|---|
|
str |
|
Qubit transfer protocol for |
|
int |
|
RNG seed, for reproducible simulations |
netqasm block¶
Key |
Type |
Default |
Meaning |
|---|---|---|---|
|
|
|
Quantum state formalism used by the simulation |
|
bool |
|
Per-rank instruction logging |
|
str |
|
Hardware model name |
|
Any |
|
Simulated network topology; default topology when unset |
|
Any |
|
NetQASM log configuration |
|
str |
|
Roles configuration file |
|
callable |
|
Function invoked after the simulation |
Several of these — formalism, network_config, log_cfg, post_function —
hold objects rather than scalars and cannot be expressed in YAML. Set them by
constructing a
NetQASMRunConfig in
Python and driving the run through
simulate(), as shown in
Programmatic use.
Defining your own¶
A backend config is a dataclass extending
RunConfig:
from dataclasses import dataclass
from typing import Optional
from netqmpi.runtime.run_config import RunConfig
@dataclass
class MyBackendConfig(RunConfig):
"""Backend-specific configuration."""
shots: int = 1024
my_parameter: float = 0.5
seed: Optional[int] = None
from_dict() maps YAML keys onto the
dataclass fields and rejects unknown ones. Override it if your config has a
nested block to translate, as QoalaRunConfig does for hardware.