Quantum simulation with just-in-time compilation
1Quantum Research Centre, Technology Innovation Institute, Abu Dhabi, UAE.
2TIF Lab, Dipartimento di Fisica, Università degli Studi di Milano and INFN Sezione di Milano, Milan, Italy.
3CERN, Theoretical Physics Department, CH-1211 Geneva 23, Switzerland.
| Published: | 2022-09-22, volume 6, page 814 |
| Eprint: | arXiv:2203.08826v2 |
| Doi: | https://doi.org/10.22331/q-2022-09-22-814 |
| Citation: | Quantum 6, 814 (2022). |
Find this paper interesting or want to discuss? Scite or leave a comment on SciRate.
Abstract
Quantum technologies are moving towards the development of novel hardware devices based on quantum bits (qubits). In parallel to the development of quantum devices, efficient simulation tools are needed in order to design and benchmark quantum algorithms and applications before deployment on quantum hardware. In this context, we present a first attempt to perform circuit-based quantum simulation using the just-in-time (JIT) compilation technique on multiple hardware architectures and configurations based on single-node central processing units (CPUs) and graphics processing units (GPUs). One of the major challenges in scientific code development is to balance the level of complexity between algorithms and programming techniques without losing performance or degrading code readability. In this context, we have developed $\texttt{qibojit}$: a new module for the Qibo quantum computing framework, which uses a just-in-time compilation approach through Python. We perform systematic performance benchmarks between our JIT approach and a subset of relevant publicly available libraries for quantum computing. We show that our novel approach simplifies the complex aspects of the implementation without deteriorating performance.

Featured image: The software framework layout and performance benchmark results for quantum circuit simulation.
Popular summary
► BibTeX data
► References
[1] J. Preskill, Quantum 2, 79 (2018).
https://doi.org/10.22331/q-2018-08-06-79
[2] F. Arute et al., Nature 574, 505 (2019).
https://doi.org/10.1038/s41586-019-1666-5
[3] H.-S. Zhong, H. Wang, Y.-H. Deng, M.-C. Chen, L.-C. Peng, Y.-H. Luo, J. Qin, D. Wu, X. Ding, Y. Hu, et al., Science 370, 1460 (2020).
https://doi.org/10.1126/science.abe8770
[4] Google Research, Google AI Quantum (2017).
https://research.google/teams/applied-science/quantum/
[5] IBM Research, IBM Quantum Experience (2016).
https://www.ibm.com/quantum-computing/
[6] Rigetti, Rigetti Computing (2017).
https://www.rigetti.com/
[7] Intel Corporation, Intel Quantum Computing (2017).
https://www.intel.com/content/www/us/en/research/quantum-computing.html
[8] D-Wave Systems, The Quantum Computing Company (2011).
https://www.dwavesys.com/
[9] D-Wave Systems, D-Wave Neal.
https://github.com/dwavesystems/dwave-neal
[10] I. L. Markov, A. Fatima, S. V. Isakov, and S. Boixo, arXiv preprint arXiv:1807.10749 (2018a).
arXiv:1807.10749
[11] J. Chen and et al., Classical simulation of intermediate-size quantum circuits (2018), arXiv:1805.01450 [quant-ph].
arXiv:1805.01450
[12] S. Efthymiou, S. Ramos-Calderer, C. Bravo-Prieto, A. Pérez-Salinas, D. García-Martín, A. Garcia-Saez, J. I. Latorre, and S. Carrazza, Quantum Science and Technology 7, 015018 (2021).
https://doi.org/10.1088/2058-9565/ac39f5
[13] The Qibo team, qiboteam/qibo: Qibo.
https://doi.org/10.5281/zenodo.3997194
[14] S. Carrazza, S. Efthymiou, M. Lazzarin, and A. Pasquale, in 20th International Workshop on Advanced Computing and Analysis Techniques in Physics Research: AI Decoded - Towards Sustainable, Diverse, Performant and Effective Scientific Computing (2022) arXiv:2202.07017 [quant-ph].
arXiv:2202.07017
[15] The Qibo team (2022).
[16] S. Carrazza, S. Efthymiou, M. Lazzarin, and A. Pasquale, qiboteam/qibojit: qibojit.
https://doi.org/10.5281/zenodo.5071354
[17] S. K. Lam, A. Pitrou, and S. Seibert, in Proceedings of the Second Workshop on the LLVM Compiler Infrastructure in HPC (2015) pp. 1–6.
[18] R. Okuta, Y. Unno, D. Nishino, S. Hido, and C. Loomis, in Proceedings of Workshop on Machine Learning Systems (LearningSys) in The Thirty-first Annual Conference on Neural Information Processing Systems (NIPS) (2017).
http://learningsys.org/nips17/assets/papers/paper_16.pdf
[19] G. Aleksandrowicz et al., Qiskit: An open-source framework for quantum computing (2019).
https://doi.org/10.5281/ZENODO.2562110
[20] Cirq Developers, Cirq (2021), See full list of authors on Github: https://github .com/quantumlib/Cirq/graphs/contributors.
https://doi.org/10.5281/zenodo.5182845
[21] Quantum AI team and collaborators, qsim (2020).
https://doi.org/10.5281/zenodo.4023103
[22] D. S. Steiger, T. Häner, and M. Troyer, Quantum 2, 49 (2018).
https://doi.org/10.22331/q-2018-01-31-49
[23] T. Häner, D. S. Steiger, K. Svore, and M. Troyer, Quantum Science and Technology 3, 020501 (2018).
https://doi.org/10.1088/2058-9565/aaa5cc
[24] S. Mandrà, J. Marshall, E. G. Rieffel, and R. Biswas, in 2021 IEEE/ACM Second International Workshop on Quantum Computing Software (QCS) (2021) pp. 99–109.
https://doi.org/10.1109/QCS54837.2021.00015
[25] Y. Suzuki, Y. Kawase, Y. Masumura, Y. Hiraga, M. Nakadai, J. Chen, K. M. Nakanishi, K. Mitarai, R. Imai, S. Tamiya, T. Yamamoto, T. Yan, T. Kawakubo, Y. O. Nakagawa, Y. Ibe, Y. Zhang, H. Yamashita, H. Yoshimura, A. Hayashi, and K. Fujii, Quantum 5, 559 (2021).
https://doi.org/10.22331/q-2021-10-06-559
[26] A. Kelly, arXiv preprint arXiv:1805.00988 (2018).
arXiv:1805.00988
[27] T. Oliphant, Guide to NumPy (2006).
[28] https://pypi.org/project/qibo.
https://pypi.org/project/qibo
[29] https://anaconda.org/conda-forge/qibo.
https://anaconda.org/conda-forge/qibo
[30] M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C. Citro, G. S. Corrado, A. Davis, J. Dean, M. Devin, S. Ghemawat, I. Goodfellow, A. Harp, G. Irving, M. Isard, Y. Jia, R. Jozefowicz, L. Kaiser, M. Kudlur, J. Levenberg, D. Mané, R. Monga, S. Moore, D. Murray, C. Olah, M. Schuster, J. Shlens, B. Steiner, I. Sutskever, K. Talwar, P. Tucker, V. Vanhoucke, V. Vasudevan, F. Viégas, O. Vinyals, P. Warden, M. Wattenberg, M. Wicke, Y. Yu, and X. Zheng, TensorFlow: Large-scale machine learning on heterogeneous systems (2015), software available from tensorflow.org.
https://www.tensorflow.org/
[31] https://github.com/qiboteam/qibotf.
https://github.com/qiboteam/qibotf
[32] https://github.com/qiboteam/qibojit.
https://github.com/qiboteam/qibojit
[33] N. Metropolis, A. W. Rosenbluth, M. N. Rosenbluth, A. H. Teller, and E. Teller, J. Chem. Phys. 21, 1087 (1953).
https://doi.org/10.1063/1.1699114
[34] J. Bradbury, R. Frostig, P. Hawkins, M. J. Johnson, C. Leary, D. Maclaurin, G. Necula, A. Paszke, J. VanderPlas, S. Wanderman-Milne, and Q. Zhang, JAX: composable transformations of Python+NumPy programs (2018).
http://github.com/google/jax
[35] G. Guennebaud, B. Jacob, et al., Eigen v3, http://eigen.tuxfamily.org (2010).
http://eigen.tuxfamily.org
[36] K. Rupp, P. Tillet, F. Rudolf, J. Weinbub, A. Morhammer, T. Grasser, A. Jüngel, and S. Selberherr, SIAM Journal on Scientific Computing 38, S412 (2016), https://doi.org/10.1137/15M1026419.
https://doi.org/10.1137/15M1026419
arXiv:https://doi.org/10.1137/15M1026419
[37] NVIDIA, Thrust (2020).
https://developer.nvidia.com/thrust
[38] NVIDIA, nvcc (2022).
https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html
[39] NVIDIA, cuQuantum SDK (2021).
https://developer.nvidia.com/cuquantum-sdk
[40] S. Efthymiou, M. Lazzarin, S. Carrazza, and A. Pasquale, qiboteam/qibojit-benchmarks: benchmarks v0.0.1 (2022).
https://doi.org/10.5281/zenodo.6363155
[41] A. W. Cross, L. S. Bishop, J. A. Smolin, and J. M. Gambetta, arXiv e-prints , arXiv:1707.03429 (2017), arXiv:1707.03429 [quant-ph].
arXiv:1707.03429
[42] A. W. Cross, A. Javadi-Abhari, T. Alexander, N. de Beaudrap, L. S. Bishop, S. Heidel, C. A. Ryan, J. Smolin, J. M. Gambetta, and B. R. Johnson, arXiv preprint arXiv:2104.14722 (2021).
https://doi.org/10.1145/3505636
arXiv:2104.14722
[43] https://github.com/quantumlib/Cirq/blob/master/cirq-core/cirq/experiments/random_quantum_circuit_generation.py.
https://github.com/quantumlib/Cirq/blob/master/cirq-core/cirq/experiments/random_quantum_circuit_generation.py
[44] https://qiskit.org/documentation/stubs/qiskit.circuit.library.QuantumVolume.html.
https://qiskit.org/documentation/stubs/qiskit.circuit.library.QuantumVolume.html
[45] D. Coppersmith, An approximate Fourier transform useful in quantum factoring (2002), arXiv:quant-ph/0201067 [quant-ph].
arXiv:quant-ph/0201067
[46] Circuit consisting of alternating layers of parametrized RY rotations and entangling CZ gates.
[47] I. L. Markov, A. Fatima, S. V. Isakov, and S. Boixo, arXiv preprint arXiv:1807.10749 10.48550/arXiv.1807.10749 (2018b).
https://doi.org/10.48550/arXiv.1807.10749
arXiv:1807.10749
[48] A. W. Cross, L. S. Bishop, S. Sheldon, P. D. Nation, and J. M. Gambetta, Physical Review A 100, 10.1103/physreva.100.032328 (2019).
https://doi.org/10.1103/physreva.100.032328
[49] E. Bernstein and U. Vazirani, SIAM Journal on Computing 26, 1411 (1997), https://doi.org/10.1137/S0097539796300921.
https://doi.org/10.1137/S0097539796300921
arXiv:https://doi.org/10.1137/S0097539796300921
[50] ATOS, Quantum Learning Machine.
https://atos.net/en/solutions/quantum-learning-machine
[51] NVIDIA team, NVIDIA DGX Station.
https://www.nvidia.com/en-us/data-center/dgx-station/
[52] Qiskit-aer 0.10.3, qiskit-aer-gpu 0.10.2.
[53] M. Smelyanskiy, N. P. D. Sawaya, and A. Aspuru-Guzik, qHiPSTER: The quantum high performance software testing environment (2016), arXiv:arXiv:1601.07195 [quant-ph].
arXiv:arXiv:1601.07195
[54] M. B. et al., TensorFlow Quantum: A software framework for quantum machine learning (2020), arXiv:arXiv:2003.02989 [quant-ph].
arXiv:arXiv:2003.02989
[55] S. V. I. et al., Simulations of quantum circuits with approximate noise using qsim and Cirq (2021), arXiv:arXiv:2111.02396 [quant-ph].
arXiv:arXiv:2111.02396
[56] T. Kadowaki and H. Nishimori, Physical Review E 58, pp. 5355–5363 (1998).
https://doi.org/10.1103/physreve.58.5355
[57] E. Crosson and A. W. Harrow, 2016 IEEE 57th Annual Symposium on Foundations of Computer Science (FOCS) 10.1109/focs.2016.81 (2016).
https://doi.org/10.1109/focs.2016.81
[58] S. Paeckel and et al., Annals of Physics 411, pp. 167998 (2019).
https://doi.org/10.1016/j.aop.2019.167998
Cited by
[1] Amit Jamadagni Gangapuram, Andreas Läuchli, and Cornelius Hempel, "Benchmarking quantum computer simulation software packages: State vector simulators", SciPost Physics Core 7 4, 075 (2024).
[2] Marco Ballarin, Pietro Silvi, Simone Montangero, and Daniel Jaschke, "Optimal sampling of tensor networks targeting wave function's fast decaying tails", Quantum 9, 1714 (2025).
[3] Po-Hsuan Huang, Chun-Yen Tai, Chia-Heng Tu, and Shih-Hao Hung, "QCutSim: Accelerating Quantum Circuit Cutting Simulation on Consumer-Grade Classical Systems", ACM Transactions on Design Automation of Electronic Systems 3833423 (2026).
[4] Alice Barthe, M. Cerezo, Andrew T. Sornborger, Martín Larocca, and Diego García-Martín, "Gate-Based Quantum Simulation of Gaussian Bosonic Circuits on Exponentially Many Modes", Physical Review Letters 134 7, 070604 (2025).
[5] Alessandro D’Elia, Boulos Alfakes, Anas Alkhazaleh, Leonardo Banchi, Matteo Beretta, Stefano Carrazza, Fabio Chiarello, Daniele Di Gioacchino, Andrea Giachero, Felix Henrich, Alex Stephane Piedjou Komnang, Carlo Ligi, Giovanni Maccarrone, Massimo Macucci, Emanuele Palumbo, Andrea Pasquale, Luca Piersanti, Florent Ravaux, Alessio Rettaroli, Matteo Robbiati, Simone Tocci, and Claudio Gatti, "Characterization of a Transmon Qubit in a 3D Cavity for Quantum Machine Learning and Photon Counting", Applied Sciences 14 4, 1478 (2024).
[6] Isabella Masina, Giuseppe Lo Presti, Matteo Robbiati, and Michele Grossi, "Simulating Bell inequalities with Qibo", European Journal of Physics 46 3, 035401 (2025).
[7] Juan M Cruz-Martinez, Matteo Robbiati, and Stefano Carrazza, "Multi-variable integration with a variational quantum circuit", Quantum Science and Technology 9 3, 035053 (2024).
[8] Rodolfo Carobene, Alessandro Candido, Javier Serrano, Alvaro Orgaz-Fuertes, Andrea Giachero, and Stefano Carrazza, " Qibosoq: an open-source framework for quantum circuit RFSoC programming", Quantum Science and Technology 10 3, 035010 (2025).
[9] Steve Abel, Juan Carlos Criado, and Michael Spannowsky, "Training neural networks with universal adiabatic quantum computing", Frontiers in Artificial Intelligence 7, 1368569 (2024).
[10] A S Rejeesh and Nishant Kumar Shekhar, 2025 Supercomputing India (SCI) 1 (2025) ISBN:979-8-3315-5758-4.
[11] Alessio Cicero, Mohammad Ali Maleki, Muhammad Waqar Azhar, Anton Frisk Kockum, and Pedro Trancoso, "Simulation of Quantum Computers: Review and Acceleration Opportunities", ACM Transactions on Quantum Computing 7 1, 1 (2026).
[12] Mallika Chouhan and Sameer G. Kulkarni, 2026 18th International Conference on COMmunication Systems and NETworks (COMSNETS) 807 (2026) ISBN:979-8-3315-9239-4.
[13] Matteo Robbiati, Edoardo Pedicillo, Andrea Pasquale, Xiaoyue Li, Oriel Kiss, Andrew Wright, Renato M. S. Farias, Khanh Uyen Giang, Jeongrak Son, Johannes Knörzer, Siong Thye Goh, Jun Yong Khoo, Nelly H. Y. Ng, Zoë Holmes, Stefano Carrazza, and Marek Gluza, "Double-bracket quantum algorithms for high-fidelity ground-state preparation", Physical Review Research 8 3, 033078 (2026).
[14] Ruge Lin, "Entanglement Trajectory and its Boundary", Quantum 8, 1282 (2024).
[15] A Pasquale, S Efthymiou, S Ramos-Calderer, J Wilkens, I Roth, and S Carrazza, "Towards an open-source framework to perform quantum calibration and characterization", Journal of Physics: Conference Series 3206 1, 012125 (2026).
[16] Matteo Robbiati, Alejandro Sopena, Andrea Papaluca, and Stefano Carrazza, "Real-time error mitigation for variational optimization on quantum hardware", Physical Review Research 8 1, 013262 (2026).
[17] B. J. Alexander, J. J. Bollinger, and M. S. Tame, "Robustness of the projected squeezed state protocol", Physical Review A 109 5, 052614 (2024).
[18] Marco Sciorilli, Lucas Borges, Taylor L. Patti, Diego García-Martín, Giancarlo Camilo, Anima Anandkumar, and Leandro Aolita, "Towards large-scale quantum optimization solvers with few qubits", Nature Communications 16 1, 476 (2025).
[19] Marc Carrillo-Muñoz, Sergio Martinez-Hermida, Sara Barja-Martinez, Antonio E. Saldaña-González, and Mόnica Aragüés Peñalba, 2025 IEEE PES Innovative Smart Grid Technologies Conference Europe (ISGT Europe) 1 (2025) ISBN:979-8-3315-2503-3.
[20] Simone Bordoni, Andrea Papaluca, Piergiorgio Buttarini, Alejandro Sopena, Stefano Giagu, and Stefano Carrazza, "Quantum noise modeling through reinforcement learning", Quantum Science and Technology 11 1, 015005 (2026).
[21] Danylo Lykov, Ruslan Shaydulin, Yue Sun, Yuri Alexeev, and Marco Pistoia, Proceedings of the SC '23 Workshops of the International Conference on High Performance Computing, Network, Storage, and Analysis 1443 (2023) ISBN:9798400707858.
[22] Stavros Efthymiou, Alvaro Orgaz-Fuertes, Rodolfo Carobene, Juan Cereijo, Andrea Pasquale, Sergi Ramos-Calderer, Simone Bordoni, David Fuentes-Ruiz, Alessandro Candido, Edoardo Pedicillo, Matteo Robbiati, Yuanzheng Paul Tan, Jadwiga Wilkens, Ingo Roth, José Ignacio Latorre, and Stefano Carrazza, "Qibolab: an open-source hybrid quantum operating system", Quantum 8, 1247 (2024).
[23] Diego García-Martín, Martín Larocca, and M. Cerezo, "Effects of noise on the overparametrization of quantum neural networks", Physical Review Research 6 1, 013295 (2024).
[24] Shuang Liang, Yuncheng Lu, Ce Guo, Wayne Luk, and Paul H. J. Kelly, 2024 IEEE 32nd Annual International Symposium on Field-Programmable Custom Computing Machines (FCCM) 24 (2024) ISBN:979-8-3503-7243-4.
[25] Ali Asadi, Amintor Dusko, Chae-Yeun Park, Vincent Michaud-Rioux, Isidor Schoch, Shuli Shu, Trevor Vincent, and Lee James O'Riordan, "Hybrid quantum programming with PennyLane Lightning on HPC platforms", arXiv:2403.02512, (2024).
[26] Andrea Pasquale, Andrea Papaluca, Renato M. S. Farias, Matteo Robbiati, Edoardo Pedicillo, and Stefano Carrazza, "Beyond full statevector simulation with Qibo", arXiv:2408.00384, (2024).
[27] Alessio Cicero, Mohammad Ali Maleki, Muhammad Waqar Azhar, Anton Frisk Kockum, and Pedro Trancoso, "Simulation of Quantum Computers: Review and Acceleration Opportunities", arXiv:2410.12660, (2024).
[28] Danylo Lykov, Ruslan Shaydulin, Yue Sun, Yuri Alexeev, and Marco Pistoia, "Fast Simulation of High-Depth QAOA Circuits", arXiv:2309.04841, (2023).
[29] S. Carrazza, S. Efthymiou, M. Lazzarin, and A. Pasquale, "An open-source modular framework for quantum computing", Journal of Physics Conference Series 2438 1, 012148 (2023).
[30] Roel Van Beeumen, Daan Camps, and Neil Mehta, "QCLAB++: Simulating Quantum Circuits on GPUs", arXiv:2303.00123, (2023).
[31] Steve Abel, Juan Carlos Criado, and Michael Spannowsky, "Training Neural Networks with Universal Adiabatic Quantum Computing", arXiv:2308.13028, (2023).
[32] Alessandro D'Elia, Boulos Alfakes, Anas Alkhazaleh, Leonardo Banchi, Matteo Beretta, Stefano Carrazza, Fabio Chiarello, Daniele Di Gioacchino, Andrea Giachero, Felix Henrich, Alex Stephane Piedjou Komnang, Carlo Ligi, Giovanni Maccarrone, Massimo Macucci, Emanuele Palumbo, Andrea Pasquale, Luca Piersanti, Florent Ravaux, Alessio Rettaroli, Matteo Robbiati, Simone Tocci, and Claudio Gatti, "Characterization of a Transmon Qubit in a 3D Cavity for Quantum Machine Learning and Photon Counting", arXiv:2402.04322, (2024).
The above citations are from Crossref's cited-by service (last updated successfully 2026-08-12 23:10:15) and SAO/NASA ADS (last updated successfully 2026-08-12 23:10:16). The list may be incomplete as not all publishers provide suitable and complete citation data.
This Paper is published in Quantum under the Creative Commons Attribution 4.0 International (CC BY 4.0) license. Copyright remains with the original copyright holders such as the authors or their institutions.