Strangeworks SDK Qiskit Runtime 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 Peptide design SDK is installed from a private git repo using pip
pip install strangeworks-qiskit-runtime
Test your installation by running the following
$ python
>>> import strangeworks_qiskit_runtime
>>> print(strangeworks_qiskit_runtime.__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.
import qiskit
import strangeworks
from qiskit_ibm_runtime import Session
from strangeworks_qiskit_runtime import (
StrangeworksQiskitRuntimeService,
StrangeworksSampler,
)
# 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"))
service = StrangeworksQiskitRuntimeService(channel="ibm_quantum")
session = Session(service=service, backend="ibmq_qasm_simulator")
sampler = StrangeworksSampler(session=session)
circuit = qiskit.QuantumCircuit(2)
circuit.h(0)
circuit.cx(0, 1)
circuit.measure_all()
job = sampler.run(circuit, shots=1000)
result = job.result()
Python SDK Module Reference¶
- strangeworks_qiskit_runtime package
- Submodules
- strangeworks_qiskit_runtime.runtime_client module
StrangeworksRuntimeClient
StrangeworksRuntimeClient.backend_configuration()
StrangeworksRuntimeClient.backend_properties()
StrangeworksRuntimeClient.backend_pulse_defaults()
StrangeworksRuntimeClient.close_session()
StrangeworksRuntimeClient.create_session()
StrangeworksRuntimeClient.job_get()
StrangeworksRuntimeClient.jobs_get()
StrangeworksRuntimeClient.program_run()
- strangeworks_qiskit_runtime.service module
- strangeworks_qiskit_runtime.sw_runtime_job module
Backend
StrangeworksRuntimeJob
StrangeworksRuntimeJob.backend()
StrangeworksRuntimeJob.cancel()
StrangeworksRuntimeJob.error_message()
StrangeworksRuntimeJob.interim_results()
StrangeworksRuntimeJob.job_id()
StrangeworksRuntimeJob.job_slug
StrangeworksRuntimeJob.result()
StrangeworksRuntimeJob.session_id
StrangeworksRuntimeJob.status()
StrangeworksRuntimeJob.tags
- strangeworks_qiskit_runtime.sw_session module
- Module contents