Configuration¶
SimulatorConfig bundles every simulator option into one reusable value. Every
execution and estimation function takes one as config; without it, a default
SimulatorConfig() runs QCSim with a statevector.
import maestro
config = maestro.SimulatorConfig(
simulation_type=maestro.SimulationType.MatrixProductState,
max_bond_dimension=64,
)
config.seed = 7 # fields can also be set after construction
print(config.simulation_type, config.max_bond_dimension, config.seed)
SimulationType.MatrixProductState 64 7
The constructor takes every option by keyword only. The options you’ll actually set lists the handful most people set.
All SimulatorConfig options¶
Option |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Simulation backend. |
|
|
|
Simulation method |
|
|
|
Bond dimension limit for MPS, MPO and GPU tensor networks. For GPU MPS/MPO, |
|
|
|
Truncation threshold for MPS, MPO and GPU tensor networks, read according to |
|
|
|
|
|
|
|
|
|
|
|
Seeds all backend and Maestro sampling random streams. Parallel jobs derive deterministic, distinct child streams. |
|
|
|
CUDA device for single-GPU execution (GPU access only) |
|
|
|
Settings for |
|
|
|
Fuse compatible gates. |
|
|
|
Turn off swap-cost and initial qubit-map optimization |
|
|
|
Swap optimization lookahead depth; |
|
|
|
CPU MPS/MPO routing: |
|
|
|
Opt into bounded virtual-bond routing on QCSim and GPU MPS and MPO; off by default |
|
|
|
Non-negative overflow penalty relative to capped runtime cost. Default 1; 0 charges runtime alone. |
|
|
|
MPS shot sampling: |
|
|
|
GPU SVD solver: |
|
|
|
MPO handling of incomplete Kraus sets: |
|
|
|
Renormalize the CPU MPO after each truncation |
|
|
|
Pauli propagation: drop strings whose coefficient magnitude is at most this |
|
|
|
Pauli propagation: drop strings acting on more qubits than this |
|
|
|
Pauli propagation: how often, in primitive operations, to apply the two thresholds; deduplication also merges repeated strings. Unset, PauliPropagator deduplicates every 10 operations. |
|
|
|
PathIntegral trim threshold |
|
|
|
Drop gates and idle qubits outside the backward lightcone of the requested observables |
|
|
|
Simulate groups of observables with disjoint lightcones separately, each on its own register |
|
|
|
Also split overlapping lightcones into groups of at most this many qubits; see Bounding group size |
|
|
|
Batch disjoint small lightcones together up to this width, within the maximum |
|
|
|
Detect invariant check subspaces and simulate the reduced register on the configured backend |
|
|
|
Opt-in absolute error budget for bounded backward evaluation of exact noisy channels |
|
|
|
Sample disjoint measurement lightcones independently and exactly; changes seeded random streams |
|
|
|
Allow ensemble-equivalent reset marginalization; individual trajectories can change |
|
|
|
QCSim statevector, density-matrix and path-integral dynamic circuits: |
|
|
|
Soft budget in MiB for concurrent QCSim dense trajectories; |
|
|
|
Maximum concurrent simulators, from 1 to 1024. |
Reference¶
- class SimulatorConfig(*args, **kwargs)¶
Configuration for the quantum simulator backend. Create once and reuse across execute/estimate/statevector calls. Every field is a keyword argument of the constructor.
- property allow_reset_marginalization¶
Allow ensemble-equivalent reset marginalization; individual trajectories can change.
- property auto_reduce¶
Detect check-generated invariant subspaces before estimation and simulate the reduced register using the configured backend; unsupported circuits retain full execution.
- property disable_optimized_swapping¶
Turn off swap-cost optimisation and the initial qubit-map optimisation.
- property distributed_options¶
first global qubits, automatic Ex execution, visible GPUs. MPI calls must match across ranks; mpi_communicator is mpi4py Comm.py2f().
- Type:
Distribution settings passed to Configure before allocation. Keys start with
distributed_ormpi_. Defaults
- property enable_causal_cone_reduction¶
Reduce observable causal cones before allocation; distributed GPU backends retain full execution.
- property enable_observable_clustering¶
With causal-cone reduction, partition multi-observable estimates into groups with disjoint lightcones and simulate each on its own compact register. GPU PauliPropagator keeps all observables in one run, since each extra run costs more than it saves.
- property enable_sampling_reduction¶
Opt into exact independent sampling of disjoint measurement cones; changes seeded random streams.
- property gate_fusion¶
on, except for CPU statevectors below 11 qubits and CPU density matrices below 5, where fusion costs more than it saves. True or False force it. Truncated MPS/MPO results can change.
- Type:
Fuse compatible gates on supported backends. None (the default) uses each backend’s default
- property gpu_device¶
CUDA-visible device ordinal, or None to use the default.
- property lookahead_depth¶
Lookahead depth for swap optimisation; -1 uses Maestro’s default.
- property max_bond_dimension¶
Largest bond dimension kept when truncating MPS, MPO and GPU tensor-network states. None uses the backend default (128 for GPU MPS and MPO).
- property max_cluster_qubits¶
With observable clustering, split overlapping lightcones into groups of at most this many qubits; a larger single-observable lightcone gets its own group. None uses 20 for statevectors, 10 for density matrices, or connected components for other methods. GPU PauliPropagator ignores it and keeps all observables in one run. With PauliPropagator and pp_gates_between_trims above 1, trims fall on different gates per group, so values can vary with the budget within the truncation error.
- property max_simulators¶
Maximum concurrent simulators, from 1 to 1024. None keeps the network default; CPU and trajectory memory budgets may reduce concurrency.
- property min_cluster_qubits¶
Optionally batch disjoint small cones up to this width, within the maximum budget.
- property mpo_hermitize_after_truncation¶
Make the CPU MPO Hermitian again after each truncation.
- property mpo_kraus_completeness_check¶
‘ignore’, ‘warn’ or ‘strict’ (raise). None uses the default.
- Type:
How the MPO simulator treats Kraus operators that do not sum to the identity
- property mpo_restore_trace_after_truncation¶
Rescale the CPU MPO to unit trace after each truncation.
- property mpo_svd_solver¶
GPU SVD solver for MPO truncation; the choices of mps_svd_solver.
- property mps_routing_strategy¶
‘legacy’ (default) or opt-in ‘combined’. Explicit lookahead overrides this selection.
- Type:
CPU MPS/MPO automatic routing
- property mps_routing_truncation_weight¶
Nonnegative overflow penalty relative to capped runtime cost. Default 1; zero charges runtime alone.
- property mps_routing_virtual_bonds¶
Opt into bounded virtual-bond routing on QCSim/GPU MPS and MPO; defaults to disabled.
- property mps_sampling¶
How QCSim and Aer MPS simulations sample shots; the GPU MPS simulator ignores it. ‘probabilities’ (the default) samples without collapsing the state; ‘apply_measure’ measures, collapses and restores it for every shot. Both draw from the same distribution, but consume the random stream differently, so one seed gives different counts.
- property mps_svd_solver¶
‘gesvd’, ‘gesvdj’ (Jacobi), ‘gesvdp’ (polar) or ‘gesvdr’ (randomised). None keeps the GPU library’s default.
- Type:
GPU SVD solver for MPS truncation
- property observable_error_tolerance¶
Opt-in absolute expectation error budget for bounded backward evaluation of exact noisy channels.
- property path_integral_threshold¶
Trim threshold for PathIntegral simulation; None disables trimming.
- property pp_coefficient_threshold¶
truncation passes drop strings whose
|coefficient|is at most this value.- Type:
Pauli propagation
- property pp_gates_between_deduplications¶
every this many operations, merge repeated strings and then apply both thresholds; takes precedence over a trim due on the same operation. Must be positive. Unset, PauliPropagator simulations use 10.
- Type:
Pauli propagation
- property pp_gates_between_trims¶
apply both thresholds every this many operations, counting each primitive operation a gate decomposes into. Must be positive.
- Type:
Pauli propagation
- property pp_max_pauli_weight¶
truncation passes drop strings acting on more qubits than this; a value at or above the qubit count keeps them all.
- Type:
Pauli propagation
- property precision¶
‘single’ or ‘double’ floating point for Qiskit Aer and the GPU simulators. None keeps each backend’s default. Other backends ignore it; QCSim always computes in double precision.
- property seed¶
measurement, readout and reset. The noisy functions also seed their injected noise from its low 32 bits when their noise_seed is unset. None seeds from system entropy.
- Type:
Seed for simulation randomness
- property simulation_type¶
Simulation method, a SimulationType.
- property simulator_type¶
Simulator backend, a SimulatorType.
- property singular_value_threshold¶
SVD truncation threshold for MPS, MPO and GPU tensor-network states, read according to truncation_mode. Under ‘relative_max’ it is a ratio of singular values; under ‘discarded_weight’ it bounds the discarded normalised squared weight, so the same number truncates much harder (1e-8 drops singular values up to about 1e-4 of the spectrum’s norm). None uses the backend default.
- property tensor_network_svd_solver¶
GPU SVD solver for tensor-network truncation; the choices of mps_svd_solver.
- property trajectory_max_memory_mb¶
Positive MiB estimate limiting concurrent QCSim dense trajectories. None uses 1024 MiB. This is a soft concurrency budget, not a process memory limit; at least one worker is allowed.
- property trajectory_policy¶
‘block_v1’ preserves existing seeded counts; ‘shot_v1’ distributes individual shots with streams independent of worker count. The policies give different seeded sequences. None uses ‘shot_v1’. Terminal sampling is unaffected.
- Type:
QCSim statevector, density-matrix and path-integral dynamic circuits
- property truncation_mode¶
‘relative_max’ drops singular values below singular_value_threshold times the largest; ‘discarded_weight’ (the default on every backend) drops the smallest until their cumulative normalised squared weight reaches the threshold. Only QCSim and the GPU backend support ‘relative_max’; Aer raises if it is requested.