-
Notifications
You must be signed in to change notification settings - Fork 604
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
Replace NetworkX by RetworkX #1791
Conversation
…o add_retworkx_support
…o add_retworkx_support
…o add_retworkx_support
…o add_retworkx_support
Hello. You may have forgotten to update the changelog!
|
@maliasadi can I ask the status of this PR? Is it mainly a prototype that can be closed, or is it still WIP? |
Hey @josh146. To replace all the use cases of NetworkX with RetworkX, we need some functionalities that is planned to be added to the next release of RetworkX. So, we were waiting for the next release indeed. We can close the PR and open it again when we have every pieces of the puzzle. |
Codecov Report
@@ Coverage Diff @@
## master #1791 +/- ##
=======================================
Coverage 99.17% 99.17%
=======================================
Files 225 225
Lines 17204 17284 +80
=======================================
+ Hits 17062 17142 +80
Misses 142 142
Continue to review full report at Codecov.
|
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.
Wonderful work @maliasadi!
Very happy to approve conditional on updating the changelog to add an entry on this change.
Do you have any benchmark plots on using PL before/after this change?
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.
Heroic effort @maliasadi ! Great work on this.
I agree with @josh146's comments, and added some small rec's in there.
@@ -18,7 +18,7 @@ | |||
# pylint: disable=too-many-branches,too-many-arguments,too-many-instance-attributes | |||
from collections import Counter, OrderedDict, namedtuple | |||
|
|||
import networkx as nx | |||
import retworkx as rx |
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.
💯
Thank you @josh146 for the great suggestions!
Currently, I have benchmarks comparing NX vs. RX methods used in PL: |
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.
Thanks @maliasadi, happy to approve! 💪
Currently, I have benchmarks comparing NX vs. RX methods used in PL
These benchmarks look great 😍
I have one request: do you think you would be able to quickly benchmark a more user-facing workflow? For example:
-
the resulting speedup for computing cost and mixer hamiltonians in the QAOA module
-
resulting speedup when computing something like the
metric_tensor
, for a circuit with a lot of layers (internally, the metric tensor computes a DAG in order to identify the 'layers' of a circuit).
More user-facing benchmarks would be super helpful, as it allows us to advertise the practical effects of this change next release 🙂
Co-authored-by: Josh Izaac <josh146@gmail.com>
I collected results for test cases in Regarding QAOA routines, they are not using any advanced graph routines, and so, there shouldn't be significant speedup by using RX over NX. However, building graphs in RX is much faster and optimizer than NX (check here for benchmarks) and so there are big improvements on the execution-time of QAOA examples. In |
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.
Comments look good to me @maliasadi! And thanks for the additional benchmarking :)
Context:
In CircuitGraph, replace NetworkX (NX) by RetworkX (RX) and add RX support to QAOA in PennyLane.
Description of the Change:
RX is written in Rust providing a general purpose graph library. This library pursues to offer functionalities similar to what NX offers but with much faster performance. Pennylane uses NX to implement circuit graphs and QAOA with many use cases in the entire library. This PR replaces NX by RX and investigates the performance of RX in Pennylane.
Benefits:
Using RX instead of NX, PennyLane can take advantage of
Benchmarks:
Check here