Skip to main content

A JIT compiler for hybrid quantum programs in PennyLane

Project description

Tests Coverage Documentation DOI PyPI Forum License Dev Container

Catalyst is an experimental package that enables just-in-time (JIT) compilation of hybrid quantum-classical programs.

Catalyst is currently under heavy development — if you have suggestions on the API or use-cases you'd like to be covered, please open an GitHub issue or reach out. We'd love to hear about how you're using the library, collaborate on development, or integrate additional devices and frontends.

Key Features

  • Compile the entire quantum-classical workflow, including any optimization loops.

  • Use Catalyst alongside PennyLane directly from Python. Simply decorate quantum code and hybrid functions with @qjit, leading to significant performance improvements over standard Python execution.

  • Access advanced control flow that supports both quantum and classical instructions.

  • Infrastructure for both quantum and classical compilation, allowing you to compile quantum circuits that contain control flow.

  • Built to be end-to-end differentiable.

  • Support for PennyLane-Lightning high performance simulators, and Amazon Braket devices. Additional hardware support, including QPUs, to come.

Overview

Catalyst currently consists of the following components:

  • Catalyst Compiler.

    The core Catalyst compiler is built using MLIR, with the addition of a quantum dialect used to represent quantum instructions. This allows for a high-level intermediate representation of the classical and quantum components of the program, resulting in advantages during optimization. Once optimized, the compiler lowers the representation down to LLVM + QIR, and a machine binary is produced.

  • Catalyst Runtime.

    The runtime is a C++ runtime with multiple-device support based on QIR that enables the execution of Catalyst-compiled quantum programs. A complete list of all backend devices along with the quantum instruction set supported by these runtime implementations can be found by visiting the runtime documentation.

In addition, we also provide a Python frontend for PennyLane and JAX:

  • PennyLane JAX frontend.

    A Python library that provides a @qjit decorator to just-in-time compile PennyLane hybrid quantum-classical programs. In addition, the frontend package provides Python functions for defining Catalyst-compatible control flow structures, gradient, and mid-circuit measurement.

Installation

Catalyst is officially supported on Linux (aarch64/arm64, x86_64) and macOS (aarch64/arm64, x86_64) platforms, and pre-built binaries are being distributed via the Python Package Index (PyPI) for Python versions 3.10 and higher. To install it, simply run the following pip command:

pip install pennylane-catalyst

Pre-built packages for Windows are not yet available, and comptability with Windows is untested and cannot be guaranteed. If you are using one of these platforms, please try out our Docker and Dev Container images described in the documentation or click this button:

Dev Container.

If you wish to contribute to Catalyst or develop against our runtime or compiler, instructions for building from source are also available.

Trying Catalyst with PennyLane

To get started using the Catalyst JIT compiler from Python, check out our quick start guide, as well as our various examples and tutorials in our documentation.

For an introduction to quantum computing and quantum machine learning, you can also visit the PennyLane website for tutorials, videos, and demonstrations.

Roadmap

  • Frontend: As we continue to build out Catalyst, the PennyLane frontend will likely be upstreamed into PennyLane proper, providing native JIT functionality built-in to PennyLane. The Catalyst compiler and runtime will remain part of the Catalyst project. If you are interested in working on additional frontends for Catalyst, please get in touch.

  • Compiler: We will continue to build out the compiler stack, and add quantum compilation routines. This includes an API for providing or writing Catalyst-compatible compilation routines. In addition, we will be improving the autodifferentiation support, and adding support for classical autodiff, additional quantum gradients, and quantum-aware optimization methods.

  • Runtime: We will be adding support for more devices, including quantum hardware devices. In addition, we will be building out support for hetereogeneous execution. If you are interested in working 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 a conversation, or trying Catalyst out.

Contributing to Catalyst

We welcome contributions — simply fork the Catalyst repository, and then make a pull request containing your contribution.

We also encourage bug reports, suggestions for new features and enhancements.

Support

If you are having issues, please let us know by posting the issue on our GitHub issue tracker.

We also have a PennyLane discussion forum—come join the community and chat with the PennyLane team.

Note that we are committed to providing a friendly, safe, and welcoming environment for all. Please read and respect the Code of Conduct.

Authors

Catalyst is the work of many 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}
} 

License

Catalyst is free and open source, released under the Apache License, Version 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

PennyLane_Catalyst-0.9.0-cp312-cp312-manylinux_2_28_x86_64.whl (66.3 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ x86-64

PennyLane_Catalyst-0.9.0-cp312-cp312-manylinux_2_28_aarch64.whl (65.4 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ ARM64

PennyLane_Catalyst-0.9.0-cp312-cp312-macosx_13_0_x86_64.whl (62.7 MB view details)

Uploaded CPython 3.12 macOS 13.0+ x86-64

PennyLane_Catalyst-0.9.0-cp312-cp312-macosx_13_0_arm64.whl (54.8 MB view details)

Uploaded CPython 3.12 macOS 13.0+ ARM64

PennyLane_Catalyst-0.9.0-cp311-cp311-manylinux_2_28_x86_64.whl (66.3 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

PennyLane_Catalyst-0.9.0-cp311-cp311-manylinux_2_28_aarch64.whl (65.4 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ ARM64

PennyLane_Catalyst-0.9.0-cp311-cp311-macosx_13_0_x86_64.whl (62.7 MB view details)

Uploaded CPython 3.11 macOS 13.0+ x86-64

PennyLane_Catalyst-0.9.0-cp311-cp311-macosx_13_0_arm64.whl (54.8 MB view details)

Uploaded CPython 3.11 macOS 13.0+ ARM64

PennyLane_Catalyst-0.9.0-cp310-cp310-manylinux_2_28_x86_64.whl (66.3 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

PennyLane_Catalyst-0.9.0-cp310-cp310-manylinux_2_28_aarch64.whl (65.4 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ ARM64

PennyLane_Catalyst-0.9.0-cp310-cp310-macosx_13_0_x86_64.whl (62.6 MB view details)

Uploaded CPython 3.10 macOS 13.0+ x86-64

PennyLane_Catalyst-0.9.0-cp310-cp310-macosx_13_0_arm64.whl (54.8 MB view details)

Uploaded CPython 3.10 macOS 13.0+ ARM64

File details

Details for the file PennyLane_Catalyst-0.9.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for PennyLane_Catalyst-0.9.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 60cb9af071b340dbe7270cccb54d9222600a740e792206b161dc2b0798c5f8a8
MD5 838ff040cf2c0e230b027c94eaaa6ab2
BLAKE2b-256 a4a680446f818892db729607077c79424b9d6d49a399339ea989a2b9fe374378

See more details on using hashes here.

File details

Details for the file PennyLane_Catalyst-0.9.0-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for PennyLane_Catalyst-0.9.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5171a9ea08d1690a1124fc1a87c56c1e77a033c596c41a6fbbfaa864f6ef2aee
MD5 14458f1c5c27f874395c9bca2b9490e0
BLAKE2b-256 a2b5bcbec56c508f7c6c25a8a35410fae95ef7e33b7a9c993ebd30195862a7e7

See more details on using hashes here.

File details

Details for the file PennyLane_Catalyst-0.9.0-cp312-cp312-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for PennyLane_Catalyst-0.9.0-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 56cabe79df7c97d7f2df7c981bd84ff52a18d3ebc02cc328847b092082d889f5
MD5 d67aaf9d59c823742a0c532a091a569b
BLAKE2b-256 136cc10ccf140535038aeb3054af667262a3d5d912016899123a9fc696d5b730

See more details on using hashes here.

File details

Details for the file PennyLane_Catalyst-0.9.0-cp312-cp312-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for PennyLane_Catalyst-0.9.0-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 86d87b4a01ce2f64d0c6e449dd87bd07b9eb060047a8a49f3191bff02a68c0a0
MD5 c9fb3f58702c7552386ad3128eda0da1
BLAKE2b-256 2df13c67fba0374da19c31fac44b5f7276eb5b9a517561ae36df8565c2c4e490

See more details on using hashes here.

File details

Details for the file PennyLane_Catalyst-0.9.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for PennyLane_Catalyst-0.9.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2ec0c811bf65509430da190fbfb7bdb6ccdbad18de9cd45f4cd77aa567edc48b
MD5 ae40df88e4f43133613e542c98438329
BLAKE2b-256 e0d0841b5d2bc30b38b2bd69125512307ac9974d440d8b8df963b405d73ac2d6

See more details on using hashes here.

File details

Details for the file PennyLane_Catalyst-0.9.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for PennyLane_Catalyst-0.9.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3a9bd87ce684cc7e9229260839df46566b8e458725537f9ec9bdce2d383963f9
MD5 47f2d8c301434658c26f4a029423da3f
BLAKE2b-256 439ae5ed5b4da5a33b8e4c516a384f92b65da49d2b99609c5ffa4fd40efb15b7

See more details on using hashes here.

File details

Details for the file PennyLane_Catalyst-0.9.0-cp311-cp311-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for PennyLane_Catalyst-0.9.0-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 2a3ae980d47f7ca70cdef95c7f24033b22cd442a6ebaa046fbbb3cfc75ae7695
MD5 59fd0b56ce37c56e805f5d5ce36b7600
BLAKE2b-256 7612805ac2e6d90479408b25da7dbca8a8fa67ddb135d143c95ceef0975169a8

See more details on using hashes here.

File details

Details for the file PennyLane_Catalyst-0.9.0-cp311-cp311-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for PennyLane_Catalyst-0.9.0-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 ab3788a7e1579bfca13e1a483f49dbd4631e4fe1a42ab58d38c1da5f801ce55c
MD5 68d2bf490c2474b23d8b3d4ff8d86aaf
BLAKE2b-256 8325694ac0ad2c10fa6c9ed01f66d98f345b278bfd6a66cc056cb30d7cbf1bd8

See more details on using hashes here.

File details

Details for the file PennyLane_Catalyst-0.9.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for PennyLane_Catalyst-0.9.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 768e4b976a79ac9bcd8e96526dab0fdcffdf7a293b60c92f0326a4b0004a6c7b
MD5 6cdd8b3ae4c0e79562c013c8665c504b
BLAKE2b-256 9322ec399992f9266ac00e075e8e4ddd701c7afaacd771e52e49439abea50425

See more details on using hashes here.

File details

Details for the file PennyLane_Catalyst-0.9.0-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for PennyLane_Catalyst-0.9.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0f21b9779882a92d189689f9e82b0b4ccff2f6a449bb6d642ffba4fe4c33dc9f
MD5 0cb1502013aafd90e2ee20807053a634
BLAKE2b-256 960d6177c209bcfdb65da5a9136b478681ee38ae9d58692c2a0f6b0b8288fc68

See more details on using hashes here.

File details

Details for the file PennyLane_Catalyst-0.9.0-cp310-cp310-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for PennyLane_Catalyst-0.9.0-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 2954e3666556434ab87c1fca1b73bf68bbf1997bbe49f64cd74c6703e8c14a9d
MD5 356994b2541c143a77072cd7519980c9
BLAKE2b-256 ba5355e4e8ce38aa98677a3e1b57d850bdaebe376c05acaaac6acbdc27965021

See more details on using hashes here.

File details

Details for the file PennyLane_Catalyst-0.9.0-cp310-cp310-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for PennyLane_Catalyst-0.9.0-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 d75986c75fcd7ac8762d83822dac998f6afa8d90131096d3855354f5593c97f7
MD5 0c656aa01e772ad58277b71b5675cd0b
BLAKE2b-256 5adcb3b8ae9bd13afcdad7f26a3b8e85b49dc8cb58da34eb4568f7bf571072f6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page