Nothing Special   »   [go: up one dir, main page]

skip to main content
research-article

Extending C++ for Heterogeneous Quantum-Classical Computing

Published: 09 July 2021 Publication History

Abstract

We present qcor—a language extension to C++ and compiler implementation that enables heterogeneous quantum-classical programming, compilation, and execution in a single-source context. Our work provides a first-of-its-kind C++ compiler enabling high-level quantum kernel (function) expression in a quantum-language agnostic manner, as well as a hardware-agnostic, retargetable compiler workflow targeting a number of physical and virtual quantum computing backends. qcor leverages novel Clang plugin interfaces and builds upon the XACC system-level quantum programming framework to provide a state-of-the-art integration mechanism for quantum-classical compilation that leverages the best from the community at-large. qcor translates quantum kernels ultimately to the XACC intermediate representation, and provides user-extensible hooks for quantum compilation routines like circuit optimization, analysis, and placement. This work details the overall architecture and compiler workflow for qcor, and provides a number of illuminating programming examples demonstrating its utility for near-term variational tasks, quantum algorithm expression, and feed-forward error correction schemes.

References

[1]
Aksel Alpay and Vincent Heuveline. 2020. SYCL beyond OpenCL: The architecture, current state and future direction of HipSYCL. In Proceedings of the International Workshop on OpenCL (IWOCL’20). Association for Computing Machinery, New York, NY.
[2]
Matthew Amy and Vlad Gheorghiu. 2019. staq—A full-stack quantum processing toolkit. arXiv:1912.06070. Retrieved from https://arxiv.org/abs/1912.06070.
[3]
Matthias Anlauff. 2000. XASM - An extensible, component-based ASM language. In Proceedings of the International Workshop on Abstract State Machines, Theory and Applications, 69–90.
[4]
Sergey Bravyi, Martin Suchara, and Alexander Vargo. 2014. Efficient algorithms for maximum likelihood decoding in the surface code. Phys. Rev. A 90, 3 (Sep. 2014).
[5]
Cirq Contributors. 2020. Cirq. Retrieved from https://github.com/quantumlib/Cirq.
[6]
CppMicroServices. 2020. CppMicroServices. Retrieved August 28, 2020 from https://github.com/CppMicroServices/CppMicroServices.
[7]
E. F. Dumitrescu, A. J. McCaskey, G. Hagen, G. R. Jansen, T. D. Morris, T. Papenbrock, R. C. Pooser, D. J. Dean, and P. Lougovski. 2018. Cloud quantum computing of an atomic nucleus. Phys. Rev. Lett. 120, 21 (May 2018), 210501.
[8]
H. Carter Edwards, Christian R. Trott, and Daniel Sunderland. 2014. Kokkos: Enabling manycore performance portability through polymorphic memory access patterns. J. Parallel Distrib. Comput. 74, 12 (2014), 3202–3216.
[9]
Austin G. Fowler et al.2012. Surface codes: Towards practical large-scale quantum computation. Phys. Rev. A 86, 3 (2012).
[10]
Ali Javadi-Abhari et al.2014. ScaffCC: A framework for compilation and analysis of quantum computing programs. In Proceedings of the 11th ACM Conference on Computing Frontiers (CF’14).
[11]
Abhinav Kandala et al.2017. Hardware-efficient variational quantum eigensolver for small molecules and quantum magnets. Nature 549 (Sep. 2017), 242.
[12]
Alberto Peruzzo et al.2014. A variational eigenvalue solver on a photonic quantum processor. Nat. Commun. 5, 4213 (Jul. 2014), 1–7.
[13]
Andrew W. Cross et al.2017. Open Quantum Assembly Language. arXiv:1707.03429. Retrieved from https://arxiv.org/abs/1707.03429.
[14]
Benjamin C. A. Morrison et al.2020. JaqalPaq. Retrieved from https://gitlab.com/jaqal/jaqalpaq.
[15]
Benjamin C. A. Morrison et al.2020. Just another quantum assembly language (Jaqal). arXiv:quant-ph/2008.08042. Retrieved from https://arxiv.org/abs/2008.08042.
[16]
Ciyou Zhu et al.1997. Algorithm 778: L-BFGS-B: Fortran subroutines for large-scale bound-constrained optimization. ACM Trans. Math. Softw. 23, 4 (Dec. 1997), 550–560.
[17]
D. A. Beckingsale et al.2019. RAJA: Portable performance for large-scale scientific applications. In Proceedings of the 2019 IEEE/ACM International Workshop on Performance, Portability and Productivity in HPC (P3HPC’19). 71–81.
[18]
Edward Farhi et al.2000. Quantum computation by adiabatic evolution. arXiv:quant-ph/0001106. Retrieved from https://arxiv.org/abs/quant-ph/0001106.
[19]
Ed Younis et al.2020. QFAST: Quantum synthesis using a hierarchical continuous circuit space. arXiv:2003.04462. Retrieved from https://arxiv.org/abs/2003.04462.
[20]
Gadi Aleksandrowicz et al.2019. Qiskit: An Open-source Framework for Quantum Computing.
[21]
Gaël Guennebaud et al.2010. Eigen v3. Retreived from http://eigen.tuxfamily.org.
[22]
Harper R. Grimsley et al.2019. An adaptive variational algorithm for exact molecular simulations on a quantum computer. Nat. Commun. 10, 1 (08 Jul. 2019), 3007.
[23]
John Nickolls et al.2008. Scalable parallel programming with CUDA. Queue 6, 2 (Mar. 2008), 40–53.
[24]
Kesha Hietala et al.2021. A verified optimizer for quantum circuits. Proc. ACM Program. Lang. 5, Article 37 (Jan. 2021), 29 pages. https://doi.org/10.1145/3434318
[25]
Krysta Svore et al.2018. Q#: Enabling scalable quantum computing and development with a high-level DSL. In Proceedings of the Real World Domain Specific Languages Workshop 2018 (RWDSL’18). Association for Computing Machinery, New York, NY, Article 7, 10 pages.
[26]
Peter Canning et al.1989. F-bounded polymorphism for object-oriented programming. In Proceedings of the 4th International Conference on Functional Programming Languages and Computer Architecture, 273–280.
[27]
Peter J. Karalekas et al.2020. A quantum-classical cloud platform optimized for variational hybrid algorithms. Quant. Sci. Technol. 5, 2 (Apr. 2020), 024003.
[28]
Prakash Murali et al.2019. Noise-adaptive compiler mappings for noisy intermediate-scale quantum computers. In Proceedings of the 24th International Conference on Architectural Support for Programming Languages and Operating Systems. 1015–1029.
[29]
Ryan LaRose et al.2020. Mitiq: A software package for error mitigation on noisy quantum computers. arXiv:2009.04417. Retrieved from https://arxiv.org/abs/2009.04417.
[30]
Tudor Giurgica-Tiron et al.2020. Digital zero noise extrapolation for quantum error mitigation. In Proceedings of the 2020 IEEE International Conference on Quantum Computing and Engineering (QCE’20). 306–316.
[31]
H. Finkel, A. McCaskey, T. Popoola, D. Lyakh, and J. Doerfert. 2020. Really embedding domain-specific languages into C++. In Proceedings of the 2020 IEEE/ACM 6th Workshop on the LLVM Compiler Infrastructure in HPC (LLVM-HPC) and Workshop on Hierarchical Parallelism for Exascale Computing (HiPar’20). 65–73.
[32]
Austin G. Fowler. 2015. Minimum weight perfect matching of fault-tolerant topological quantum error correction in average O (1) parallel time. Quant. Inf. Comput. 15, 1–2 (2015), 145–158. https://dl.acm.org/doi/10.5555/2685188.2685197
[33]
Kathleen E. Hamilton, Eugene F. Dumitrescu, and Raphael C. Pooser. 2019. Generative model benchmarks for superconducting qubits. Phys. Rev. A 99, 6 (Jun. 2019), 062323.
[34]
Diederik P. Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv:1412.6980. Retrieved from https://arxiv.org/abs/1412.6980.
[35]
N. Klco, E. F. Dumitrescu, A. J. McCaskey, T. D. Morris, R. C. Pooser, M. Sanz, E. Solano, P. Lougovski, and M. J. Savage. 2018. Quantum-classical computation of Schwinger model dynamics using quantum computers. Phys. Rev. A 98, 3 (Sep. 2018), 032331.
[36]
Chris Lattner and Vikram Adve. 2004. LLVM: A compilation framework for lifelong program analysis & transformation. In Proceedings of the International Symposium on Code Generation and Optimization: Feedback-directed and Runtime Optimization. IEEE Computer Society, 75.
[37]
Gushu Li, Yufei Ding, and Yuan Xie. 2019. Tackling the qubit mapping problem for NISQ-era quantum devices. In Proceedings of the 24th International Conference on Architectural Support for Programming Languages and Operating Systems. 1001–1014.
[38]
Dave Marples and Peter Kriens. 2002. The open services gateway initiative: An introductory overview. IEEE Commun. Mag. 39, 12 (Jan. 2002), 110–114.
[39]
Alexander J. McCaskey, Dmitry I. Lyakh, Eugene F. Dumitrescu, Sarah S. Powers, and Travis S. Humble. 2020. XACC: A system-level software infrastructure for heterogeneous quantum–classical computing. Quant. Sci. Technol. 5, 2 (Feb. 2020), 024002.
[40]
Alexander J. McCaskey, Zachary P. Parks, Jacek Jakowski, Shirley V. Moore, Titus D. Morris, Travis S. Humble, and Raphael C. Pooser. 2019. Quantum chemistry as a benchmark for near-term quantum computers. npj Quant. Inf. 5, 1 (2019), 99.
[41]
Tiffany M. Mintz, Alexander J. Mccaskey, Eugene F. Dumitrescu, Shirley V. Moore, Sarah Powers, and Pavel Lougovski. 2019. QCOR: A language extension specification for the heterogeneous quantum-classical model of computation. arXiv:1909.02457. Retrieved from https://arxiv.org/abs/1909.02457.
[42]
mitiq. 2020. mitiq. Retrieved September 2, 2020 from https://github.com/unitaryfund/mitiq.
[43]
M. J. D. Powell. 1998. Direct search algorithms for optimization calculations. Acta Numer. 7 (Jan. 1998), 287–336.
[44]
Robert S. Smith, Michael J. Curtis, and William J. Zeng. 2017. A practical quantum instruction set architecture. arXiv:1608.03355. Retrieved from https://arxiv.org/abs/1608.03355.
[45]
Damian S. Steiger, Thomas Häner, and Matthias Troyer. 2018. ProjectQ: An open source software framework for quantum computing. Quantum 2 (Jan. 2018), 49.
[46]
Damian S. Steiger, Thomas Häner, and Matthias Troyer. 2019. Advantages of a modular high-level quantum programming framework. Microprocess. Microsyst. 66 (2019), 81–89.
[47]
Linghua Zhu, Ho Lun. Tang, George S. Barron, Nicholas J. Mayhall, Edwin Barnes, and Sophia E. Economou. 2020. An adaptive quantum approximate optimization algorithm for solving combinatorial problems on a quantum computer. arXiv:2005.10258. Retrieved from https://arxiv.org/abs/2005.10258.
[48]
Alwin Zulehner, Alexandru Paler, and Robert Wille. 2018. An efficient methodology for mapping quantum circuits to the IBM QX architectures. IEEE Trans. Comput.-Aid. Des. Integr. Circ. Syst. 38, 7 (2018), 1226–1236.

Cited By

View all
  • (2024)Distributed Quantum Computing for Chemical Applications2024 IEEE International Conference on Quantum Computing and Engineering (QCE)10.1109/QCE60285.2024.10270(155-160)Online publication date: 15-Sep-2024
  • (2024)Integration of Quantum Accelerators into HPC: Toward a Unified Quantum Platform2024 IEEE International Conference on Quantum Computing and Engineering (QCE)10.1109/QCE60285.2024.00097(774-783)Online publication date: 15-Sep-2024
  • (2024)A pragma based C++ framework for hybrid quantum/classical computationScience of Computer Programming10.1016/j.scico.2024.103119236(103119)Online publication date: Sep-2024
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Transactions on Quantum Computing
ACM Transactions on Quantum Computing  Volume 2, Issue 2
June 2021
107 pages
EISSN:2643-6817
DOI:10.1145/3474586
Issue’s Table of Contents
Publication rights licensed to ACM. ACM acknowledges that this contribution was authored or co-authored by an employee, contractor or affiliate of the United States government. As such, the Government retains a nonexclusive, royalty-free right to publish or reproduce this article, or to allow others to do so, for Government purposes only.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 09 July 2021
Accepted: 01 April 2021
Revised: 01 March 2021
Received: 01 October 2020
Published in TQC Volume 2, Issue 2

Check for updates

Author Tags

  1. Quantum computing
  2. compilers
  3. domain specific languages
  4. quantum programming

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

  • US Department of Energy
  • DOE Office of Science User Facility

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)83
  • Downloads (Last 6 weeks)2
Reflects downloads up to 16 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Distributed Quantum Computing for Chemical Applications2024 IEEE International Conference on Quantum Computing and Engineering (QCE)10.1109/QCE60285.2024.10270(155-160)Online publication date: 15-Sep-2024
  • (2024)Integration of Quantum Accelerators into HPC: Toward a Unified Quantum Platform2024 IEEE International Conference on Quantum Computing and Engineering (QCE)10.1109/QCE60285.2024.00097(774-783)Online publication date: 15-Sep-2024
  • (2024)A pragma based C++ framework for hybrid quantum/classical computationScience of Computer Programming10.1016/j.scico.2024.103119236(103119)Online publication date: Sep-2024
  • (2024)Quantum-centric supercomputing for materials scienceFuture Generation Computer Systems10.1016/j.future.2024.04.060160:C(666-710)Online publication date: 1-Nov-2024
  • (2024)QFaaSFuture Generation Computer Systems10.1016/j.future.2024.01.018154:C(281-300)Online publication date: 25-Jun-2024
  • (2023)Quantum Computing with Differentiable Quantum TransformsACM Transactions on Quantum Computing10.1145/35926224:3(1-20)Online publication date: 26-Jun-2023
  • (2023)isQ: An Integrated Software Stack for Quantum ProgrammingIEEE Transactions on Quantum Engineering10.1109/TQE.2023.32758684(1-16)Online publication date: 2023
  • (2022)Extending Python for Quantum-classical Computing via Quantum Just-in-time CompilationACM Transactions on Quantum Computing10.1145/35444963:4(1-25)Online publication date: 27-Jul-2022
  • (2022)qprof: A gprof-Inspired Quantum ProfilerACM Transactions on Quantum Computing10.1145/35293984:1(1-28)Online publication date: 21-Oct-2022
  • (2022)OpenQASM 3: A Broader and Deeper Quantum Assembly LanguageACM Transactions on Quantum Computing10.1145/35056363:3(1-50)Online publication date: 6-Sep-2022
  • Show More Cited By

View Options

Login options

Full Access

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

HTML Format

View this article in HTML Format.

HTML Format

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media