-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ffsim simulator backend #90
Conversation
@kevinsung this looks really interesting, but it would seem that you are still working on it? Just tell me when it is ready for review. |
@fretchen it's ready for review. |
"coupling_map": None, | ||
"description": "ffsim simulator for fermionic circuits. Instead of qubits, each wire represents" | ||
" a single fermionic mode", | ||
"supported_instructions": None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to add here the gates that are allowed in terms of strings. This makes it accessible to the user via backend.configuration().supported_instructions. Then it is also clear that the X,Y,Z gate are not allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this from the other simulator backend. I'm not sure what it should be set to because arbitrary FermionicGates are supported, but those don't have a name. I also noticed that other simulators, like in Qiskit Aer, don't set this property. Perhaps we should just leave it as is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI I added supported for the FR{X,Y,Z}Gates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really interesting and looks like something that will be certainly very interesting to users. Thx. However, I have few comments:
- A simple pip install of ffsim failed as I did not yet have rust cargo. So I would recommend a short section in the
README.md
on installation with ffsim - Do we agree that it would be nice to make this a standard dependency once the windows install works ?
- So this should be mentioned in the readme as a bit special
- I had a number of questions concerning the notebook. Most importantly, it would be nice to make it clearer what you are simulating there and what is going on. I will add a commented notebook at the suited place.
- Could you say a bit more about the occupation etc that you are setting up ?
- We once again need a Reno file (could contain most of the description of the PR).
I added the other comments directly at the specific parts in the code.
Regarding |
What Daniel said is correct. ffsim can't support Windows because it depends on pySCF, which doesn't support Windows. |
Fermion spin charge sep
@fretchen As we discussed, I have merged my notebook into the existing introduction notebook and also added the notebook you made via pull request. Please take another look at this PR. |
Summary
Adds a simulator backend based on ffsim. For supported circuits, the simulator is orders of magnitude faster than the existing FermionSimulator backend. I made the ffsim dependency optional because it is not supported on Windows.
Benchmark results
I wrote some benchmarks and ran them using asv, but then removed them in 2b7a1a1 so they wouldn't be included in this PR (I can add them back if desired). Using my laptop, I tried running benchmarks at system sizes of up to 16 spatial orbitals at half filling, setting a time limit of 10,000 seconds.
One benchmark used the Hop, Interaction, and Phase gates, which ffsim has special functions for. ffsim completed the simulations for all system sizes, while FermionSimulator failed at 8 orbitals, half filling. At that size, ffsim was at least 400,000 times faster. The speedup is probably greater at larger system sizes.
FermionSimulator:
ffsim:
Another benchmark used the FermiHubbard gate, which requires exponentiating a fermionic generator. Here, ffsim failed at 16 orbitals, half filling, and FermionSimulator again failed at 8 orbitals, half filling. At that size, ffsim was at least 750 times faster. There's an open issue at ffsim which, if resolved, would significantly improve its efficiency for this benchmark.
FermionSimulator:
ffsim: