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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for quantag-0.3.0.tar.gz
Algorithm Hash digest
SHA256 41848045c42ea63bfb15a3490407fbdeb85e33ddc313f893207ebd85a0aa3ef7
MD5 6b49ee7ed733e379ada71a09ae3555d2
BLAKE2b-256 e488b8cc3e5d5f233d410fe2995b7d2f99d85b9524b2e1032290f97f2a8ac9c8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: quantag-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d6f38d90ff22a3d79e14d37faad443e80ff4cb19d95e44bea23dde444806ce9
MD5 49b23c86bbc79d19cf0fa1a43d56ab40
BLAKE2b-256 bfcb2f215ad18838013de327cfd5567b4f840470761fdc81a403032e193dd35c

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