QiskitSimulator

class QiskitSimulator(n_processes=None, shots=5000, simulation_seed=None, qiskit_backend=None, noise_model=None, track_depth=False, force_sampling=False, _deterministic_execution=False)[source]

Bases: CircuitRunner

A parallel wrapper around Qiskit’s AerSimulator using Qiskit’s built-in parallelism.

Parameters:
  • n_processes (int | None) – Number of parallel processes to use for transpilation and simulation. If None, defaults to half the available CPU cores (min 2, max 8). Controls both transpilation parallelism and execution parallelism. The execution parallelism mode (circuit or shot) is automatically selected based on workload characteristics.

  • shots (int) – Number of shots to perform. Defaults to 5000.

  • simulation_seed (int | None) – Seed for the random number generator to ensure reproducibility. Defaults to None.

  • qiskit_backend (BackendV2 | Literal['auto'] | None) – A Qiskit backend to initiate the simulator from. If "auto" is passed, the best-fit most recent fake backend will be chosen for the given circuit. Defaults to None, resulting in noiseless simulation.

  • noise_model (NoiseModel | None) – Qiskit noise model to use in simulation. Defaults to None.

  • track_depth (bool) – If True, record circuit depth for each submitted batch. Access via depth_history after execution. Defaults to False.

  • force_sampling (bool) – If True, always use shot-based sampling even for expectation value measurements. Defaults to False.

Attributes Summary

is_async

Whether the backend executes circuits asynchronously.

n_processes

Get the current number of parallel processes.

supports_expval

Whether the backend supports expectation value measurements.

Methods Summary

estimate_run_time_batch([circuits, ...])

Estimate the execution time of a quantum circuit on a given backend, accounting for parallel gate execution.

estimate_run_time_single_circuit(circuit, ...)

Estimate the execution time of a quantum circuit on a given backend, accounting for parallel gate execution.

set_seed(seed)

Set the random seed for circuit simulation.

submit_circuits(circuits, *[, ham_ops, ...])

Submit multiple circuits for parallel simulation using Qiskit's built-in parallelism.

Attributes Documentation

is_async

Whether the backend executes circuits asynchronously.

n_processes

Get the current number of parallel processes.

Returns:

Number of parallel processes configured.

Return type:

int

supports_expval

Whether the backend supports expectation value measurements.

Methods Documentation

static estimate_run_time_batch(circuits=None, precomputed_durations=None, n_qpus=5, **transpilation_kwargs)[source]

Estimate the execution time of a quantum circuit on a given backend, accounting for parallel gate execution.

Parameters:
  • circuits (Sequence[str] | None) – The quantum circuits to estimate execution time for, as QASM strings.

  • precomputed_durations (Sequence[float] | None) – A list of precomputed durations to use.

  • n_qpus (int) – Number of QPU nodes in the pre-supposed cluster we are estimating runtime against.

Returns:

Estimated execution time in seconds.

Return type:

float

static estimate_run_time_single_circuit(circuit, qiskit_backend, **transpilation_kwargs)[source]

Estimate the execution time of a quantum circuit on a given backend, accounting for parallel gate execution.

Parameters:
  • circuit (str) – The quantum circuit to estimate execution time for as a QASM string.

  • qiskit_backend (BackendV2 | Literal['auto']) – A Qiskit backend to use for gate time estimation.

Returns:

Estimated execution time in seconds.

Return type:

float

set_seed(seed)[source]

Set the random seed for circuit simulation.

Parameters:

seed (int) – Seed value for the random number generator used in simulation.

submit_circuits(circuits, *, ham_ops=None, circuit_ham_map=None, shot_groups=None, cancellation_event=None, **kwargs)[source]

Submit multiple circuits for parallel simulation using Qiskit’s built-in parallelism.

Parameters:
  • circuits (Mapping[str, str]) – Dictionary mapping circuit labels to OpenQASM string representations.

  • ham_ops (str | None) – Semicolon-separated Pauli string for expectation value estimation, e.g. "ZI;IZ;XX". Multiple groups can be pipe-delimited when circuit_ham_map is provided. If None, runs in sampling mode.

  • circuit_ham_map (list[list[int]] | None) – Each entry is [start, end) mapping a |-group in ham_ops to a contiguous slice of circuits.

  • shot_groups (list[list[int]] | None) – Per-circuit shot allocation as [start, end, shots] triples covering the iteration order of circuits. When provided, overrides self.shots for each contiguous range and triggers one aer_simulator.run call per range. Sampling-mode only — ignored when ham_ops is provided.

  • cancellation_event (Event | None) – When set before this call, aborts dispatch. Aer’s .run().result() cannot be interrupted mid-batch.

  • **kwargs – Additional parameters (unused, accepted for interface compatibility).

Return type:

ExecutionResult

Returns:

ExecutionResult containing either counts (sampling) or expectation values.