qiskit-aer
qiskit-aer copied to clipboard
Shot branching optimization for multi-shots simulations
Summary
This PR is implementation of optimization for multi-shots simulations with operations with randomness (measure, reset, initialize, kraus or noise sampling)
Details and comments
Starting from 1 state, the simulation branches state into some states caused by randomness of the operation. Simulation time will be decreased when the number of the final branched states is smaller than number of shots.
To implement this optimization, I moved qreg
and creg
into Register
class and most of the functions of State
class takes reference to the Register
so that each function can handle Register
class independently to manage multiple branched states.
I implemented run_shots
function in State
class that simulates multiple shots with or without shot branching optimization and also batched execution for GPU.
Here is performance measurements of shot branching using QFT circuits with 1% of Kraus noise (1000 shots) Since there are so many branches in noise simulation, the effect of this implementation is limited. Smaller noise ratio, larger qubits and larger number of shots will improve performance for this test case. I think shot branching has more advantage in simulating circuits with intermediate measurements. (smaller number of branches)