Skip to main content

Azure Quantum

Azure Quantum is a cloud service that provides access to quantum computing resources. It is a collaboration between Microsoft and a number of quantum hardware providers.

strangeworks-azureā€‹

The strangeworks-azure package provides a similar experience to Microsoft Azure.

PyPI version

šŸ“‘ Package Documentation

Installationā€‹

To get started, make sure you have Python 3.10 or 3.11 (installation) and are familiar with setting up and using virtual environments.

pip install -U pip && pip install strangeworks-azure

Authenticationā€‹

First, authenticate via the Strangeworks SDK with your api-key taken from the Portal homepage:

import strangeworks as sw
from strangeworks_azure import StrangeworksBackend

sw.authenticate(api_key)

Backendsā€‹

backends = StrangeworksBackend.get_backends()
print("Available backends:")
for backend in backends:
print(f" - {backend.name} ({backend.status})")
CompanyProcessorQubitsFrameworkProcessors
QuantinuumH2-156Azurequantinuum.qpu.h2-1
QuantinuumH1-120Azurequantinuum.qpu.h1-1
IonQAria25Azureionq.qpu.aria-1, ionq.qpu.aria-2

Disclaimer: This list of backends is subject to change at any time.

Browse pricing and availability for these backends on the Azure Quantum page.

Jobsā€‹

from strangeworks_azure import StrangeworksQuantumJob

job = StrangeworksQuantumJob.from_strangeworks_slug(job_slug)
result = job.result()

Exampleā€‹

Azure: Hello World
import strangeworks as sw
from strangeworks_azure import StrangeworksBackend
from qiskit import QuantumCircuit

sw.authenticate(api_key)

# create a simple quantum circuit
circuit = QuantumCircuit(2, 2)
circuit.h(0)
circuit.cx(0,1)
circuit.measure([0,1], [0,1])

# Choose a device (an IonQ-hosted simulator in this case)
ionq = StrangeworksBackend("ionq.simulator")

# Execute the circuit
print("\nšŸ¤– Executing Circuit...\n")

task = ionq.run(circuit, shots=100)

sw.add_tags(task.id, ["hello-world"])

# At this point, the job is running on the Strangeworks Platform.
# You can check the status of the job in the Portal.
print(f"ā³ Job {task.id} submitted!\n")

task.status()

# Lots of good info in here
result = task.result()

# View the counts (also visible in the Portal in a chart šŸ“Š)
print(f"šŸŽ‰ šŸ“Š Counts: {result.get('counts')}\n")

šŸ„³ Success! You may view your job in the portal.

šŸ˜… Something went wrong? Find us in Slack!