Skip to main content

QIR Runner

This project implements a basic QIR runtime and execution tool. Once installed, qir-runner will be available via the command line in your python environment as well as the qirrunner module which can be imported into a Python program.

Usage

Command line

Usage: qir-runner [OPTIONS] --file <PATH>

Options:
  -f, --file <PATH>        (Required) Path to the QIR file to run
  -e, --entrypoint <NAME>  Name of the entry point function to execute
  -s, --shots <NUM>        The number of times to repeat the execution of the chosen entry point in the program [default: 1]
  -r, --rngseed <NUM>      The value to use when seeding the random number generator used for quantum simulation
  -h, --help               Print help
  -V, --version            Print version

Python module

From a Python program, qirrunner provides a run function and two output helpers Output and OutputHandler. If the output_fn parameter of run is not specified, output will be written to stdout. Supplying the parameter allows the output of the execution to be captured.

from qirrunner import run, OutputHandler

path = "./runner/tests/resources/bv.bc"

handler = OutputHandler()
run(path, shots=2, output_fn=handler.handle)

print(handler.get_output())

Installation

pip install qirrunner

Installing from sdist

Platforms for which qirrunner doesn't have pre-built wheels (such as aarch64 macos), installation is available via sdist. Before installing qirrunner via pip:

  • Install a usable LLVM distribution which has llvm-config available.
  • Set the LLVM_SYS_201_PREFIX environment variable to the LLVM installation directory
    • example: export LLVM_SYS_201_PREFIX=/Users/sample/llvm
  • Install: python -m pip install qirrunner
    • This will build qirrunner from source. You will need a working Rust installation in order for this to compile.

Implemented APIs

double @__quantum__qis__arccos__body(double)
double @__quantum__qis__arcsin__body(double)
double @__quantum__qis__arctan__body(double)
double @__quantum__qis__arctan2__body(double)
void @__quantum__qis__assertmeasurementprobability__body(ptr, ptr, ptr, double, ptr, double)
void @__quantum__qis__assertmeasurementprobability__ctl(ptr, ptr)
void @__quantum__qis__barrier__body()
void @__quantum__qis__ccx__body(ptr, ptr)
void @__quantum__qis__cnot__body(ptr, ptr)
double @__quantum__qis__cos__body(double)
double @__quantum__qis__cosh__body(double)
void @__quantum__qis__cx__body(ptr, ptr)
void @__quantum__qis__cy__body(ptr, ptr)
void @__quantum__qis__cz__body(ptr, ptr)
double @__quantum__qis__drawrandomdouble__body()
i64 @__quantum__qis__drawrandomint__body()
void @__quantum__qis__dumpmachine__body()
void @__quantum__qis__exp__adj(ptr, double, ptr)
void @__quantum__qis__exp__body(ptr, double, ptr)
void @__quantum__qis__exp__ctl(ptr, ptr)
void @__quantum__qis__exp__ctladj(ptr, ptr)
void @__quantum__qis__exp__ctl(ptr, ptr)
void @__quantum__qis__h__body(ptr)
void @__quantum__qis__h__ctl(ptr, ptr)
double @__quantum__qis__ieeeremainder__body(double, double)
double @__quantum__qis__infinity__body()
i1 @__quantum__qis__isinf__body()
i1 @__quantum__qis__isnan__body()
i1 @__quantum__qis__isnegativeinfinity__body()
double @__quantum__qis__log__body(double)
ptr @__quantum__qis__m__body(ptr)
ptr @__quantum__qis__measure__body(ptr, ptr)
ptr @__quantum__qis__mresetz__body(ptr)
void @__quantum__qis__mz__body(ptr, ptr)
double @__quantum__qis__nan__body()
void @__quantum__qis__r__adj(i2, double, ptr)
void @__quantum__qis__r__body(i2, double, ptr)
void @__quantum__qis__r__ctl(ptr, ptr)
void @__quantum__qis__r__ctladj(ptr, ptr)
bool @__quantum__qis__read_result__body(ptr)
void @__quantum__qis__reset__body(ptr)
void @__quantum__qis__rx__body(double, ptr)
void @__quantum__qis__rx__ctl(ptr, ptr)
void @__quantum__qis__rxx__body(double, ptr, ptr)
void @__quantum__qis__ry__body(double, ptr)
void @__quantum__qis__ry__ctl(ptr, ptr)
void @__quantum__qis__ryy__body(double, ptr, ptr)
void @__quantum__qis__rz__body(double, ptr)
void @__quantum__qis__rz__ctl(ptr, ptr)
void @__quantum__qis__rzz__body(double, ptr, ptr)
void @__quantum__qis__s__adj(ptr)
void @__quantum__qis__s__body(ptr)
void @__quantum__qis__s__ctl(ptr, ptr)
void @__quantum__qis__s__ctladj(ptr, ptr)
void @__quantum__qis__sx__body(ptr)
double @__quantum__qis__sin__body(double)
double @__quantum__qis__sinh__body(double)
double @__quantum__qis__sqrt__body(double)
void @__quantum__qis__swap__body(ptr, ptr)
void @__quantum__qis__t__adj(ptr)
void @__quantum__qis__t__body(ptr)
void @__quantum__qis__t__ctl(ptr, ptr)
void @__quantum__qis__t__ctladj(ptr, ptr)
double @__quantum__qis__tan__body(double)
double @__quantum__qis__tanh__body(double)
void @__quantum__qis__x__body(ptr)
void @__quantum__qis__x__ctl(ptr, ptr)
void @__quantum__qis__y__body(ptr)
void @__quantum__qis__y__ctl(ptr, ptr)
void @__quantum__qis__z__body(ptr)
void @__quantum__qis__z__ctl(ptr, ptr)
ptr @__quantum__rt__array_concatenate(ptr, ptr)
ptr @__quantum__rt__array_copy(ptr, bool)
ptr @__quantum__rt__array_create_1d(i32, i64)
ptr @__quantum__rt__array_get_element_ptr_1d(ptr, i64)
i64 @__quantum__rt__array_get_size_1d(ptr)
void @__quantum__rt__array_record_output(i64, ptr)
void @__quantum__rt__array_update_alias_count(ptr, i32)
void @__quantum__rt__array_update_reference_count(ptr, i32)
ptr @__quantum__rt__bigint_add(ptr, ptr)
ptr @__quantum__rt__bigint_bitand(ptr, ptr)
ptr @__quantum__rt__bigint_bitnot(ptr)
ptr @__quantum__rt__bigint_bitor(ptr, ptr)
ptr @__quantum__rt__bigint_bitxor(ptr, ptr)
ptr @__quantum__rt__bigint_create_array(i32, ptr)
ptr @__quantum__rt__bigint_create_i64(i64)
ptr @__quantum__rt__bigint_divide(ptr, ptr)
bool @__quantum__rt__bigint_equal(ptr, ptr)
ptr @__quantum__rt__bigint_get_data(ptr)
i32 @__quantum__rt__bigint_get_length(ptr)
bool @__quantum__rt__bigint_greater(ptr, ptr)
bool @__quantum__rt__bigint_greater_eq(ptr, ptr)
ptr @__quantum__rt__bigint_modulus(ptr, ptr)
ptr @__quantum__rt__bigint_multiply(ptr, ptr)
ptr @__quantum__rt__bigint_negate(ptr)
ptr @__quantum__rt__bigint_power(ptr, i32)
ptr @__quantum__rt__bigint_shiftleft(ptr, i64)
ptr @__quantum__rt__bigint_shiftright(ptr, i64)
void @__quantum__rt__bigint_subtract(ptr, ptr)
ptr @__quantum__rt__bigint_to_string(ptr)
void @__quantum__rt__bigint_update_reference_count(ptr, i32)
void @__quantum__rt__bool_record_output(i1, ptr)
ptr @__quantum__rt__bool_to_string(i1)
ptr @__quantum__rt__callable_copy(ptr, bool)
ptr @__quantum__rt__callable_create(ptr, ptr, ptr)
void @__quantum__rt__callable_invoke(ptr, ptr, ptr)
void @__quantum__rt__callable_make_adjoint(ptr)
void @__quantum__rt__callable_make_controlled(ptr)
void @__quantum__rt__callable_update_alias_count(ptr, i32)
void @__quantum__rt__callable_update_reference_count(ptr, i32)
void @__quantum__rt__capture_update_alias_count(ptr, i32)
void @__quantum__rt__capture_update_reference_count(ptr, i32)
void @__quantum__rt__double_record_output(double, ptr)
ptr @__quantum__rt__double_to_string(double)
void @__quantum__rt__fail(ptr)
void @__quantum__rt__int_record_output(i64, ptr)
ptr @__quantum__rt__int_to_string(i64)
ptr @__quantum__rt__memory_allocate(i64)
void @__quantum__rt__message(ptr)
void @__quantum__rt__message_record_output(ptr)
ptr @__quantum__rt__pauli_to_string(i2)
ptr @__quantum__rt__qubit_allocate()
ptr @__quantum__rt__qubit_allocate_array(i64)
void @__quantum__rt__qubit_release(ptr)
void @__quantum__rt__qubit_release_array(ptr)
ptr @__quantum__rt__qubit_to_string(ptr)
bool @__quantum__rt__read_result(ptr)
bool @__quantum__rt__result_equal(ptr, ptr)
ptr @__quantum__rt__result_get_one()
ptr @__quantum__rt__result_get_zero()
void @__quantum__rt__result_record_output(ptr, ptr)
ptr @__quantum__rt__result_to_string(ptr)
void @__quantum__rt__result_update_reference_count(ptr, i32)
ptr @__quantum__rt__string_concatenate(ptr, ptr)
ptr @__quantum__rt__string_create(ptr)
bool @__quantum__rt__string_equal(ptr, ptr)
ptr @__quantum__rt__string_get_data(ptr)
i32 @__quantum__rt__string_get_length(ptr)
void @__quantum__rt__string_update_reference_count(ptr, i32)
ptr @__quantum__rt__tuple_copy(ptr, i1)
ptr @__quantum__rt__tuple_create(i64)
void @__quantum__rt__tuple_record_output(i64, ptr)
void @__quantum__rt__tuple_update_alias_count(ptr, i32)
void @__quantum__rt__tuple_update_reference_count(ptr, i32)

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

qirrunner-0.9.6-cp39-abi3-win_arm64.whl (16.2 MB view details)

Uploaded CPython 3.9+Windows ARM64

qirrunner-0.9.6-cp39-abi3-win_amd64.whl (17.8 MB view details)

Uploaded CPython 3.9+Windows x86-64

qirrunner-0.9.6-cp39-abi3-manylinux_2_38_aarch64.whl (32.5 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.38+ ARM64

qirrunner-0.9.6-cp39-abi3-manylinux_2_34_x86_64.whl (33.4 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.34+ x86-64

qirrunner-0.9.6-cp39-abi3-macosx_11_0_arm64.whl (18.1 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

qirrunner-0.9.6-cp39-abi3-macosx_10_12_x86_64.whl (19.0 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file qirrunner-0.9.6-cp39-abi3-win_arm64.whl.

File metadata

  • Download URL: qirrunner-0.9.6-cp39-abi3-win_arm64.whl
  • Upload date:
  • Size: 16.2 MB
  • Tags: CPython 3.9+, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: RestSharp/106.13.0.0

File hashes

Hashes for qirrunner-0.9.6-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 a12fb58dd480315b5a0866d36c8572393b9a2a572e108da372d520774f20e8b9
MD5 34d9a9460631e3376c4406970fcf9c91
BLAKE2b-256 651a61385bcc1c645115fbcb219a32ff7e68a8b6d5243b1beabe2ebec21032d5

See more details on using hashes here.

File details

Details for the file qirrunner-0.9.6-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: qirrunner-0.9.6-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 17.8 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: RestSharp/106.13.0.0

File hashes

Hashes for qirrunner-0.9.6-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d39c0312b9d008107be8581015d2b10ade1ce4d7ec19e6f47f9c0714df3a7da4
MD5 f9b1cb3686b8acb02ed5566ee177f48f
BLAKE2b-256 ffc23b939b70322e166d6f49c25642b35c37c677040c53c4ff3c9601e22eaaf8

See more details on using hashes here.

File details

Details for the file qirrunner-0.9.6-cp39-abi3-manylinux_2_38_aarch64.whl.

File metadata

File hashes

Hashes for qirrunner-0.9.6-cp39-abi3-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 1e7e1c40cd397f88000e9595595611d503c2ead57c6ac0dc10bdde9ddc7bddf5
MD5 a23ab20c25bb0aa3040c6a2a3f3b6a2d
BLAKE2b-256 e2112007511a5b31df750afcf43f14cc12939816a99f82bf2afd5c99e3936d95

See more details on using hashes here.

File details

Details for the file qirrunner-0.9.6-cp39-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for qirrunner-0.9.6-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6f30c68fde813946718081a31334e6cbc4b90ee4fe14955461a1c207dd297fce
MD5 82e55e82254c6485204f45b5783e9c90
BLAKE2b-256 86ed6491ad1221fc1fa1ca627e98bff0a4afcf0b0281bff8fc912700d0cba6db

See more details on using hashes here.

File details

Details for the file qirrunner-0.9.6-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qirrunner-0.9.6-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 79bf34b06f2d27ecdf767b8cb1f926c60b71c423cdf75d2883d6fa30efee33d1
MD5 b2703379865d7ed62923de8a9e821c0c
BLAKE2b-256 b5376652b4c8871c7c65cf28e806ef23475c37d74a60f295ce1ad4770dab66e7

See more details on using hashes here.

File details

Details for the file qirrunner-0.9.6-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for qirrunner-0.9.6-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 bd52fbf1912c1c24b5fab25242c012a1953b0b4d8f0c5a6c2e821dd18019b9a0
MD5 ea96e0b3cc964541d6deb0ccf4520482
BLAKE2b-256 89b9f2c8b4433c601002628d9aa67148ba265ec8c273a0c60409a6a91321d495

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.9.6 This release

6 files

0.9.5

6 files

0.9.4

6 files

0.9.3

6 files

0.9.2

6 files

0.9.1

8 files

0.9.0

5 files

0.8.3

5 files

0.8.2

5 files

0.8.1

5 files

0.8.0

5 files

0.7.6

5 files

0.7.5

4 files

0.7.4

4 files

0.7.3

4 files

0.7.2

4 files

0.7.1

4 files

0.7.0

4 files

0.6.0

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