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.5.0.tar.gz (11.8 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.5.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for quantag-0.5.0.tar.gz
Algorithm Hash digest
SHA256 512509dc3fa2bf5f43e5d7b5bfbfa3254bc4e7bf7350a9f522d111e59085a73e
MD5 c8bad544692d41180e0b6f64b566a857
BLAKE2b-256 65ab41e30fa36cbfbc3527a6a3ef974826b5b075ddbb1f35289a0bafdd1aeb46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: quantag-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 72210ad55a4c76f545186f28141edb4ba763df426af74d4e1b9694dfa09966d7
MD5 73c8d8bbc9013c09fc5b44bbb10b574d
BLAKE2b-256 63466855df697873d8a2a0111f14af1fa72f00fe272f465f83492fa2cd1f2609

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