Rigetti Computing Unveils pyQuil 4.0: New Version Integrates Rust Language.

Rigetti Computing Unveils Pyquil 4.0: New Version Integrates Rust Language.

Rigetti Computing has updated its pyQuil software, which is used for building and running quantum programs on Rigetti’s quantum processing units. The update integrates the software with the company’s Rust libraries, improving performance and type safety. The changes were made without compromising the design of the existing Rust libraries or introducing significant changes to the pyQuil user experience. The update also allows pyQuil to compile and run programs on Rigetti’s next-generation Ankaa systems. The work was led by Marquess Valdez, a senior software engineer at Rigetti.

“pyQuil has long been the cornerstone for building and running quantum programs on Rigetti quantum processing units (QPUs) through our Quantum Cloud Services (QCS™) platform. It’s an essential client library for us. However, as we’ve advanced the QCS platform, we’ve reached more and more towards Rust for its performance, type system, and emphasis on correctness.”

Marquess Valdez, Senior Software Engineer

Introduction to pyQuil® 4.0: Python and Rust Integration

Rigetti Computing, a quantum computing company, has been using pyQuil as the foundation for building and running quantum programs on their Quantum Processing Units (QPUs) through their Quantum Cloud Services (QCS™) platform. As the QCS platform advanced, the company increasingly turned to Rust for its performance, type system, and emphasis on correctness. This led to the development of a growing ecosystem of Rust tools and services, which eventually superseded much of the functionality in pyQuil.

The Role of Rust in Rigetti’s Ecosystem

Rust has proven to be an ideal candidate for bridging the gap between Rigetti’s services and users of high-level languages like Python, or low-level ones like C. The company has spent the last year retrofitting pyQuil with their modern Rust SDKs, bringing the benefits of Rust to users in a transparent way. This foundational change to pyQuil has brought enhancements needed to compile and run programs on Rigetti’s fourth-generation QPUs.

Challenges and Breakthroughs in Integrating Rust with Python

The integration of Rust SDKs with pyQuil had two primary goals: to build Python packages on top of existing Rust libraries without compromising their design, and to incorporate these packages into pyQuil while minimizing breaking changes to existing APIs and behaviors. This process involved building a separate crate with Rust bindings for a Python package, using the PyO3 crate as the framework of choice.

The Role of rigetti-pyo3 in Reducing Boilerplate

Rigetti developed an open-source library, rigetti-pyo3, to extend the capabilities of pyo3. This library introduced traits and macros that drastically reduced the boilerplate required to wrap external Rust types. It also ensured that every binding implemented common functionality in the same way, making the Python API more consistent.

Retrofitting pyQuil with Rust Libraries

Retrofitting pyQuil with Rust libraries posed unique challenges due to the differences in their approaches to solving common problems. The company had to ensure that they didn’t compromise the quality of either library while integrating them. This process involved adding new features from Rust libraries into pyQuil, backporting necessary functionality from pyQuil to Rust libraries, and meeting the expectations of pyQuil’s existing API without compromising the API provided by Rust SDKs.

The Async Conundrum and Its Solution

One of the challenges faced during the integration was the lack of support for asyncio in pyQuil. Rigetti developed a macro that provided both synchronous and asynchronous variants of a single async function, allowing users to continue to support a synchronous API while also providing an asynchronous one.

The Payoffs: Functionality and Performance

The integration of Python and Rust in pyQuil v4 brought several benefits. It enhanced the functionality of pyQuil, making it compatible with Rigetti’s next-generation Ankaa systems. It also improved the performance of pyQuil, particularly in parsing and serializing Quil programs, which are key steps in the compile-and-execute workflow.

Quick Conclusion

The integration of Python and Rust for pyQuil v4 presented many challenges but ultimately led to the modernization of pyQuil. It provided users with Rust’s performance and type safety benefits while maintaining the familiarity and ease of use of Python.

“We are still committed to supporting Python and pyQuil, so we have spent the last year retrofitting pyQuil with our modern Rust SDKs. This foundational change to pyQuil brings the benefits of Rust to users in a transparent way, and brings the enhancements needed to compile and run programs on Rigetti’s fourth generation QPUs.”

Marquess Valdez, Senior Software Engineer

“rigetti-pyo3 has proved to be an invaluable framework for building Python packages on top of an external Rust crate. It has enabled us to build a seamless integration between our Rust libraries and a Python counterpart, without making sacrifices in the design of either.”

Marquess Valdez, Senior Software Engineer

“Being able to continue to support a synchronous API while not missing out on the opportunity to provide an asynchronous one is a huge win for us, and a good example of how combining Rust with Python can bring benefits not easily achieved with Python alone.”

Marquess Valdez, Senior Software Engineer

“Through these efforts, we’ve modernized pyQuil, providing users with the performance and type safety benefits of Rust while maintaining the familiarity and ease of use of Python.”

Marquess Valdez, Senior Software Engineer

Quick Summary

Rigetti Computing has updated its quantum programming tool, pyQuil, integrating it with Rust libraries to enhance performance and functionality. The upgrade allows users to compile and run programs on Rigetti’s next-generation Ankaa systems, while maintaining the ease of use of Python and offering significant performance gains in areas such as parsing and serialising Quil programs.

  • Rigetti Computing has updated its pyQuil software, which is used for building and running quantum programs on Rigetti’s quantum processing units (QPUs).
  • The update integrates the software with Rust, a programming language known for its performance and emphasis on correctness. This integration allows for better performance and type safety.
  • The company has managed to maintain the ease of use and familiarity of Python, the language pyQuil is based on, while also incorporating the benefits of Rust.
  • The update also brings enhancements needed to compile and run programs on Rigetti’s fourth-generation QPUs.
  • The integration faced challenges, such as meeting the expectations of longtime pyQuil users without introducing breaking changes and building on top of existing Rust libraries without compromising their design.
  • The update was carried out by Marquess Valdez, a Senior Software Engineer at Rigetti Computing.