Strangeworks SDK Qiskit Extension¶
The service uses the Strangeworks API accessed through the Strangeworks python SDK. For more information on the general python sdk see our docs.
To get started you will need to install the SDK and authenticate using your API key. Your API key can be found on the dashboard page of the Strangeworks platform at https://portal.strangeworks.com.
Installation¶
The Strangeworks SDK Qiskit Extension is installed using pip
pip install strangeworks_qiskit
Test your installation by running the following
$ python
>>> import strangeworks_qiskit
>>> print(strangeworks_qiskit.__version__)
Authentication¶
Authenticate using the strangeworks.authenticate()
method
$ python
>>> import strangeworks
>>> strangeworks.authenticate(api_key="<your-api-key>")
Basic Usage¶
The SDK provides a Qiskit extension that can be used to run quantum circuits on the Strangeworks platform.
from qiskit import QuantumCircuit
import strangeworks
from strangeworks_qiskit import StrangeworksProvider
# Authenticate with the Strangeworks API and set the resource for the
# product (this is only needed for products with more than one resource)
strangeworks.authenticate(api_key=os.getenv("STRANGEWORKS_API_KEY"))
strangeworks.set_resource_for_product("resource-slug", "product-slug")
# Create a quantum circuit
qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])
# Create a Strangeworks provider
provider = StrangeworksProvider()
# Create a backend
backend = provider.get_backend("ibmq_qasm_simulator")
# Run the circuit
job = qiskit.execute(qc, backend, shots=100)
print(f"status: {job.status()}")
# Get the results
r = job.result()
print(f"result: {r}")
Python SDK Module Reference¶
- strangeworks_qiskit package
- Subpackages
- Submodules
- strangeworks_qiskit.provider module
- strangeworks_qiskit.runtimes module
RuntimeJob
StrangeworksRuntimeService
StrangeworksRuntimeService.delete_job()
StrangeworksRuntimeService.delete_program()
StrangeworksRuntimeService.job()
StrangeworksRuntimeService.pprint_programs()
StrangeworksRuntimeService.program()
StrangeworksRuntimeService.programs()
StrangeworksRuntimeService.run()
StrangeworksRuntimeService.upload_program()
- Module contents