Source-linked AI summary

Qibo: a framework for quantum simulation with hardware acceleration

Stavros Efthymiou, Sergi Ramos-Calderer, Carlos Bravo-Prieto, Adrián Pérez-Salinas, Diego García-Martín, Artur Garcia-Saez, José Ignacio Latorre, Stefano Carrazza

arXiv:2009.01845v2quant-phcs.DCcs.LG

TL;DR

Quantum circuit and adiabatic-evolution simulation faces exponential memory and time costs, motivating accessible high-performance tools. Qibo addresses this with a simple, hardware-accelerated framework supporting CPU and GPU configurations. Its benchmarks report superior large-circuit scaling, expanded qubit capacity, and faster Trotter-based evolution under the tested setups.

  • Problem

    Quantum circuit and adiabatic-evolution simulation requires efficient linear algebra while memory and computing time scale exponentially with qubit count.

  • Method

    Qibo combines a simple API with TensorFlow-based simulation, custom operators, gate fusion, and multithreaded CPU, single-GPU, and multi-GPU execution.

  • Results

    Qibo offers better large-circuit scaling than other libraries, simulates up to 33 complex128 or 34 complex64 qubits on the tested DGX station, and Trotter decomposition is several orders of magnitude faster than full-matrix methods.

  • Takeaways & Limitations

    Qibo provides a unified framework for accessible, hardware-accelerated simulation across CPU, single-GPU, and multi-GPU configurations.

  • Takeaways & Limitations

    Multi-GPU advantages depend on circuit structure, and the reported benchmarks use a specific DGX Station hardware and software configuration.

Abstract

from arXiv · show

We present Qibo, a new open-source software for fast evaluation of quantum circuits and adiabatic evolution which takes full advantage of hardware accelerators. The growing interest in quantum computing and the recent developments of quantum hardware devices motivates the development of new advanced computational tools focused on performance and usage simplicity. In this work we introduce a new quantum simulation framework that enables developers to delegate all complicated aspects of hardware or platform implementation to the library so they can focus on the problem and quantum algorithms at hand. This software is designed from scratch with simulation performance, code simplicity and user friendly interface as target goals. It takes advantage of hardware acceleration such as multi-threading CPU, single GPU and multi-GPU devices.

PROGRAM SUMMARY

Qibo addresses the exponential memory and time cost of simulating quantum circuits and adiabatic evolution with hardware-accelerated algorithms. Its implementation combines TensorFlow dataflow infrastructure with custom operators and CPU/GPU parallelism.

  • Qibo simulates quantum circuits and adiabatic evolution despite exponential memory and computing-time costs with increasing qubit count.
  • TensorFlow dataflow infrastructure and custom operators implement the simulation algorithms.
  • The framework supports multithreaded CPU, single-GPU, and multi-GPU execution.

1. Introduction and motivation

Quantum hardware development increases the need for accessible, efficient classical simulation, whose memory and time requirements become exponentially difficult at larger scales. Qibo responds with an open-source framework combining a simple API, hardware-accelerated simulation, and support for hybrid algorithms.

  • Quantum simulation becomes quickly impractical because memory and time scale exponentially with system size.
  • Classical simulation remains useful for prototyping and studying quantum algorithms before execution on quantum hardware.
  • Qibo targets quantum simulation with a simple API, hardware acceleration, and a clean design pattern for classical/quantum hybrid algorithms.
  • Qibo is intended to serve as an API and simulation-engine entry point for a quantum experimental research collaboration.

2. Technical implementation

Qibo is an open-source library for defining and simulating quantum circuits, with a technical structure designed to exploit hardware accelerators. Its code organization separates the circuit abstraction from accelerator-backed simulation.

  • Qibo provides open-source quantum circuit definition and simulation with support for hardware accelerators such as GPUs.
  • The framework structure is presented schematically as the design of Qibo's simulation system.

2.1. Acceleration paradigm

Qibo uses hardware acceleration to improve computational efficiency while retaining general-purpose programming flexibility. TensorFlow primitives, custom operators, and multi-GPU scheduling provide the implementation foundation.

  • Hardware accelerators combine CPU flexibility with GPU efficiency to increase computational efficiency.
  • TensorFlow reduces the hardware knowledge required to develop efficient accelerator-backed Python code.
  • Qibo combines TensorFlow primitives, custom operators, and multi-GPU job scheduling for quantum circuit simulation.

2.2. Code structure

Qibo separates circuit structure and gates from backend-specific simulation layers, allowing quantum algorithms to use a simple high-level Python API without direct backend dependencies.

  • 2.2. Code structure: Qibo separates circuit and gate definitions from specialized TensorFlow and NumPy simulation layers, while backend-independent algorithms use the abstraction layer.The backend layers support quantum algorithms and measurements without coupling those algorithms directly to a specific backend.
  • 2.2. Code structure: A high-level Python API provides the main entry point for using Qibo.

2.3. Backends and algorithms

Qibo simulates circuits by applying gate matrix multiplications to exponentially sized state vectors through selectable TensorFlow and custom backends, with backend choices trading performance, memory use, and gradient support.

  • 2.3. Backends and algorithms: Each gate acts on selected target qubits through matrix multiplication, with the summation running over the qubits targeted by that gate.The supplied code fragments illustrate circuit construction, gate addition, execution, and retrieval of the final state.
  • 2.3. Backends and algorithms: Qibo transforms the state vector by applying matrix multiplications for each queued gate, returning the final state or measurement samples.The state dimension grows exponentially with the number of qubits, creating the main computational difficulty.
  • 2.3. Backends and algorithms: Qibo provides three TensorFlow 2 backends: two using native operations and one using custom C++ operators, with the custom backend selected by default.Users can switch backends through qibo.set_backend().
  • 2.3. Backends and algorithms: Native backends use einsum or matmul implementations, with matmul requiring state transposition and reshaping to support rank-2 multiplication.The two implementations provide alternative matrix-multiplication strategies for different hardware contexts.
  • 2.3. Backends and algorithms: The einsum backend is faster on GPUs, whereas the matmul backend is more efficient on CPUs and native TensorFlow backends automatically support backpropagation.Backpropagation can support gradient-descent optimization of variational quantum circuits.
  • 2.3. Backends and algorithms: Custom operators update gate-affected state-vector components in place, reducing copies and memory requirements to 2^N complex numbers for N qubits.The custom implementation calculates updated indices during each gate application and exploits sparsity in common gates.

2.4. Circuit simulation features

Qibo adds circuit features for measurements, noisy-circuit simulation, intermediate-state analysis, and faster execution through gate fusion and variational layers.

  • 2.4. Circuit simulation features: Controlled gates are applied by indexing the state vector directly rather than creating large gate matrices.
  • 2.4. Circuit simulation features: Qibo samples measurements from the final state vector and supports binary or decimal outputs, raw samples or frequency dictionaries, and collective registers.Measurement does not require computing a density matrix; unmeasured qubits are traced out of the outcome probability.
  • 2.4. Circuit simulation features: Qibo automatically switches from state-vector to density-matrix simulation when a noise channel or density-matrix initial state is used.Native TensorFlow backends support density matrices, while density matrices were not yet implemented in the custom backend.
  • 2.4. Circuit simulation features: Callbacks compute quantities on intermediate state vectors, including entanglement entropy, Hamiltonian energy, and the adiabatic Hamiltonian gap.These callbacks let users track entanglement or evaluate physical quantities during circuit execution.
  • 2.4. Circuit simulation features: Qibo fuses several gates into a single matrix for large circuits and provides VariationalLayer for alternating one-qubit rotations and two-qubit entangling gates.Gate fusion can combine operations into a two-qubit 4 × 4 matrix, reducing the need to apply gates individually.

2.5. Distributed computation

Qibo distributes circuit simulation across GPUs and CPU memory to exceed single-device limits, while performance depends on CPU–GPU communication and circuit structure.

  • 2.5. Distributed computation: A high-end 12–16 GB GPU can simulate up to 29 qubits, or 30 with single precision, while larger systems require sufficient CPU RAM or distributed configurations.
  • 2.5. Distributed computation: Qibo can reuse one physical GPU as multiple logical devices, enabling distributed simulation beyond the device’s single-GPU qubit limit.The implementation partitions the state using global qubits and transfers state pieces through system RAM.
  • 2.5. Distributed computation: When logical devices are distinct physical devices, matrix multiplications are parallelized across them using joblib.
  • 2.5. Distributed computation: Qibo’s distributed implementation is limited by total system RAM rather than GPU memory.The full state vector remains in CPU RAM while partitions are transferred to available GPUs for matrix multiplication.
  • 2.5. Distributed computation: A multi-GPU configuration can provide significant speed-up over CPU-only execution, but performance depends on the number of SWAP gates required by the circuit structure.SWAP gates move gate targets to local qubits, making CPU–GPU communication the main bottleneck.

2.6. Time evolution

Qibo supports quantum-state time evolution through full-matrix integration and Trotter-decomposed circuit methods, including adiabatic evolution and hardware-accelerated execution. Its adiabatic model interpolates between an easily prepared initial Hamiltonian and a harder target Hamiltonian.

  • Time evolution: Qibo supports unitary time evolution from an initial state vector and Hamiltonian to a final state at time T.The evolution can be monitored using callbacks that track quantities during the simulation.
  • Adiabatic evolution: Adiabatic evolution uses H0 as an easily prepared initial Hamiltonian and H1 as a harder target, with scheduling function s(t) controlling the interpolation.For suitable scheduling and total evolution time, the final state approximates the ground state of H1.
  • Adiabatic evolution: Qibo demonstrates adiabatic evolution with a four-qubit transverse-field Ising Hamiltonian, linear scheduling, and timestep dt=1e-2.The example constructs X and TFIM Hamiltonian objects and passes them to AdiabaticEvolution.
  • Full-matrix method: Full-matrix evolution constructs a 2^N × 2^N Hamiltonian matrix and integrates the time-dependent Schrödinger equation with an ODE solver.The default exp solver uses matrix exponentiation for each timestep and applies the resulting operator through matrix multiplication.
  • Full-matrix method: Qibo also provides fourth- and fifth-order Runge-Kutta solvers, but the text states they are less accurate than the default exp solver.These operations use TensorFlow primitives including tf.matmul and tf.linalg.expm.
  • Trotter method: Trotter decomposition maps evolution under local k-body Hamiltonians to circuits of k-qubit gates using 2^k × 2^k unitary matrices.The TrotterHamiltonian object generates the corresponding circuit.

3. Benchmarks

Qibo is benchmarked against quantum simulation libraries across circuit types, hardware configurations, precisions, and adiabatic solvers. Results show stronger large-circuit scaling, hardware-dependent speedups, and trade-offs between simulation accuracy, memory, and execution time.

  • 3.1. Quantum Fourier Transform: Qibo offers better scaling than other libraries for QFT circuits above 20 qubits on both CPU and GPU, while GPU implementations improve performance by about an order of magnitude over CPU.For small circuits, most libraries perform similarly and single-thread CPUs can outperform more complex configurations.
  • 3.1. Quantum Fourier Transform: 33 qubits in complex128 and 34 in complex64 fit in the DGX system’s 256 GB RAM, while distributed multi-GPU execution extends single-GPU capacity and improves scaling.A single 32 GB GPU supports up to 30 qubits, or 31 in complex64, before distributed execution is used.
  • 3.2. Variational circuit: Variational-circuit benchmarks show the same large-qubit scaling advantage for Qibo, with gate fusion implemented through the VariationalLayer gate.VariationalLayer fuses four RY gates with an intervening CZ gate into a single two-qubit operation.
  • 3.5. Adiabatic time evolution: Trotter decomposition is several orders of magnitude faster and uses less memory than full Hamiltonian-matrix methods for adiabatic evolution.GPU execution is typically faster than CPU, while Runge-Kutta solvers gain the least from GPU acceleration because they exploit parallelization less effectively.
  • 3.5. Adiabatic time evolution: Reducing the adiabatic time step δt makes the Trotterized result approach the exact evolution with overlap scaling as δt^4, but increases execution time.The full exponential evolution operator is treated as exact for the error comparison.
  • 3.6. Hardware device selection: For QFT hardware selection, single-thread CPU is optimal up to 15 qubits, GPU becomes advantageous beyond 15, and GPU use provides an additional 10x speed-up when the state vector fits in memory.For large qubit counts, CPU performance plateaus at 20 threads; multi-GPU benefits depend on circuit structure because communication may require SWAP gates.

4. Applications

Qibo’s applications include pre-coded models and examples for variational, search, classification, autoencoder, singular-value-decomposition, and adiabatic-evolution tasks. These examples support configurable simulations and demonstrate convergence behavior and optimized adiabatic scheduling.

  • Applications: Qibo includes application-specific models and pre-coded examples spanning VQE, AAVQE, Grover search, variational classification, quantum autoencoding, QSVD, and adiabatic evolution.Users can configure circuit size, depth, adiabatic steps, optimization, and related parameters in several examples.
  • Variational methods: AAVQE in Qibo targets transverse-field Ising ground states and allows users to vary qubit number, circuit layers, and adiabatic steps.The implementation is intended to explore how VQE ansatz accuracy scales with circuit depth.
  • Classical-data applications: Qibo’s examples support both training and inference workflows for variational classifiers, including iris and two-dimensional datasets.Users can select pre-trained configurations or optimize parameters from scratch and inspect classification accuracy.
  • Adiabatic evolution: Adiabatic Ising evolution converges to the exact ground state when the total evolution time is sufficient.The example tracks energy and overlap with the exact ground state during evolution.
  • Adiabatic evolution: Optimizing the adiabatic schedule favors slower evolution where the energy gap is small over default linear scheduling.The optimized polynomial schedule can find the solution in a smaller total time T.

5. Outlook

Qibo provides a simple interface for running quantum circuits and adiabatic evolution across accelerated hardware while hiding data-placement, threading, and memory-management details. The first release targets single-node systems, with future work planned for broader algorithms and multi-node execution.

  • Framework interface: Qibo lets users simulate circuits and adiabatic evolution across hardware platforms without managing GPU and multi-GPU implementation details.The framework abstracts data placement, multithreading, and memory management.
  • Current scope: The first release combines linear-algebra simulation with hardware acceleration on single-node systems using one or multiple GPUs and sufficient RAM.The supported target is an acceptable number of qubits and computational time rather than multi-node execution.
  • Future work: Future development covers new physics algorithms, noise simulation, and multi-node distributed computation through OpenMPI.The roadmap separates algorithmic extensions from technical expansion of the distributed computation model.
  • Hardware integration: Qibo is intended to integrate with quantum-hardware middleware that schedules submitted calculations and returns laboratory results.The proposed middleware connection would accept calculations defined through the Qibo API.
Loading 2009.01845v2…