Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Hamiltonian Simulation benchmark implementation #25

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

raynelfss
Copy link
Collaborator

@raynelfss raynelfss commented Jul 26, 2022

This branch implements the Hamiltonian Simulation of the Heisenberg Model with disordered fields as a benchmark. Worked with @Yelissal on this.

@raynelfss
Copy link
Collaborator Author

Results from running on my Windows machine:

                                                                Benchmark: Hamiltonian Simulation
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃ Name                                              ┃ Min           ┃ Max           ┃ Mean          ┃ depth      ┃ size        ┃ xi            ┃ fidelity        ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
│ qiskit (Optimization level: 2 on fake_rochester)  │ 0.2465 (1.85) │ 0.2831 (1.38) │ 0.265 (1.63)  │ 68 (1.0)   │ 297 (1.0)   │ 0.436 (3.20)  │ 0.02507 (19.80) │
│ qiskit (Optimization level: 2 on fake_cairo)      │ 0.2277 (1.71) │ 0.2768 (1.35) │ 0.2515 (1.55) │ 89 (1.31)  │ 465 (1.57)  │ 0.2757 (2.02) │ 0.3641 (287.48) │
│ qiskit (Optimization level: 2 on fake_montreal)   │ 0.2342 (1.76) │ 0.2584 (1.26) │ 0.2467 (1.52) │ 89 (1.31)  │ 465 (1.57)  │ 0.2757 (2.02) │ 0.3725 (294.12) │
│ qiskit (Optimization level: 3 on fake_guadalupe)  │ 0.5712 (4.30) │ 0.8613 (4.21) │ 0.6695 (4.12) │ 80 (1.18)  │ 420 (1.41)  │ 0.2476 (1.82) │ 0.3204 (253.00) │
│ qiskit (Optimization level: 3 on fake_toronto)    │ 0.6068 (4.56) │ 0.8868 (4.33) │ 0.6995 (4.31) │ 80 (1.18)  │ 420 (1.41)  │ 0.2476 (1.82) │ 0.008377 (6.61) │
│ qiskit (Optimization level: 3 on fake_cairo)      │ 0.5439 (4.09) │ 0.6473 (3.16) │ 0.599 (3.69)  │ 80 (1.18)  │ 420 (1.41)  │ 0.2476 (1.82) │ 0.413 (326.10)  │
│ qiskit (Optimization level: 3 on fake_melbourne)  │ 1.093 (8.22)  │ 1.242 (6.07)  │ 1.187 (7.31)  │ 80 (1.18)  │ 429 (1.44)  │ 0.2993 (2.20) │ 0.05186 (40.95) │
│ qiskit (Optimization level: 3 on fake_montreal)   │ 0.6194 (4.66) │ 0.7304 (3.57) │ 0.6551 (4.04) │ 80 (1.18)  │ 420 (1.41)  │ 0.2476 (1.82) │ 0.4306 (340.00) │
│ qiskit (Optimization level: 0 on fake_melbourne)  │ 0.2402 (1.81) │ 0.2605 (1.27) │ 0.2498 (1.54) │ 250 (3.68) │ 915 (3.08)  │ 0.1985 (1.46) │ 0.04521 (35.70) │
│ qiskit (Optimization level: 2 on fake_brooklyn)   │ 0.2828 (2.13) │ 0.3826 (1.87) │ 0.321 (1.98)  │ 89 (1.31)  │ 465 (1.57)  │ 0.2757 (2.02) │ 0.2951 (233.04) │
│ qiskit (Optimization level: 1 on fake_toronto)    │ 0.3863 (2.91) │ 0.4311 (2.11) │ 0.4059 (2.50) │ 89 (1.31)  │ 465 (1.57)  │ 0.2757 (2.02) │ 0.00647 (5.11)  │
│ qiskit (Optimization level: 0 on fake_toronto)    │ 0.2136 (1.61) │ 0.2735 (1.34) │ 0.2338 (1.44) │ 352 (5.18) │ 1122 (3.78) │ 0.2828 (2.08) │ 0.001266 (1.0)  │
│ qiskit (Optimization level: 2 on fake_toronto)    │ 0.4549 (3.42) │ 0.5043 (2.46) │ 0.4874 (3.00) │ 89 (1.31)  │ 465 (1.57)  │ 0.2757 (2.02) │ 0.00647 (5.11)  │
│ qiskit (Optimization level: 0 on fake_cairo)      │ 0.213 (1.60)  │ 0.278 (1.36)  │ 0.238 (1.47)  │ 352 (5.18) │ 1122 (3.78) │ 0.2828 (2.08) │ 0.04327 (34.17) │
│ qiskit (Optimization level: 1 on fake_montreal)   │ 0.3417 (2.57) │ 0.5036 (2.46) │ 0.4196 (2.58) │ 89 (1.31)  │ 465 (1.57)  │ 0.2757 (2.02) │ 0.3725 (294.12) │
│ qiskit (Optimization level: 1 on fake_melbourne)  │ 0.3479 (2.62) │ 0.446 (2.18)  │ 0.3914 (2.41) │ 80 (1.18)  │ 351 (1.18)  │ 0.3673 (2.70) │ 0.04541 (35.86) │
│ qiskit (Optimization level: 1 on fake_washington) │ 0.3281 (2.47) │ 0.4031 (1.97) │ 0.3754 (2.31) │ 89 (1.31)  │ 465 (1.57)  │ 0.2757 (2.02) │ 0.07028 (55.49) │
│ qiskit (Optimization level: 3 on fake_brooklyn)   │ 0.9115 (6.86) │ 1.206 (5.89)  │ 1.015 (6.25)  │ 80 (1.18)  │ 420 (1.41)  │ 0.2476 (1.82) │ 0.356 (281.06)  │
│ qiskit (Optimization level: 2 on fake_washington) │ 0.6062 (4.56) │ 0.7094 (3.46) │ 0.6733 (4.15) │ 89 (1.31)  │ 465 (1.57)  │ 0.2757 (2.02) │ 0.3945 (311.51) │
│ qiskit (Optimization level: 2 on fake_melbourne)  │ 0.6996 (5.26) │ 0.7032 (3.43) │ 0.7014 (4.32) │ 80 (1.18)  │ 351 (1.18)  │ 0.3673 (2.70) │ 0.04541 (35.86) │
│ qiskit (Optimization level: 3 on fake_rochester)  │ 0.8876 (6.68) │ 1.226 (5.99)  │ 1.002 (6.17)  │ 68 (1.0)   │ 297 (1.0)   │ 0.436 (3.20)  │ 0.02507 (19.80) │
│ qiskit (Optimization level: 1 on fake_rochester)  │ 0.4119 (3.10) │ 0.4645 (2.27) │ 0.441 (2.72)  │ 68 (1.0)   │ 297 (1.0)   │ 0.436 (3.20)  │ 0.02507 (19.80) │
│ qiskit (Optimization level: 1 on fake_guadalupe)  │ 0.2272 (1.71) │ 0.2934 (1.43) │ 0.2633 (1.62) │ 89 (1.31)  │ 465 (1.57)  │ 0.2757 (2.02) │ 0.2496 (197.08) │
│ qiskit (Optimization level: 1 on fake_brooklyn)   │ 0.2348 (1.77) │ 0.3689 (1.80) │ 0.318 (1.96)  │ 89 (1.31)  │ 465 (1.57)  │ 0.2757 (2.02) │ 0.137 (108.19)  │
│ qiskit (Optimization level: 0 on fake_montreal)   │ 0.942 (7.09)  │ 1.5 (7.32)    │ 1.127 (6.95)  │ 352 (5.18) │ 1122 (3.78) │ 0.2828 (2.08) │ 0.06958 (54.94) │
│ qiskit (Optimization level: 3 on fake_washington) │ 0.6952 (5.23) │ 1.615 (7.89)  │ 1.141 (7.03)  │ 80 (1.18)  │ 420 (1.41)  │ 0.2476 (1.82) │ 0.4693 (370.59) │
│ qiskit (Optimization level: 1 on fake_cairo)      │ 0.2385 (1.79) │ 0.3038 (1.48) │ 0.2747 (1.69) │ 89 (1.31)  │ 465 (1.57)  │ 0.2757 (2.02) │ 0.3641 (287.48) │
│ qiskit (Optimization level: 0 on fake_guadalupe)  │ 0.8656 (6.51) │ 1.089 (5.32)  │ 0.9764 (6.01) │ 338 (4.97) │ 1098 (3.70) │ 0.267 (1.96)  │ 0.04883 (38.55) │
│ qiskit (Optimization level: 0 on fake_brooklyn)   │ 0.1608 (1.21) │ 0.221 (1.08)  │ 0.1953 (1.20) │ 158 (2.32) │ 933 (3.14)  │ 0.1362 (1.0)  │ 0.1334 (105.30) │
│ qiskit (Optimization level: 0 on fake_washington) │ 0.1329 (1.0)  │ 0.2048 (1.0)  │ 0.1623 (1.0)  │ 158 (2.32) │ 933 (3.14)  │ 0.1362 (1.0)  │ 0.06825 (53.89) │
│ qiskit (Optimization level: 2 on fake_guadalupe)  │ 0.6662 (5.01) │ 1.001 (4.89)  │ 0.8338 (5.14) │ 89 (1.31)  │ 465 (1.57)  │ 0.2757 (2.02) │ 0.2496 (197.08) │
│ qiskit (Optimization level: 0 on fake_rochester)  │ 0.4723 (3.55) │ 0.6176 (3.02) │ 0.545 (3.36)  │ 164 (2.41) │ 699 (2.35)  │ 0.4689 (3.44) │ 0.007324 (5.78) │
└───────────────────────────────────────────────────┴───────────────┴───────────────┴───────────────┴────────────┴─────────────┴───────────────┴─────────────────┘


                                                                TLDR
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ Name                                              ┃ Mean         ┃               ┃               ┃              ┃                ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ qiskit (Optimization level: 0 on fake_brooklyn)   │ 1 (1.20)     │ 1 (2.32)      │ 1 (3.14)      │ 1 (1.0)      │ 1 (105.30)     │
│ qiskit (Optimization level: 0 on fake_cairo)      │ 1.219 (1.47) │ 2.228 (5.18)  │ 1.203 (3.78)  │ 2.076 (2.08) │ 0.3245 (34.17) │
│ qiskit (Optimization level: 0 on fake_guadalupe)  │ 5 (6.01)     │ 2.139 (4.97)  │ 1.177 (3.70)  │ 1.96 (1.96)  │ 0.3661 (38.55) │
│ qiskit (Optimization level: 0 on fake_melbourne)  │ 1.279 (1.54) │ 1.582 (3.68)  │ 0.9807 (3.08) │ 1.457 (1.46) │ 0.339 (35.70)  │
│ qiskit (Optimization level: 0 on fake_montreal)   │ 5.774 (6.95) │ 2.228 (5.18)  │ 1.203 (3.78)  │ 2.076 (2.08) │ 0.5217 (54.94) │
│ qiskit (Optimization level: 0 on fake_rochester)  │ 2.791 (3.36) │ 1.038 (2.41)  │ 0.7492 (2.35) │ 3.442 (3.44) │ 0.05492 (5.78) │
│ qiskit (Optimization level: 0 on fake_toronto)    │ 1.197 (1.44) │ 2.228 (5.18)  │ 1.203 (3.78)  │ 2.076 (2.08) │ 0.009497 (1.0) │
│ qiskit (Optimization level: 0 on fake_washington) │ 0.8313 (1.0) │ 1 (2.32)      │ 1 (3.14)      │ 1 (1.0)      │ 0.5118 (53.89) │
│ qiskit (Optimization level: 1 on fake_brooklyn)   │ 1.628 (1.96) │ 0.5633 (1.31) │ 0.4984 (1.57) │ 2.024 (2.02) │ 1.027 (108.19) │
│ qiskit (Optimization level: 1 on fake_cairo)      │ 1.407 (1.69) │ 0.5633 (1.31) │ 0.4984 (1.57) │ 2.024 (2.02) │ 2.73 (287.48)  │
│ qiskit (Optimization level: 1 on fake_guadalupe)  │ 1.348 (1.62) │ 0.5633 (1.31) │ 0.4984 (1.57) │ 2.024 (2.02) │ 1.872 (197.08) │
│ qiskit (Optimization level: 1 on fake_melbourne)  │ 2.004 (2.41) │ 0.5063 (1.18) │ 0.3762 (1.18) │ 2.697 (2.70) │ 0.3405 (35.86) │
│ qiskit (Optimization level: 1 on fake_montreal)   │ 2.149 (2.58) │ 0.5633 (1.31) │ 0.4984 (1.57) │ 2.024 (2.02) │ 2.793 (294.12) │
│ qiskit (Optimization level: 1 on fake_rochester)  │ 2.258 (2.72) │ 0.4304 (1.0)  │ 0.3183 (1.0)  │ 3.201 (3.20) │ 0.188 (19.80)  │
│ qiskit (Optimization level: 1 on fake_toronto)    │ 2.079 (2.50) │ 0.5633 (1.31) │ 0.4984 (1.57) │ 2.024 (2.02) │ 0.04851 (5.11) │
│ qiskit (Optimization level: 1 on fake_washington) │ 1.923 (2.31) │ 0.5633 (1.31) │ 0.4984 (1.57) │ 2.024 (2.02) │ 0.527 (55.49)  │
│ qiskit (Optimization level: 2 on fake_brooklyn)   │ 1.644 (1.98) │ 0.5633 (1.31) │ 0.4984 (1.57) │ 2.024 (2.02) │ 2.213 (233.04) │
│ qiskit (Optimization level: 2 on fake_cairo)      │ 1.288 (1.55) │ 0.5633 (1.31) │ 0.4984 (1.57) │ 2.024 (2.02) │ 2.73 (287.48)  │
│ qiskit (Optimization level: 2 on fake_guadalupe)  │ 4.27 (5.14)  │ 0.5633 (1.31) │ 0.4984 (1.57) │ 2.024 (2.02) │ 1.872 (197.08) │
│ qiskit (Optimization level: 2 on fake_melbourne)  │ 3.592 (4.32) │ 0.5063 (1.18) │ 0.3762 (1.18) │ 2.697 (2.70) │ 0.3405 (35.86) │
│ qiskit (Optimization level: 2 on fake_montreal)   │ 1.263 (1.52) │ 0.5633 (1.31) │ 0.4984 (1.57) │ 2.024 (2.02) │ 2.793 (294.12) │
│ qiskit (Optimization level: 2 on fake_rochester)  │ 1.357 (1.63) │ 0.4304 (1.0)  │ 0.3183 (1.0)  │ 3.201 (3.20) │ 0.188 (19.80)  │
│ qiskit (Optimization level: 2 on fake_toronto)    │ 2.496 (3.00) │ 0.5633 (1.31) │ 0.4984 (1.57) │ 2.024 (2.02) │ 0.04851 (5.11) │
│ qiskit (Optimization level: 2 on fake_washington) │ 3.448 (4.15) │ 0.5633 (1.31) │ 0.4984 (1.57) │ 2.024 (2.02) │ 2.958 (311.51) │
│ qiskit (Optimization level: 3 on fake_brooklyn)   │ 5.199 (6.25) │ 0.5063 (1.18) │ 0.4502 (1.41) │ 1.817 (1.82) │ 2.669 (281.06) │
│ qiskit (Optimization level: 3 on fake_cairo)      │ 3.068 (3.69) │ 0.5063 (1.18) │ 0.4502 (1.41) │ 1.817 (1.82) │ 3.097 (326.10) │
│ qiskit (Optimization level: 3 on fake_guadalupe)  │ 3.429 (4.12) │ 0.5063 (1.18) │ 0.4502 (1.41) │ 1.817 (1.82) │ 2.403 (253.00) │
│ qiskit (Optimization level: 3 on fake_melbourne)  │ 6.076 (7.31) │ 0.5063 (1.18) │ 0.4598 (1.44) │ 2.197 (2.20) │ 0.3889 (40.95) │
│ qiskit (Optimization level: 3 on fake_montreal)   │ 3.355 (4.04) │ 0.5063 (1.18) │ 0.4502 (1.41) │ 1.817 (1.82) │ 3.229 (340.00) │
│ qiskit (Optimization level: 3 on fake_rochester)  │ 5.13 (6.17)  │ 0.4304 (1.0)  │ 0.3183 (1.0)  │ 3.201 (3.20) │ 0.188 (19.80)  │
│ qiskit (Optimization level: 3 on fake_toronto)    │ 3.582 (4.31) │ 0.5063 (1.18) │ 0.4502 (1.41) │ 1.817 (1.82) │ 0.06281 (6.61) │
│ qiskit (Optimization level: 3 on fake_washington) │ 5.842 (7.03) │ 0.5063 (1.18) │ 0.4502 (1.41) │ 1.817 (1.82) │ 3.519 (370.59) │
└───────────────────────────────────────────────────┴──────────────┴───────────────┴───────────────┴──────────────┴────────────────┘

@raynelfss raynelfss reopened this Jul 26, 2022
@mtreinish mtreinish requested a review from danielleodigie July 29, 2022 16:00
Co-authored-by: danielleodigie <[email protected]>
Copy link
Collaborator

@danielleodigie danielleodigie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! YASSSSS

Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this LGTM, just a few minor inline comments I'm also curious if we need custom gate generators when I think there are equivalent (although maybe not exactly the same) gates in the circuit library.

red_queen/games/applications/run_hamiltonian_sim.py Outdated Show resolved Hide resolved
red_queen/games/applications/run_hamiltonian_sim.py Outdated Show resolved Hide resolved
red_queen/games/applications/run_hamiltonian_sim.py Outdated Show resolved Hide resolved
red_queen/games/applications/run_hamiltonian_sim.py Outdated Show resolved Hide resolved
red_queen/games/applications/run_hamiltonian_sim.py Outdated Show resolved Hide resolved
red_queen/games/applications/run_hamiltonian_sim.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Lementknight Lementknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just ran your benchmark on my machine and it worked. Great job, Ray!

Copy link
Collaborator

@danielleodigie danielleodigie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, benchmark runs :)

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ raynelfss
❌ Raynel Sanchez


Raynel Sanchez seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Successfully merging this pull request may close these issues.

5 participants