I am trying to run simulation instances of a parametrized circuit in parallel but my algorithm is extremely slow. Excuse my ignorance, but I just want to be sure that the circuits are indeed running in parallel.
Here is my execution workflow:
backend = Aer.get_backend('statevector_simulator', max_parallel_threads=N_threads, max_parallel_experiments=N_threads, optimization_level=3, precision="single") parametrized_circuits = CreateCircuits() transpiled = transpile(parametrized_circuits, backend=backend) experiments =  for i in range(N): experiments.append(transpiled[i].assign_parameters(a)) job = execute(experiments, backend=backend, optimization_level=0)
So, my first question
1. Is the structure efficient? E.g. Are the circuits transpiled only once? Or does
execute re-transpile them? (I have read this function is just a wrapper for
When I run my experiments in a
12-core node, most cores seem to be under-utilized (atmost 10%, some even lower), while the experiment taking ages to complete. I have also read this question regarding reordering. My results come out with the same order as if the circuits were simulated serially, which makes me even more suspicious.
2. Are my circuits really running in parallel? Is there something I miss?
transpiled = transpile(parametrized_circuits, backend=backend)is unnecessary.
executewill transpile on a bind circuited, which is much more efficient. The rumours are true,
executefunction is just a wrapper for
optimization_levelis not a backend option. You can checkout the backend options with