Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

10x factor in run time between master and stable #1457

Open
yaelbh opened this issue Nov 25, 2020 · 5 comments
Open

10x factor in run time between master and stable #1457

yaelbh opened this issue Nov 25, 2020 · 5 comments

Comments

@yaelbh
Copy link
Contributor

yaelbh commented Nov 25, 2020

Information

  • Qiskit Aqua version: master, stable
  • Python version: 3.6.8
  • Operating system: Linux

What is the current behavior?

Running QAOA with the master branch takes 10 times longer than the stable branch.

Steps to reproduce the problem

from time import time
from qiskit.providers.aer import QasmSimulator
from qiskit.optimization import QuadraticProgram
from qiskit.optimization.algorithms import MinimumEigenOptimizer
from qiskit.aqua.algorithms import QAOA
from qiskit.aqua.components.optimizers import SLSQP
from qiskit.aqua import QuantumInstance, aqua_globals

qubo = QuadraticProgram()
qubo.binary_var('x1')
qubo.binary_var('x2')
qubo.binary_var('x3')
qubo.binary_var('x4')
qubo.binary_var('x5')
qubo.binary_var('x6')
qubo.binary_var('x7')
qubo.binary_var('x8')
qubo.binary_var('x9')
qubo.binary_var('x10')
qubo.binary_var('x11')
qubo.binary_var('x12')
qubo.binary_var('x13')
qubo.binary_var('x14')
qubo.binary_var('x15')
qubo.binary_var('x16')
qubo.binary_var('x17')
qubo.binary_var('x18')
qubo.binary_var('x19')
qubo.binary_var('x20')

qubo.minimize(linear=[1,-2,3,-6,5,4,4,5,5,5,6,6,0.3,6,6,-2,-2,-2,-2,-2], 
              quadratic={('x1', 'x2'): 1, ('x1', 'x3'): -1, ('x1', 'x4'): 2, 
                                            ('x2' , 'x3'): 1, ('x2', 'x4'): 6, ('x3', 'x5'): 3,
                                            ('x4', 'x6'): 3, ('x7', 'x8'): -1, ('x7', 'x9'): -1, ('x8', 'x10'): -1,
                                            ('x11', 'x12'): 3, ('x13', 'x14'): -1, ('x10', 'x13'): -1, ('x12', 'x15'): -1,
                                            ('x11', 'x16'): 3, ('x13', 'x17'): -1, ('x18', 'x13'): -1, ('x19', 'x20'): -1 
                        })


seed = 10698
sim = QasmSimulator()
            
aqua_globals.random_seed = seed
quantum_instance = QuantumInstance(sim, seed_simulator=seed, seed_transpiler=seed)

slsqp = SLSQP()
slsqp.set_options(maxiter=500)

start = time()    
qaoa_mes = QAOA(quantum_instance=quantum_instance, include_custom=True, optimizer=slsqp, p=3)
qaoa = MinimumEigenOptimizer(qaoa_mes)
qaoa_result = qaoa.solve(qubo)
print('Run time:', time()-start)

Output of machine: 345 seconds with master, 38 seconds with stable.

Suggested solutions

Maybe compare transpilation times.

@ikkoham
Copy link
Contributor

ikkoham commented Nov 25, 2020

Is this Aqua's issue? (Which did you use Terra master or Terra stable?)

Perhaps, Qiskit/qiskit#5429 Qiskit/qiskit#5431 may be related.
These are recently found performance problems.

@yaelbh
Copy link
Contributor Author

yaelbh commented Nov 25, 2020

I used master branches of Aqua, Aer, and Terra. Compared to stable branches of all three.

@ikkoham
Copy link
Contributor

ikkoham commented Nov 26, 2020

I have checked this. My environment is master and stable/0.8 of Aqua, and master of Terra and Aer for both.

227s (stable/0.8) -> 27s (master)
27s (stable/0.8) ->227s (master)

stable
image
master
image

@yaelbh
Copy link
Contributor Author

yaelbh commented Nov 26, 2020

This is opposite to my findings...

@ikkoham
Copy link
Contributor

ikkoham commented Nov 26, 2020

Ah sorry my mistake (I wrote opposite)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants