Big performance regression with new `FermionicOp`
See original GitHub issueI am using this code:
from qiskit_nature.drivers import PySCFDriver, UnitsType
from qiskit_nature.problems.second_quantization.electronic.builders.fermionic_op_builder import build_ferm_op_from_ints
from qiskit_nature.operators.second_quantization import FermionicOp
h2o = "O 0.0 0.0 0.0;H 0.757 0.586 0.0;H -0.757 0.586 0.0"
h2 = 'H .0 .0 0.7414; H .0 .0 .0'
lih = 'Li .0 .0 0.7414; H .0 .0 .0'
basis0 = "sto3g"
basis1 = "631g"
def get_molecule():
driver = PySCFDriver(atom=h2o,
unit=UnitsType.ANGSTROM,
charge=0,
spin=0,
basis=basis0)
molecule = driver.run()
return molecule
def get_qkn_op(molecule):
one_body = molecule.one_body_integrals
two_body = molecule.two_body_integrals
fop_qkn = build_ferm_op_from_ints(one_body, two_body)
return fop_qkn
molecule = get_molecule()
Then, after the change of internals, with a0f4c7bb , I get this:
%time fop = get_qkn_op(molecule)
CPU times: user 12.2 s, sys: 58.4 ms, total: 12.3 s
Wall time: 4.87 s
However, before the rewrite of internals 9f75adc, I get this:
%time fop = get_qkn_op(molecule)
CPU times: user 316 ms, sys: 1.83 ms, total: 317 ms
Wall time: 318 ms
If I use basis1
(631g) above, then the time before the change is 4s. The time after the change is longer than several minutes; I killed the process.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
qiskit-nature - bytemeta
Implement xyz chemistry file generator. · Big performance regression with new `FermionicOp` · `FermionicOp.set_label_display_mode` affects construction of ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s slow because it’s converting between dense and sparse. It’s true that my implementation was rushed and very bad. There are a lot of unnecessary conversions, so I thought I would fix the conversions when I delete Legacy.
@mrossinek . I did not identify the first release that introduces the regression. I assumed it was the introduction of the new structure.