chore: Pre-commit all files once more

This commit is contained in:
Alessandro Candido
2024-02-08 10:17:22 +01:00
committed by yangliwei
parent 906cc8b021
commit 3943b91f21

View File

@@ -5,26 +5,33 @@ To get started, `python setup.py install` to install the tools and dependencies.
# Supported Computation # Supported Computation
Tensor Network Types: Tensor Network Types:
- Tensornet (TN) - Tensornet (TN)
- Matrix Product States (MPS) - Matrix Product States (MPS)
Tensor Network contractions to: Tensor Network contractions to:
- dense vectors - dense vectors
- expecation values of given Pauli string - expecation values of given Pauli string
The supported HPC configurations are: The supported HPC configurations are:
- single-node CPU - single-node CPU
- single-node GPU or GPUs - single-node GPU or GPUs
- multi-node multi-GPU with Message Passing Interface (MPI) - multi-node multi-GPU with Message Passing Interface (MPI)
- multi-node multi-GPU with NVIDIA Collective Communications Library (NCCL) - multi-node multi-GPU with NVIDIA Collective Communications Library (NCCL)
Currently, the supported tensor network libraries are: 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. - [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.
# Sample Codes # Sample Codes
## Single-Node Example ## Single-Node Example
The code below shows an example of how to activate the Cuquantum TensorNetwork backend of Qibo. The code below shows an example of how to activate the Cuquantum TensorNetwork backend of Qibo.
```py ```py
import numpy as np import numpy as np
from qibo import Circuit, gates from qibo import Circuit, gates
@@ -36,20 +43,22 @@ import qibo
# This will trigger the dense vector computation of the tensornet. # This will trigger the dense vector computation of the tensornet.
computation_settings = { computation_settings = {
'MPI_enabled': False, "MPI_enabled": False,
'MPS_enabled': { "MPS_enabled": {
"qr_method": False, "qr_method": False,
"svd_method": { "svd_method": {
"partition": "UV", "partition": "UV",
"abs_cutoff": 1e-12, "abs_cutoff": 1e-12,
}, },
} , },
'NCCL_enabled': False, "NCCL_enabled": False,
'expectation_enabled': False "expectation_enabled": False,
} }
qibo.set_backend(backend="qibotn", platform="cutensornet", runcard=computation_settings) #cuQuantum qibo.set_backend(
backend="qibotn", platform="cutensornet", runcard=computation_settings
) # cuQuantum
# qibo.set_backend(backend="qibotn", platform="qutensornet", runcard=computation_settings) #quimb # qibo.set_backend(backend="qibotn", platform="qutensornet", runcard=computation_settings) #quimb
@@ -70,25 +79,26 @@ Other examples of setting the computation_settings
```py ```py
# Expectation computation with specific Pauli String pattern # Expectation computation with specific Pauli String pattern
computation_settings = { computation_settings = {
'MPI_enabled': False, "MPI_enabled": False,
'MPS_enabled': False, "MPS_enabled": False,
'NCCL_enabled': False, "NCCL_enabled": False,
'expectation_enabled': { "expectation_enabled": {
'pauli_string_pattern': "IXZ" "pauli_string_pattern": "IXZ",
},
} }
# Dense vector computation using multi node through MPI # Dense vector computation using multi node through MPI
computation_settings = { computation_settings = {
'MPI_enabled': True, "MPI_enabled": True,
'MPS_enabled': False, "MPS_enabled": False,
'NCCL_enabled': False, "NCCL_enabled": False,
'expectation_enabled': False "expectation_enabled": False,
} }
``` ```
## Multi-Node Example ## 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.
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.
```sh ```sh
mpirun -n 4 -hostfile $node_list python test.py mpirun -n 4 -hostfile $node_list python test.py