Skip to main content

Quantag Quantum Virtual Machine backend for Qiskit

Project description

QuantagVM

Quantag Quantum Virtual Machine (QVM) backend for Qiskit.

Installation

You can install the package from PyPI:

pip install quantag

Usage

Synchronous workflow (default)

from qiskit import QuantumCircuit
from quantag.vm import QuantagVM

# Create a simple circuit
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()

# Run it on QuantagVM (sync mode, results returned immediately)
backend = QuantagVM(api_key="YOUR_API_KEY",
                    backend_type="cudaq",
                    async_mode=False)

job = backend.run(qc, shots=100)
result = job.result()
print(result.get_counts())

Asynchronous workflow

In async mode, jobs are submitted to the server and you can poll for status.

from qiskit import QuantumCircuit
from quantag.vm import QuantagVM

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()

backend = QuantagVM(api_key="YOUR_API_KEY",
                    backend_type="cudaq",
                    async_mode=True)

job = backend.run(qc, shots=100)
print("Submitted async job:", job.job_id())
print("Initial status:", job.status())

# Wait until done and fetch results
result = job.result()
print("Async result:", result.get_counts())

Environment variables

Instead of hardcoding parameters, you can set environment variables.

Linux / macOS:

export QUANTAG_API_KEY="YOUR_API_KEY"
export QUANTAG_SERVER="https://quantum.quantag-it.com/api5"
export QUANTAG_BACKEND="cudaq"
export QUANTAG_ASYNC=1

Windows PowerShell:

setx QUANTAG_API_KEY "YOUR_API_KEY"
setx QUANTAG_SERVER "https://quantum.quantag-it.com/api5"
setx QUANTAG_BACKEND "cudaq"
setx QUANTAG_ASYNC 1

Then in Python you can simply do:

from qiskit import QuantumCircuit
from quantag.vm import QuantagVM

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()

backend = QuantagVM()  # picks up env vars automatically
job = backend.run(qc, shots=1000)
print(job.result().get_counts())

License

MIT License. See LICENSE file for details.

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

quantag-0.4.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

quantag-0.4.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file quantag-0.4.0.tar.gz.

File metadata

  • Download URL: quantag-0.4.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for quantag-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e6f09c1e87ed51b62a3fe02d45748699658f1045ec21a76b585604d272fbd8e1
MD5 fde575d20769f0467ee0ff39b7feea26
BLAKE2b-256 a9ba085f604674e06586fce38d3cc6c83d02f8ce41978c9e969e9b00cb0b4550

See more details on using hashes here.

File details

Details for the file quantag-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: quantag-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for quantag-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c3c1a340a2fb4c835dccdf8d85913c5cbc0eae16dcc1174b4e168c8746173af
MD5 208a6cb68ed5fdb988f6c5e8f1544272
BLAKE2b-256 178b9b33b4c1826e74df634d315d97c2316823e8279bbf327329259f20c324d1

See more details on using hashes here.

Supported by

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