Skip to main content

A JIT compiler for hybrid quantum programs in PennyLane

Project description

Tests Coverage Documentation 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 the Lightning high performance simulator. Additional hardware support, including GPUs and 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 based on QIR that enables the execution of Catalyst-compiled quantum programs. Currently, a runtime implementation is available for the state-vector simulators Lightning. A complete list of the quantum instruction set supported by these runtime implementations can be found by visiting the Catalyst 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 (x86_64) platforms, and pre-built binaries are being distributed via the Python Package Index (PyPI) for Python versions 3.8 and higher. To install it, simply run the following pip command:

pip install pennylane-catalyst

Pre-built packages for Windows and MacOS are not yet available, and comptability with those platforms 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 GitHub repo.

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

File details

Details for the file pennylane_catalyst-0.2.1-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pennylane_catalyst-0.2.1-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3bb60d3c4d691c887bb8c5cda7cdff363fd8ac450c746b0ed81ab70166e90a3d
MD5 eecd296fdea96603b228b9e64146bd84
BLAKE2b-256 d18ed48b87889ad0187ff1495306c785c75f85002a8b5efe027013f567c3fad9

See more details on using hashes here.

File details

Details for the file pennylane_catalyst-0.2.1-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pennylane_catalyst-0.2.1-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b2a59eddf799f6b4938a0b9881e8f972dc83b3da8c0aec07e27926fb13df3c47
MD5 bcee5c140218bed6c70c04aab4e9e934
BLAKE2b-256 57ac8aa94e3c0afa14b2d6aca4301d1953239469295f2fe3eac0bdb9367143fb

See more details on using hashes here.

File details

Details for the file pennylane_catalyst-0.2.1-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pennylane_catalyst-0.2.1-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d6e6ff8ccbe29956eb108ba501b352faafb03e813cbf056fc015c67cc8dc723f
MD5 adb5db3ab31610fa1dedb76c9c95788f
BLAKE2b-256 dc1f11f2cb09664303a028c839d0be52f1ed718142a790ef2a8ca5d2617ce604

See more details on using hashes here.

File details

Details for the file pennylane_catalyst-0.2.1-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pennylane_catalyst-0.2.1-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 89f42a28fd40b119debe0cc1756726b4ab39bf26da088c1089ace65e48f1ac08
MD5 5889b341e382e9d98814fd0e870a538e
BLAKE2b-256 40359b3240e98488ef8a23418e371601e92b04fccf7ea730973ff2b8c99b31b9

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