Skip to main content

Qiskit Qrack Provider - Qrack High-Performance GPU simulation for Qiskit

Project description

qiskit-qrack-provider

This repository contains a Qrack provider for Qiskit. You must install PyQrack to use it.

Qrack is a GPU-accelerated simulator with optional pure-CPU and CPU/GPU-hybrid simulation, scaling from minimalist systems to multiple GPUs for high performance, with novel near-Clifford, Schmidt-decomposition, quantum binary decision diagram (QBDD), light-cone optimization, state vector, and other simulation techniques. This repository provides the Qrack QasmSimulator.

This provider is based on and adapted from work by the IBM Qiskit Team and QCGPU's creator, Adam Kelly. Attribution is noted in content files, where appropriate. Original contributions and adaptations were made by Daniel Strano of the VM6502Q/Qrack Team.

To use, in Qiskit:

from qiskit.providers.qrack import Qrack

backend = Qrack.get_backend('qasm_simulator')

For example, for use with unitaryfund/mitiq, creating a (noiseless) executor can be as simple as follows:

from qiskit.providers.qrack import Qrack

def executor(circuit, shots=1000):
    """Executes the input circuit and returns the noisy expectation value <A>, where A=|0><0|.
    """
    # Use the Qrack QasmSimulator backend, (but it's specifically noiseless)
    ideal_backend = Qrack.get_backend('qasm_simulator')

    # Append measurements
    circuit_to_run = circuit.copy()
    circuit_to_run.measure_all()

    # Run and get counts
    print(f"Executing circuit with {len(circuit)} gates using {shots} shots.")
    job = ideal_backend.run(circuit_to_run, shots=shots)
    counts = job.result().get_counts()

    # Compute expectation value of the observable A=|0><0|
    return counts["0"] / shots

Generally, you will need to adapt the above executor snippet to your particular purpose.

(Happy Qracking! You rock!)


License: Apache License Version 2.0, Copyright (c) Daniel Strano and the Qrack contributors 2017-2024. All rights reserved.

Project details


Download files

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

Source Distribution

qiskit_qrack_provider-0.12.5.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

qiskit_qrack_provider-0.12.5-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file qiskit_qrack_provider-0.12.5.tar.gz.

File metadata

File hashes

Hashes for qiskit_qrack_provider-0.12.5.tar.gz
Algorithm Hash digest
SHA256 f511ea7ffc0b0b113a8c4531e4b7566788d2ba34d6239c98c1c35d0817e1519d
MD5 d4433bad20f75f1fb03a785b74d33ecd
BLAKE2b-256 a3c2c278e0e79f123ad0ac1b41c550bc6abbb3ab3a20a8899c21b03335a17ba1

See more details on using hashes here.

File details

Details for the file qiskit_qrack_provider-0.12.5-py3-none-any.whl.

File metadata

File hashes

Hashes for qiskit_qrack_provider-0.12.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6c5c8067915290b85c105cc3d7d2a6e01731daeec660eb06d43d7cabe34bb3c8
MD5 d822c0c8985c90ecbc2ae3de090a7e49
BLAKE2b-256 130198c23f80390736b7024ba712c15674a86b9d786326296c07b042f85589b3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page