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). SetCUDA_PATHif it is not at/usr/local/cuda. -
makeandcmake. -
cuarena, found in this order:
$CUARENA_DIR, thenextern/cuarena, then~/cuarena. Fetch the bundled copy withgit 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 aCompiledDetectorSampler.quasarq.compile_sampler(circuit, *, seed=None)returns aCompiledMeasurementSampler.quasarq.simulate(circuit)returns aSimulation, one deterministic run with no sampling. It carriesnum_qubits,num_measurements,measurements()in circuit order, andpaulis(), 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, astim.Circuit, or anotherCircuit. It reportsnum_qubits,num_measurements,num_detectorsandnum_observables.quasarq.sinteris asinter.Sampleradapter that decodes with pymatching.set_verbosity,set_chunk_shotsandset_max_device_memory, each with aget_counterpart, plusset_kernel_config,device_nameandversion.
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quasarq-1.7.1.tar.gz.
File metadata
- Download URL: quasarq-1.7.1.tar.gz
- Upload date:
- Size: 187.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f04532fc5a5da5a93e4e4e2c3ee402c9cfceb74cac0e75caaf083e5c240fe989
|
|
| MD5 |
9737ca4836771bb8a072e296c40e5ee8
|
|
| BLAKE2b-256 |
751e5f742570301e32aba73f714909a3482cf754f3a4783510ad1aeae42ff3db
|
Provenance
The following attestation bundles were made for quasarq-1.7.1.tar.gz:
Publisher:
wheels.yml on muhos/QuaSARQ
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quasarq-1.7.1.tar.gz -
Subject digest:
f04532fc5a5da5a93e4e4e2c3ee402c9cfceb74cac0e75caaf083e5c240fe989 - Sigstore transparency entry: 2466495043
- Sigstore integration time:
-
Permalink:
muhos/QuaSARQ@9dc38ab3e0789d7566ddb7ff3683b13f1ce4d541 -
Branch / Tag:
refs/tags/quasarq-1.7.1 - Owner: https://github.com/muhos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@9dc38ab3e0789d7566ddb7ff3683b13f1ce4d541 -
Trigger Event:
push
-
Statement type:
File details
Details for the file quasarq-1.7.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: quasarq-1.7.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 22.5 MB
- Tags: CPython 3.13, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e81fce4122293748a7347030a7fe05e7c9e4a4190c212e0b083fbc821e898c48
|
|
| MD5 |
69858674d5f640e929eae2bc9e09bf9c
|
|
| BLAKE2b-256 |
419b17952c112f698d45b3c14c2f56e45660988ce07e7a87b920e0e36bd6bf91
|
Provenance
The following attestation bundles were made for quasarq-1.7.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on muhos/QuaSARQ
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quasarq-1.7.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
e81fce4122293748a7347030a7fe05e7c9e4a4190c212e0b083fbc821e898c48 - Sigstore transparency entry: 2466495062
- Sigstore integration time:
-
Permalink:
muhos/QuaSARQ@9dc38ab3e0789d7566ddb7ff3683b13f1ce4d541 -
Branch / Tag:
refs/tags/quasarq-1.7.1 - Owner: https://github.com/muhos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@9dc38ab3e0789d7566ddb7ff3683b13f1ce4d541 -
Trigger Event:
push
-
Statement type:
File details
Details for the file quasarq-1.7.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: quasarq-1.7.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 22.5 MB
- Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e98a4b5e7ee5d119704057e9dcfbc4da2a97bd37a794f8a47de0e1f1c8013bb7
|
|
| MD5 |
dd3fef75302a9d46aaf635498eaa2433
|
|
| BLAKE2b-256 |
0577b0c0fbb3d7bbba55a35313e2db86bb8221c11072b12c6a0f0c786cd9ccd3
|
Provenance
The following attestation bundles were made for quasarq-1.7.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on muhos/QuaSARQ
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quasarq-1.7.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
e98a4b5e7ee5d119704057e9dcfbc4da2a97bd37a794f8a47de0e1f1c8013bb7 - Sigstore transparency entry: 2466495084
- Sigstore integration time:
-
Permalink:
muhos/QuaSARQ@9dc38ab3e0789d7566ddb7ff3683b13f1ce4d541 -
Branch / Tag:
refs/tags/quasarq-1.7.1 - Owner: https://github.com/muhos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@9dc38ab3e0789d7566ddb7ff3683b13f1ce4d541 -
Trigger Event:
push
-
Statement type:
File details
Details for the file quasarq-1.7.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: quasarq-1.7.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 22.5 MB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95a2455605c6581d3fead47d07b510a2bdc73b23a97208a64e1b52502cda939b
|
|
| MD5 |
21d1f1c6ae0ee96212e439e3604184ce
|
|
| BLAKE2b-256 |
b598a9c7291339487b0ce8ffbe1116e6d6c4743abc464987f99810344e4d8a7c
|
Provenance
The following attestation bundles were made for quasarq-1.7.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on muhos/QuaSARQ
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quasarq-1.7.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
95a2455605c6581d3fead47d07b510a2bdc73b23a97208a64e1b52502cda939b - Sigstore transparency entry: 2466495071
- Sigstore integration time:
-
Permalink:
muhos/QuaSARQ@9dc38ab3e0789d7566ddb7ff3683b13f1ce4d541 -
Branch / Tag:
refs/tags/quasarq-1.7.1 - Owner: https://github.com/muhos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@9dc38ab3e0789d7566ddb7ff3683b13f1ce4d541 -
Trigger Event:
push
-
Statement type:
File details
Details for the file quasarq-1.7.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: quasarq-1.7.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 22.5 MB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84b114cfbe262d0e0619838f4478be62f9a4a6c02fb73df2294cc0ce2fd983d5
|
|
| MD5 |
bd6e2f0127f759db908080b40d27ac3c
|
|
| BLAKE2b-256 |
7bbd8ef8463ff61c092897ec86a9b5d47eb6612d13270da1d70f984acebaeb82
|
Provenance
The following attestation bundles were made for quasarq-1.7.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on muhos/QuaSARQ
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quasarq-1.7.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
84b114cfbe262d0e0619838f4478be62f9a4a6c02fb73df2294cc0ce2fd983d5 - Sigstore transparency entry: 2466495097
- Sigstore integration time:
-
Permalink:
muhos/QuaSARQ@9dc38ab3e0789d7566ddb7ff3683b13f1ce4d541 -
Branch / Tag:
refs/tags/quasarq-1.7.1 - Owner: https://github.com/muhos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@9dc38ab3e0789d7566ddb7ff3683b13f1ce4d541 -
Trigger Event:
push
-
Statement type: