- Notifications
You must be signed in to change notification settings - Fork45
A JIT compiler for hybrid quantum programs in PennyLane
License
PennyLaneAI/catalyst
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Catalyst is an experimental package that enables just-in-time (JIT) compilation of hybridquantum-classical programs.
Catalyst is currently under heavy development — if you have suggestions on the API or use-casesyou'd like to be covered, please open an GitHub issue or reach out. We'd love to hear about howyou're using the library, collaborate on development, or integrate additional devices andfrontends.
Compile the entire quantum-classical workflow, including any optimization loops.
Use Catalyst alongside PennyLane directly from Python. Simply decorate quantum code and hybridfunctions with
@qjit
, leading to significant performance improvements over standard Pythonexecution.Access advanced control flow that supports both quantum and classical instructions.
Infrastructure for both quantumand classical compilation, allowing you to compile quantumcircuits that contain control flow.
Built to be end-to-end differentiable.
Support forPennyLane-Lightning high performancesimulators, andAmazon Braketdevices. Additional hardware support, including QPUs, to come.
Catalyst currently consists of the following components:
The core Catalyst compiler is built usingMLIR, with the addition of aquantum dialect used to represent quantum instructions. This allows for a high-level intermediaterepresentation of the classical and quantum components of the program, resulting in advantagesduring optimization. Once optimized, the compiler lowers the representation down to LLVM +QIR, and a machine binary is produced.
The runtime is a C++ runtime with multiple-device support based on QIR that enables the executionof Catalyst-compiled quantum programs. A complete list of all backend devices along with the quantuminstruction set supported by these runtime implementations can be found by visitingthe runtime documentation.
In addition, we also provide a Python frontend forPennyLane andJAX:
A Python library that provides a
@qjit
decorator to just-in-time compile PennyLane hybridquantum-classical programs. In addition, the frontend package provides Python functions fordefining Catalyst-compatible control flow structures, gradient, and mid-circuit measurement.
Catalyst is officially supported on Linux (x86_64, aarch64) and macOS (arm64, x86_64) platforms,and pre-built binaries are being distributed via the Python Package Index (PyPI) for Python versions 3.10 andhigher. To install it, simply run the followingpip
command:
pip install pennylane-catalyst
If you wish to contribute to Catalyst or develop against our runtime or compiler, instructions forbuilding from sourceare also available.
To get started using the Catalyst JIT compiler from Python, check out ourquick startguide, as well as ourvarious examples and tutorials in ourdocumentation.
For an introduction to quantum computing and quantum machine learning, you can also visit thePennyLane website fortutorials, videos, and demonstrations.
Frontend: As we continue to build out Catalyst, the PennyLane frontend will likely beupstreamed into PennyLane proper, providing native JIT functionality built-in to PennyLane. TheCatalyst compiler and runtime will remain part of the Catalyst project.If you are interested inworking on additional frontends for Catalyst, please get in touch.
Compiler: We will continue to build out the compiler stack, and add quantum compilationroutines. This includes an API for providing or writing Catalyst-compatible compilation routines.In addition, we will be improving the autodifferentiation support, and adding support forclassical autodiff, additional quantum gradients, and quantum-aware optimization methods.
Runtime: We will be adding support for more devices, including quantum hardware devices. Inaddition, we will be building out support for hetereogeneous execution.If you are interested inworking on connecting a quantum device with Catalyst, please get in touch.
To get the details right, we need your help — please send us your use cases by starting aconversation, or trying Catalyst out.
We welcome contributions — simply fork the Catalyst repository, and then make apullrequest containing your contribution.
We also encourage bug reports, suggestions for new features and enhancements.
- Source Code:https://github.com/PennyLaneAI/catalyst
- Issue Tracker:https://github.com/PennyLaneAI/catalyst/issues
If you are having issues, please let us know by posting the issue on our GitHub issue tracker.
We also have aPennyLane discussion forum—come join the communityand chat with the PennyLane team.
Note that we are committed to providing a friendly, safe, and welcoming environment for all. Pleaseread and respect theCode of Conduct.
Catalyst is the work ofmany contributors.
If you are doing research using Catalyst, please cite our paper:
@article{ Ittah2024,doi ={10.21105/joss.06720},url ={https://doi.org/10.21105/joss.06720},year ={2024},publisher ={The Open Journal},volume ={9},number ={99},pages ={6720},author ={David Ittah and Ali Asadi and Erick Ochoa Lopez and Sergei Mironov and Samuel Banning and Romain Moyard and Mai Jacob Peng and Josh Izaac},title ={Catalyst: a Python JIT compiler for auto-differentiable hybrid quantum programs},journal ={Journal of Open Source Software}}
Catalyst isfree andopen source, released under the Apache License, Version 2.0.
Catalyst makes use of the following libraries and tools, which are under their own respectivelicenses:
About
A JIT compiler for hybrid quantum programs in PennyLane