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.
The strangeworks-azure SDK provides a similar experience to Microsoft Azure.
note
Pricing is based on the number of quantum tasks executed.
pip install -U pip 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})")
Loading quantum backends...
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()
š¦¾
Quickstartā
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? Contact us at support@strangeworks.com for assistance.