-
Notifications
You must be signed in to change notification settings - Fork 400
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Informations
- **Qiskit Aer version0.8:
- **Python version3.8:
- Operating system:
What is the current behavior?
Loading circuits from input takes very long time when multiple experiments are given.
So the simulation time can not be improved well when using GPU to accelerate.
Steps to reproduce the problem
Here is an example for multiple experiments.
import numpy as np
from qiskit import *
from qiskit.circuit.library import *
from qiskit import QuantumCircuit
from qiskit.providers.aer import *
qubit = 14
num_circ = 100
circs = []
for i in range(num_circ):
circ = RealAmplitudes(qubit, reps=5)
param_binds = {}
for param in circ.parameters:
param_binds[param] = np.random.random()
circ = circ.bind_parameters(param_binds)
circ.measure_all()
circs.append(circ)
sim = AerSimulator(method='statevector')
sim_gpu = AerSimulator(method='statevector', device='GPU')
shots = 100
result = execute(circs,sim,shots=shots,seed_simulator=12345,_parallel_experiments=100).result()
#print(result)
print(result.to_dict()['backend_name'])
print("overall time = {0}".format(result.to_dict()['time_taken']))
sim_time = []
for i in range(num_circ):
sim_time.append(result.to_dict()['results'][i]['time_taken'])
print("simulation time = {0}".format(sum(sim_time)/result.to_dict()['metadata']['parallel_experiments']))
and here is a result. (Power9)
aer_simulator_statevector
overall time = 1.5974977016448975
simulation time = 0.10323703751999998
Simulation time takes only 0.1 sec but most of time is taken to load circuit in Qobj
constructor.
What is the expected behavior?
Currently is seems loading circuit from json is not thread safe and can not be parallelized.
We need to parallelize to speedup this.
Suggested solutions
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request