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.
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})")
Company | Processor | Qubits | Framework | Processors |
---|---|---|---|---|
Quantinuum | H2-1 | 56 | Azure | quantinuum.qpu.h2-1 |
Quantinuum | H1-1 | 20 | Azure | quantinuum.qpu.h1-1 |
IonQ | Aria | 25 | Azure | ionq.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!