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:
CircuitRunnerA 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 viadepth_historyafter execution. Defaults to False.force_sampling (
bool) – If True, always use shot-based sampling even for expectation value measurements. Defaults to False.
Attributes Summary
Whether the backend executes circuits asynchronously.
Get the current number of parallel processes.
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:
- 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:
- Returns:
Estimated execution time in seconds.
- Return type:
- 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.
- 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 whencircuit_ham_mapis provided. If None, runs in sampling mode.circuit_ham_map (
list[list[int]] |None) – Each entry is[start, end)mapping a|-group inham_opsto a contiguous slice of circuits.shot_groups (
list[list[int]] |None) – Per-circuit shot allocation as[start, end, shots]triples covering the iteration order ofcircuits. When provided, overridesself.shotsfor each contiguous range and triggers oneaer_simulator.runcall per range. Sampling-mode only — ignored whenham_opsis 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:
- Returns:
ExecutionResult containing either counts (sampling) or expectation values.