doc: improving the docs

This commit is contained in:
MatteoRobbiati
2025-02-04 11:20:08 +01:00
parent f6992b489f
commit 8b7bb9ee7c
4 changed files with 109 additions and 19 deletions

BIN
doc/source/QiboTN.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

View File

@@ -1,6 +1,7 @@
Getting started Getting started
=============== ===============
In this section we present the basic aspects of the Qibotn design and provide installation instructions. In this section we present the basic aspects of the Qibotn design and provide installation instructions.
Please visit the following sections to understand how ``qibotn`` works. Please visit the following sections to understand how ``qibotn`` works.

View File

@@ -1,12 +1,18 @@
Quick start Quick start
=========== ===========
In this section, we provide an example of two qubit ciruit simulation using qibotn package in Qibo simulator. First, the backend is to be set with appropriate run card settings, followed by the circuit simulation using Qibo documentation. In this section, we provide examples on how to use Qibotn to execute tensor network
simulation of quantum circuit. First, we show how to use the Cutensornet and Quimb
backends, while in a second moment we show a complete example of usage of the Quantum
Matcha Tea Backend.
Setting the backend Setting the backend with Cutensornet and Quimb
""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""
QiboTN offers two backends: cutensornet (using cuQuantum library) and qutensornet (using Quimb library) for tensor network based simulations. At present, cutensornet backend works only for GPUs whereas qutensornet for CPUs. The backend can be set using the following command line. Among the backends provided by Qibotn, we have cutensornet (using cuQuantum library)
and qutensornet (using Quimb library) for tensor network based simulations.
At present, cutensornet backend works only for GPUs whereas qutensornet for CPUs.
These backend can be set using the following command line.
To use cuQuantum library, cutensornet can be specified as follows:: To use cuQuantum library, cutensornet can be specified as follows::
@@ -79,3 +85,61 @@ The following is a basic example to execute a two qubit circuit and print the fi
# Print the final state # Print the final state
print(result.state()) print(result.state())
Using the Quantum Matcha Tea backend
""""""""""""""""""""""""""""""""""""
In the following we show an example of how the Quantum Matcha Tea backend can be
used to execute a quantum circuit::
# We need Qibo to setup the circuit and the backend
from qibo import Circuit, gates
from qibo.backends import construct_backend
# We need Quantum Matcha Tea to customize the tensor network simulation
from qmatchatea import QCConvergenceParameters
# Constructing the circuit preparing a GHZ state
def build_GHZ(nqubits):
"""Helper function to construct a circuit preparing the GHZ circuit."""
circ = Circuit(nqubits)
circ.add(gates.H(0))
[circ.add(gates.CNOT(q, q+1)) for q in range(nqubits-1)]
return circ
# Set the number of qubits
nqubits = 40
# Construct the circuit preparing the GHZ state
circuit = build_GHZ(nqubits)
# Construct the backend
backend = construct_backend(backend="qibotn", platform="qmatchatea")
# Customize the low-level backend preferences according to Qibo's formalism
backend.set_device("/CPU:1")
backend.set_precision("double")
# Customize the tensor network simulation itself
backend.configure_tn_simulation(
ansatz = "MPS",
convergence_params = QCConvergenceParameters(max_bond_dimension=50, cut_ratio=1e-6)
)
# Execute the tensor network simulation
outcome = backend.execute_circuit(
circuit = circuit,
nshots=1024,
)
# Print some results
print(outcome.probabilities())
# Should print something like: {'0000000000000000000000000000000000000000': 0.5000000000000001, '1111111111111111111111111111111111111111': 0.5000000000000001}
print(outcome.frequencies())
# Should print something like: {'0000000000000000000000000000000000000000': 488, '1111111111111111111111111111111111111111': 536}
By default, the simulator is choosing a specific method to compute the probabilities,
and for further information we recommend the user to refer to our High-Level-API
docstrings.

View File

@@ -4,29 +4,54 @@
What is QiboTN? What is QiboTN?
=============== ===============
QiboTN is the dedicated `Qibo <https://github.com/qiboteam/qibo>`_ backend to support large-scale simulation of quantum circuits and acceleration. Qibotn is an high-level library which integrates tensor network simulation within
the `Qibo <https://github.com/qiboteam/qibo>`_ ecosystem.
Supported Computation: If you are familiar with Qibo, you will be well aware of the modularity we provide
through the use of our backends: after building a specific algorithm or quantum
circuit, any of our backends can be selected to perform operations on the
desired hardware (classical or quantum).
- Tensornet (TN) Here, we extend this modularity to one of the most famous quantum inspired simulation
- Matrix Product States (MPS) technique.
Tensor Network contractions to: We do this by relying on well-known and maintained packages, and integrating their
operation into our own dedicated backends.
- dense vectors .. image:: QiboTN.png
- expecation values of given Pauli string
As shown in the figure above, we currently support three different backends, which
correspond to the three mentioned packages:
- `cuQuantum <https://github.com/NVIDIA/cuQuantum>`_: an NVIDIA SDK of optimized libraries and tools for accelerating quantum computing workflows (we refer to the specific `Cutensornet <https://docs.nvidia.com/cuda/cuquantum/latest/cutensornet/index.html>`_ library);
- `quimb <https://quimb.readthedocs.io/en/latest/>`_: an easy but fast python library for quantum information many-body calculations, focusing primarily on tensor networks;
- `Quantum Matcha Tea <https://www.quantumtea.it/>`_: a logical quantum computer emulator powered by matrix product states.
.. warning::
There are currently two ways to use the three backends (`qmatchatea` is
slightly different from the others), but we are working to standardize the interface.
Thanks to the mentioned packages, we currently support some tensor network ansatze:
Matrix Product States (MPS) on any mentioned backend, Tree Tensor Networks (TTN)
through the Quantum Matcha Tea backend and a more general Tensor Network (TN) ansatz through
Cutensornet and Quimb.
Supported simulation features
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
We support Tensor Network contractions to:
- dense vectors (all the backends)
- expecation values of given Pauli string (Cutensornet and Qmatchatea)
The supported HPC configurations are: The supported HPC configurations are:
- single-node CPU - single-node CPU through Quimb and Qmatchatea
- single-node GPU or GPUs - single-node GPU or GPUs through Cutensornet and Qmatchatea
- multi-node multi-GPU with Message Passing Interface (MPI) - multi-node multi-GPU with Message Passing Interface (MPI) through Cutensornet
- multi-node multi-GPU with NVIDIA Collective Communications Library (NCCL) - multi-node multi-GPU with NVIDIA Collective Communications Library (NCCL) through Cutensornet
Currently, the supported tensor network libraries are:
- `cuQuantum <https://github.com/NVIDIA/cuQuantum>`_, an NVIDIA SDK of optimized libraries and tools for accelerating quantum computing workflows.
- `quimb <https://quimb.readthedocs.io/en/latest/>`_, an easy but fast python library for quantum information many-body calculations, focusing primarily on tensor networks.
How to Use the Documentation How to Use the Documentation
============================ ============================