I'm kinda new to qiskit and I find really fascinating its parallelization capabilities, then I'm trying to creating all the needed circuits for my application at once and transpile, assemble and execute them all at once using the execute method.
Basically,
qcircuits = []
# construct my circuits and append to qcircuits
# ...
backend: backend: BaseBackend = qiskit.Aer.get_backend('qasm_simulator')
n_shots = 1024
job = qiskit.execute(
qcircuits,
backend,
optimization_level=optimization_level,
shots=n_shots
)
counts = job.result().get_counts()
Nevertheless, I noticed that the job.result().get_couts()
output is not deterministic as, I guess, it runs all the circuits using a parallel_map
and appends in the returned list in the order they finish. Is there any way to force the execute
method respecting the order of qcircuits
? If it is not the case, is there any way to label the execution results so that I can sort them myself afterwards ?
Thanks in advance.
jobs = [qiskit.execute(qcircuit, backend, ...) for qcircuit in qcircuits]
followed bycounts = [job.result().get_counts() for job in jobs]
, but obviously, this isn't ideal for large numbers of circuits. $\endgroup$