question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Big performance regression with new `FermionicOp`

See original GitHub issue

I 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:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
ikkohamcommented, Jun 16, 2021

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.

1reaction
jlapeyrecommented, Jun 16, 2021

@mrossinek . I did not identify the first release that introduces the regression. I assumed it was the introduction of the new structure.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found