Skip to main content

QuaSARQ Python Binding

GPU stabilizer simulator. Accepts stim-format circuits directly, so a stim.Circuit (or circuit text) goes straight in:

import quasarq, stim

circuit = stim.Circuit.generated("surface_code:rotated_memory_z", distance=5, rounds=5, after_clifford_depolarization=0.001)

dets, obs = quasarq.compile_detector_sampler(circuit, seed=1).sample(100_000, separate_observables=True)

measurements = quasarq.compile_sampler(circuit, seed=1).sample(100_000)

Installing

pip install quasarq

The bundled wheels are for CPython 3.10 through 3.13. The wheel contains the CUDA runtime and device code for every major architecture from Pascal onwards, so it asks for nothing but a driver (CUDA toolkit is not needed):

requirement
GPU Pascal (sm_60) or newer, up to Blackwell
driver 525 or newer
glibc 2.28 or newer (RHEL 8, Ubuntu 20.04, Debian 11, …)

GPUs newer than the compiled set are covered by PTX, which the driver compiles on first use.

Building from source instead

pip falls back to a source build wherever no wheel matches, and drives the whole thing itself:

pip install .            # or: pip install -e .   for a development install

import quasarq then works from any directory, with no PYTHONPATH. The build compiles the CUDA core, cuarena and the extension through the project Makefiles, in parallel (-j8 by default), taking roughly half a minute. It targets only the building machine's GPU by default — see QUASARQ_CUDA_ARCH below.

make binding still works if you would rather build without installing; put src/binding on PYTHONPATH in that case. The published wheels are built by .github/workflows/wheels.yml inside the image described in .github/docker/manylinux-cuda.Dockerfile.

What must be present at build time

  • The CUDA toolkit (nvcc). Set CUDA_PATH if it is not at /usr/local/cuda.

  • make and cmake.

  • cuarena, found in this order: $CUARENA_DIR, then extern/cuarena, then ~/cuarena. Fetch the bundled copy with

    git submodule update --init --recursive
    

Build options

variable default meaning
QUASARQ_CUDA_ARCH native GPU target. native builds only for the machine's own GPU. Use all-major for a binary that runs on every architecture this nvcc supports, or a comma-separated list ordered lowest to highest, such as sm_80,sm_90 — the last entry also gets PTX, so newer GPUs still run.
QUASARQ_BUILD_JOBS 8 parallel compile jobs
QUASARQ_WORD_SIZE 64 tableau word size
CUARENA_DIR – explicit path to cuarena

The default -arch=native makes the result not portable to another GPU architecture. Build a redistributable binary with:

QUASARQ_CUDA_ARCH=all pip wheel .

That takes considerably longer, since every kernel is compiled for every architecture.

GPU memory

The pool is sized per run from the circuit and the shot count, which keeps a run from locking the whole device against other processes. Override it if you need to:

quasarq.set_max_device_memory("auto")   # default: size it from the circuit
quasarq.set_max_device_memory(512)      # fixed cap in MB
quasarq.set_max_device_memory(0)        # take whatever is free

Results never depend on the cap: a smaller pool only changes how many shots are simulated per chunk. auto sizes for the whole request so it does not split shots, growing the pool if a later request needs more.

Contents

  • quasarq.compile_detector_sampler(circuit, *, seed=None) returns a CompiledDetectorSampler.
  • quasarq.compile_sampler(circuit, *, seed=None) returns a CompiledMeasurementSampler.
  • quasarq.simulate(circuit) returns a Simulation, one deterministic run with no sampling. It carries num_qubits, num_measurements, measurements() in circuit order, and paulis(), one Pauli string per generator of the inverse tableau.
  • quasarq.equivalent(circuit, other) reports whether two circuits realise the same Clifford operation. Measurements are not part of that operation, so a circuit containing one is refused.
  • quasarq.Circuit(circuit) is a circuit QuaSARQ owns, built from circuit text, a stim.Circuit, or another Circuit. It reports num_qubits, num_measurements, num_detectors and num_observables.
  • quasarq.sinter is a sinter.Sampler adapter that decodes with pymatching.
  • set_verbosity, set_chunk_shots and set_max_device_memory, each with a get_ counterpart, plus set_kernel_config, device_name and version.

kernel.config holds per-size kernel launch geometry and is copied next to the extension at build time; the core locates it relative to the shared object.

Metadata

Release files for quasarq 1.7.2

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

Source distribution (sdist)

Source distribution for quasarq 1.7.2
File Size Uploaded Provenance Actions
quasarq-1.7.2.tar.gz 187.2 kB With provenance Details for quasarq-1.7.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for quasarq 1.7.2
File Actions
quasarq-1.7.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for quasarq-1.7.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
quasarq-1.7.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for quasarq-1.7.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
quasarq-1.7.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for quasarq-1.7.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
quasarq-1.7.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for quasarq-1.7.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Total release size: 90.3 MB

Release files / quasarq-1.7.2.tar.gz

Download URL quasarq-1.7.2.tar.gz
Size 187.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b18380276ca36e29580e69bf711d793d7a4315dc8fbe7d4e16bbb66170b1d874
BLAKE2b-256 checksum
How to use checksums
ec95bce690119b1120666115eaa2a4754c5e6e433586718600b907b5e11ca5aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / quasarq-1.7.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL quasarq-1.7.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 22.5 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
796e82fccbeafad0ffa01b8324d89d870a3dd6d340bb154abde276f98252095a
BLAKE2b-256 checksum
How to use checksums
ab5fc34dc76b12dae7e5ebf24c945067dbbb93531cb7a0cce1fb86753fceb08d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / quasarq-1.7.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL quasarq-1.7.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 22.5 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
11bfaa010beeadfa17255252e2c4ef367cbb9c5bb382be9d0d6efe03c9b1e0f0
BLAKE2b-256 checksum
How to use checksums
916cd6c2ab6c543ad00d4ac5b95a84d49528ace0ad1e56260c50a1ee3cc9f96c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / quasarq-1.7.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL quasarq-1.7.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 22.5 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
79fe4d6bccd50837a142c6d1df344788b613c24aef9f0849aa877e6f183397fb
BLAKE2b-256 checksum
How to use checksums
4c4fe776dcfcda8d02c04cd1052e0d10ed4ae470cf8fd709a9a9f03d28157bb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / quasarq-1.7.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL quasarq-1.7.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 22.5 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ce45e71f5a938ad304ea71683df4e8f9d4643e84ccfd3cff472493c969718ca8
BLAKE2b-256 checksum
How to use checksums
0be0c1ce118f052a25f00ccd914046946dc10cbddd597de2b33d96511fd812ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Security for quasarq 1.7.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for quasarq-1.7.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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