Skip to content
AlgorithmiqPublic

About

Parallel Out-of-Core Randomized Tensor-Network Compression

Resources

Code of conduct

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Latest commit

 

History

79 Commits

Folders and files

portc

arXiv Documentation Test portc Coverage Quality gate status License

Parallel Out-of-Core Randomized Tensor-Network Compression.

portc contracts and compresses tensor trains (MPS and MPO) in a single sweep with the Successive Randomized Compression (SRC) algorithm of Quantum 10, 2022 (2026). It extends SRC to stacks of several trains, multiple GPUs and memory-budgeted out-of-core execution. The design, cost model and scaling results are described in arXiv:2611.37370.

Highlights

  • One sweep for a whole stack. MPO^k, MPO^k . MPS and MPS . MPO^k are compressed without ever forming the full product, alongside the usual MPO-MPS and MPO-MPO products and plain MPS/MPO compression.
  • Multi-GPU. The sweep splits across the GPUs of a node; on a 50-site stack compressed from bond dimension 256000 to 2000 this gives 3.8x on four GH200s and 5.8x on eight RTX PRO 6000s over a single device.
  • Out-of-core. Inputs are read one site at a time (NumPy, np.memmap, zarr, HDF5) and intermediates are staged across GPU memory, host memory and disk, so problems larger than either still run.
  • No framework lock-in. Plain lists of per-site arrays in the quimb layout, NumPy on CPU and CuPy on NVIDIA (CUDA) or AMD (ROCm) GPUs.

Quick start

import quimb.tensor as qtn

from portc import apply, compress, src

H1 = qtn.MPO_rand(20, bond_dim=32, seed=0)
H2 = qtn.MPO_rand(20, bond_dim=32, seed=1)
psi = qtn.MPS_rand_state(20, bond_dim=32, seed=2)

H = apply(H1.arrays, H2.arrays, chi_out=64)  # H1 H2, compressed
phi = compress(psi.arrays, chi_out=16)  # psi, compressed
state = src(H1.arrays, H2.arrays, psi.arrays, chi_out=64)  # H1 H2 |psi>, one sweep

result = qtn.MatrixProductOperator(H)

All three functions are pure and return new site arrays. Whether a train is an MPS or an MPO is inferred from its first site tensor. Pass device="gpu" to run on a GPU, and resources=Resources(...) to set memory budgets, a scratch directory or several devices:

from portc import Resources

out = src(
    *layers,
    chi_out=2000,
    device="gpu",
    resources=Resources(devices=4, gpu_memory="36GB", scratch_dir="/local/scratch"),
)

The documentation covers the index and contraction conventions, oversampling and adaptive truncation, when stacks pay off, large problems and the benchmarks.

Installation

# CPU only (default)
uv pip install portc

# With NVIDIA GPU support (CUDA 13.x, driver >= 580)
uv pip install "portc[gpu-nvidia]"

# With AMD GPU support (ROCm)
uv pip install "portc[gpu-rocm]"

Nix flake

The repository ships a flake.nix that provides a development shell with uv, Git and the GitHub CLI, plus the native libraries the binary wheels need at runtime. Python itself and all project dependencies remain managed by uv.

With flakes enabled, run:

nix develop

Entering the shell runs uv sync --all-groups and activates the uv project environment ($UV_PROJECT_ENVIRONMENT if set, otherwise .venv), so you land in a ready-to-use environment. GPU extras are not installed by the flake: add them explicitly with uv sync --all-groups --extra gpu-nvidia (or --all-groups --extra gpu-rocm) on a machine with the matching drivers.

If you use direnv, the provided .envrc enters the shell automatically:

direnv allow

Unlike the DevContainer, the Nix shell does not install the git hooks for you. Run prek install --prepare-hooks once after the first nix develop.

Citing

If portc is useful in your work, please cite our paper and the paper that introduced SRC:

@misc{panades2026portc,
  title         = {portc: Parallel Out-of-Core Randomized Tensor-Network Compression},
  author        = {Panad{\'e}s-Barrueta, Ram{\'o}n L. and Materia, Davide and Rossi, Matteo A. C. and Di Remigio Eik{\aa}s, Roberto},
  year          = {2026},
  eprint        = {2611.37370},
  archivePrefix = {arXiv},
  primaryClass  = {quant-ph},
}

About

Parallel Out-of-Core Randomized Tensor-Network Compression

Resources

Code of conduct

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages