Skip to main content

Qibotn

The tensor network translation module for Qibo to support large-scale simulation of quantum circuits and acceleration.

Supported Computation

Tensor Network Types:

  • Tensornet (TN)
  • Matrix Product States (MPS)

Tensor Network contractions to:

  • dense vectors
  • expecation values of given Pauli string

The supported HPC configurations are:

  • single-node CPU
  • single-node GPU or GPUs
  • multi-node multi-GPU with Message Passing Interface (MPI)
  • multi-node multi-GPU with NVIDIA Collective Communications Library (NCCL)

Currently, the supported tensor network libraries are:

  • cuQuantum, an NVIDIA SDK of optimized libraries and tools for accelerating quantum computing workflows.
  • quimb, an easy but fast python library for ‘quantum information many-body’ calculations, focusing primarily on tensor networks.

Installation

To get started:

pip install qibotn

to install the tools and dependencies. A few extras are provided, check pyproject.toml in case you need them.

Contribute

To contribute, please install using poetry:

git clone https://github.com/qiboteam/qibotn.git
cd qibotn
poetry install

Sample Codes

Single-Node Example

The code below shows an example of how to activate the Cuquantum TensorNetwork backend of Qibo.

import numpy as np
from qibo import Circuit, gates
import qibo

# Below shows how to set the computation_settings
# Note that for MPS_enabled and expectation_enabled parameters the accepted inputs are boolean or a dictionary with the format shown below.
# If computation_settings is not specified, the default setting is used in which all booleans will be False.
# This will trigger the dense vector computation of the tensornet.

computation_settings = {
    "MPI_enabled": False,
    "MPS_enabled": {
        "qr_method": False,
        "svd_method": {
            "partition": "UV",
            "abs_cutoff": 1e-12,
        },
    },
    "NCCL_enabled": False,
    "expectation_enabled": False,
}


qibo.set_backend(
    backend="qibotn", platform="cutensornet", runcard=computation_settings
)  # cuQuantum
# qibo.set_backend(backend="qibotn", platform="qutensornet", runcard=computation_settings) #quimb


# Construct the circuit
c = Circuit(2)
# Add some gates
c.add(gates.H(0))
c.add(gates.H(1))

# Execute the circuit and obtain the final state
result = c()

print(result.state())

Other examples of setting the computation_settings

# Expectation computation with specific Pauli String pattern
computation_settings = {
    "MPI_enabled": False,
    "MPS_enabled": False,
    "NCCL_enabled": False,
    "expectation_enabled": {
        "pauli_string_pattern": "IXZ",
    },
}

# Dense vector computation using multi node through MPI
computation_settings = {
    "MPI_enabled": True,
    "MPS_enabled": False,
    "NCCL_enabled": False,
    "expectation_enabled": False,
}

Multi-Node Example

Multi-node is enabled by setting either the MPI or NCCL enabled flag to True in the computation settings. Below shows the script to launch on 2 nodes with 2 GPUs each. $node_list contains the IP of the nodes assigned.

mpirun -n 4 -hostfile $node_list python test.py

Metadata

Release files for qibotn 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qibotn 0.0.3
File Size Uploaded
qibotn-0.0.3.tar.gz 21.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qibotn 0.0.3
File Interpreter ABI Platform
qibotn-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 47.0 kB

Release files / qibotn-0.0.3.tar.gz

Download URL qibotn-0.0.3.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3bc8896d36d2da5ed99bdba743f93fd69c57fa8f893861cdaa26abfa6f7aef05
BLAKE2b-256 checksum
How to use checksums
6fb63c6c332a809b38b1a89e4e05d94490acaf444e5573ae8a890ea7b3e1dd6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / qibotn-0.0.3-py3-none-any.whl

Download URL qibotn-0.0.3-py3-none-any.whl
Size 25.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c0cb4ffa77795eabc360108f0d7712f685cc75ab96753e699ee9ef7adf23bab
BLAKE2b-256 checksum
How to use checksums
74d7b289095819a5ba4072c58adc0fdf129f3fffb77cef4623189c9a8f05c502
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page