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 budled 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)CompiledDetectorSampler
  • quasarq.compile_sampler(circuit, *, seed=None)CompiledMeasurementSampler
  • quasarq.sinter — a sinter.Sampler adapter that decodes with pymatching
  • set_verbosity, set_chunk_shots, set_kernel_config, device_name, 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quasarq-1.7.0.tar.gz (187.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

quasarq-1.7.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (22.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

quasarq-1.7.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (22.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

quasarq-1.7.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (22.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

quasarq-1.7.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (22.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file quasarq-1.7.0.tar.gz.

File metadata

  • Download URL: quasarq-1.7.0.tar.gz
  • Upload date:
  • Size: 187.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for quasarq-1.7.0.tar.gz
Algorithm Hash digest
SHA256 001ae52950281dc5b4099ae1e6c8b2773792f4ae85ef5ff653e43646c564650f
MD5 bfae62c996a58c9799d66b0073882405
BLAKE2b-256 8b3fb02452916f28b6ec2ca966eecfd78ce645e3277ae9eff5ba262a14e1c56d

See more details on using hashes here.

Provenance

The following attestation bundles were made for quasarq-1.7.0.tar.gz:

Publisher: wheels.yml on muhos/QuaSARQ

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quasarq-1.7.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for quasarq-1.7.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cec014b22b1f9e534289c4cf1b369436423f6c6a8a2cedb3561b27c6fa5e2ea4
MD5 9f548d8ec50b3a75eb31afd6e62d176d
BLAKE2b-256 59b4d1f339f24b5f54212c02f51df6cf124bf791007535424a4d184624af4ca5

See more details on using hashes here.

Provenance

The following attestation bundles were made for quasarq-1.7.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on muhos/QuaSARQ

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quasarq-1.7.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for quasarq-1.7.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1998c3609bdf5b7ec93641c194affb3fd162ace795232392300309f7276a5d76
MD5 67ae16d2b6eb0e226c5b7b8a90e88db8
BLAKE2b-256 b6ab1b9e8dc824ee9441945d3e4bdc79af1efaa3ed00081911844f6fb923cd3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for quasarq-1.7.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on muhos/QuaSARQ

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quasarq-1.7.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for quasarq-1.7.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2bd35c3edad586bc761cbd191f895dfed9c8b39a530796f8b92e9c581d56192e
MD5 2a64b4d2d20813cd7f3ffc352450b000
BLAKE2b-256 4efbb3994cb0b4a9181ea3c02057683853d5cb3f513d30e51f786b963e9e37b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for quasarq-1.7.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on muhos/QuaSARQ

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quasarq-1.7.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for quasarq-1.7.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 551be513c2a15c79f504201bcb9cf46f93923590c5f537d058000570729e307e
MD5 4ac825f84e899e17d32d6f73cb07aec6
BLAKE2b-256 7fe9bd438ceca88f093d3fc6f39d3952a944660844a4118bf9f2eeaeef30a2c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for quasarq-1.7.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on muhos/QuaSARQ

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.7.2

5 files

1.7.1

5 files

This release

1.7.0 This release

5 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