Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
97984d2
Remove min execution time check (#1065)
kt474 Sep 10, 2023
e956871
Update `max_execution_time` docstrings (#1059)
kt474 Sep 11, 2023
0db2da1
Removed remaining code related to Schedules (#1068)
merav-aharoni Sep 11, 2023
ea1145a
Enable datetime parameter for backend properties (#1070)
kt474 Sep 12, 2023
76603f2
Update default resilience options (#1062)
kt474 Sep 12, 2023
dd66153
fix test (#1074)
kt474 Sep 12, 2023
454844a
Prepare release 0.12.1 (#1075)
kt474 Sep 12, 2023
70c9d56
Update main branch veresion 0.12.2 (#1076)
kt474 Sep 12, 2023
3cccebd
use ibmq_qasm_simulator (#1078)
kt474 Sep 13, 2023
a52f8d3
Add reason code to error message (#1072)
kt474 Sep 13, 2023
5d0c862
Remove importing PauliSumOp, which is deprecated. (#1079)
1ucian0 Sep 14, 2023
2b08a89
Adjusts default value for optimization_level (#1082)
eginez Sep 14, 2023
b3f795e
add instance info (#1083)
beckykd Sep 14, 2023
011b232
Fix links to options in README.md (#1084)
mberna Sep 15, 2023
73e9949
Remove auth parameter (#1077)
merav-aharoni Sep 15, 2023
4e0a259
Remove opflow and algorithms from serialization tests (#1085)
ElePT Sep 19, 2023
342ba6b
RuntimeJobTimeoutError should inherit from JobTimeoutError (#1090)
merav-aharoni Sep 19, 2023
ed3f533
Allow user to define a default account as an environment variable (#1…
merav-aharoni Sep 19, 2023
5a4d101
Skip test_job_logs (#1094)
kt474 Sep 19, 2023
b7fef82
Update session max_time docstring (#1089)
kt474 Sep 19, 2023
25e0b2b
Fix unit tests against qiskit/main (#1099)
ElePT Sep 21, 2023
e924296
fix iqp link (#1096)
jyu00 Sep 21, 2023
40a5217
Only return channel strategy supported backends (#1095)
kt474 Sep 21, 2023
86eac07
Attempt to fix terra unit tests (#1102)
kt474 Sep 24, 2023
38ca3b2
Making account code more generic (#1060)
merav-aharoni Sep 25, 2023
5e7a1d0
Remove old deprecations (#1106)
kt474 Sep 26, 2023
03334e9
Open plan updates (#1105)
beckykd Sep 26, 2023
f9d37cd
New method to create a new Session object with a given id (#1101)
merav-aharoni Sep 26, 2023
0ebea4e
fix test_session_from_id (#1110)
kt474 Sep 27, 2023
23205de
Warn users if job submitted will exceed quota (#1100)
kt474 Sep 27, 2023
0b90704
Removed support for backend as session parameter (#1091)
merav-aharoni Sep 27, 2023
dd09981
Fix minor todos (#1112)
kt474 Sep 27, 2023
250cbe2
Change qpu complex wording (#1109)
beckykd Sep 28, 2023
0ea026d
Add IBM Cloud channel (#1113)
beckykd Sep 28, 2023
eb8c2ed
Prepare release 0.12.2 (#1115)
kt474 Sep 28, 2023
cc9df6e
Update main branch 0.13.0 (#1116)
kt474 Sep 28, 2023
44314ba
remove error message test (#1125)
kt474 Oct 3, 2023
999f71c
Exceptions should inherit from Terra where suitable (#1120)
merav-aharoni Oct 3, 2023
a70ce17
update docstring & remove max_time (#1137)
kt474 Oct 9, 2023
ea5dd82
Expose new session details (#1119)
kt474 Oct 10, 2023
a20fa88
Support only LocalFoldingAmplifier as noise_amplifier option (#1093)
merav-aharoni Oct 11, 2023
8cf5cae
Fix target_history date bug (#1143)
kt474 Oct 11, 2023
d97d9ac
Fixed bug when defining shots as int64 (#1151)
merav-aharoni Oct 17, 2023
07652f1
Log instance on initialization and when running a job (#1150)
kt474 Oct 17, 2023
4b8498e
Move methods into class pages for docs (#1144)
arnaucasau Oct 17, 2023
dec592f
Fix link to `Close a session` (#1152)
mriedem Oct 17, 2023
faeee1d
logging instance test is IQP channel only (#1154)
kt474 Oct 17, 2023
4098aaf
Update deploy yml (#1148)
kt474 Oct 18, 2023
0ddaee0
Allow users to indicate they are done submitting jobs to a session (#…
kt474 Oct 18, 2023
ab74d1b
Prepare release 0.13 (#1157)
kt474 Oct 18, 2023
5da6a7d
Update main branch 0.13.1 (#1158)
kt474 Oct 18, 2023
dc3b1d0
Update Sphinx theme (#1156)
arnaucasau Oct 19, 2023
b4abf6a
Added IBM Quantum logo (#1164)
arnaucasau Oct 24, 2023
226b9df
sessions changes (#1169)
beckykd Oct 24, 2023
cf2f795
Disallow unsupported options (#1108)
merav-aharoni Oct 26, 2023
cf0d816
Merge branch 'main' of https://github.com/Qiskit/qiskit-ibm-runtime i…
jyu00 Oct 27, 2023
989a321
fix merge issues
jyu00 Oct 27, 2023
11c30cc
black
jyu00 Oct 30, 2023
e6ef47f
lint
jyu00 Oct 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ on:
jobs:
Deploy:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
strategy:
matrix:
python-version: [3.9]
Expand All @@ -28,12 +31,12 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install deps
run: pip install -U pip setuptools build
- name: Build sdist
run: python3 -m build
- uses: actions/upload-artifact@v3
with:
path: ./dist/*
- name: Deploy to Pypi
env:
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_USERNAME: qiskit
run : |
pip install -U twine pip setuptools virtualenv wheel
python3 setup.py sdist bdist_wheel
twine upload dist/qiskit*
shell: bash
uses: pypa/gh-action-pypi-publish@release/v1
60 changes: 45 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

**Qiskit** is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.

**Qiskit IBM Runtime** is a new environment offered by IBM Quantum that streamlines quantum computations and provides optimal
implementations of the Qiskit primitives `sampler` and `estimator` for IBM Quantum hardware. It is designed to use additional classical compute resources to execute quantum circuits with more efficiency on quantum processors, by including near-time computations such as error suppression and error mitigation. Examples of error suppression include dynamical decoupling, noise-aware compilation, error mitigation including readout mitigation, zero-noise extrapolation (ZNE), and probabilistic error cancellation (PEC).
**Qiskit IBM Runtime** is a new environment offered by IBM Quantum that streamlines quantum computations and provides optimal
implementations of the Qiskit primitives `sampler` and `estimator` for IBM Quantum hardware. It is designed to use additional classical compute resources to execute quantum circuits with more efficiency on quantum processors, by including near-time computations such as error suppression and error mitigation. Examples of error suppression include dynamical decoupling, noise-aware compilation, error mitigation including readout mitigation, zero-noise extrapolation (ZNE), and probabilistic error cancellation (PEC).

Using the runtime service, a research team at IBM Quantum was able to achieve a 120x speedup
in their lithium hydride simulation. For more information, see the
Expand All @@ -30,8 +30,6 @@ pip install qiskit-ibm-runtime

### Qiskit Runtime service on IBM Quantum Platform

The default method for using the runtime service is IBM Quantum Platform.

You will need your IBM Quantum API token to authenticate with the runtime service:

1. Create an IBM Quantum account or log in to your existing account by visiting the [IBM Quantum login page].
Expand Down Expand Up @@ -114,7 +112,7 @@ All quantum applications and algorithms level are fundamentally built using thre

The IBM Runtime service offers these primitives with additional features, such as built-in error suppression and mitigation.

There are several different options you can specify when calling the primitives. See [`qiskit_ibm_runtime.Options`](https://github.com/Qiskit/qiskit-ibm-runtime/blob/main/qiskit_ibm_runtime/options.py#L103) class for more information.
There are several different options you can specify when calling the primitives. See [`qiskit_ibm_runtime.Options`](https://github.com/Qiskit/qiskit-ibm-runtime/blob/main/qiskit_ibm_runtime/options/options.py#L33) class for more information.

### Sampler

Expand All @@ -138,7 +136,7 @@ bell.cx(0, 1)
# 2. Map the qubits to a classical register in ascending order
bell.measure_all()

# 3. Execute using the Sampler primitive
# 3. Execute using the Sampler primitive
backend = service.get_backend('ibmq_qasm_simulator')
sampler = Sampler(backend=backend, options=options)
job = sampler.run(circuits=bell)
Expand Down Expand Up @@ -174,14 +172,14 @@ qc_example.cx(0, 2) # condition 2nd qubit on 0th qubit
# 2. the observable to be measured
M1 = SparsePauliOp.from_list([("XXY", 1), ("XYX", 1), ("YXX", 1), ("YYY", -1)])

# batch of theta parameters to be executed
# batch of theta parameters to be executed
points = 50
theta1 = []
for x in range(points):
theta = [x*2.0*np.pi/50]
theta1.append(theta)

# 3. Execute using the Estimator primitive
# 3. Execute using the Estimator primitive
backend = service.get_backend('ibmq_qasm_simulator')
estimator = Estimator(backend, options=options)
job = estimator.run(circuits=[qc_example]*points, observables=[M1]*points, parameter_values=theta1)
Expand All @@ -197,7 +195,7 @@ This code batches together 50 parameters to be executed in a single job. If a us
In many algorithms and applications, an Estimator needs to be called iteratively without incurring queuing delays on each iteration. To solve this, the IBM Runtime service provides a **Session**. A session starts when the first job within the session is started, and subsequent jobs within the session are prioritized by the scheduler.

You can use the [`qiskit_ibm_runtime.Session`](https://github.com/Qiskit/qiskit-ibm-runtime/blob/main/qiskit_ibm_runtime/session.py) class to start a
session. Consider the same example above and try to find the optimal `theta`. The following example uses the [golden search method](https://en.wikipedia.org/wiki/Golden-section_search) to iteratively find the optimal theta that maximizes the observable.
session. Consider the same example above and try to find the optimal `theta`. The following example uses the [golden search method](https://en.wikipedia.org/wiki/Golden-section_search) to iteratively find the optimal theta that maximizes the observable.

To invoke the `Estimator` primitive within a session:

Expand All @@ -224,15 +222,15 @@ qc_example.cx(0, 2) # condition 2nd qubit on 0th qubit
M1 = SparsePauliOp.from_list([("XXY", 1), ("XYX", 1), ("YXX", 1), ("YYY", -1)])


gr = (np.sqrt(5) + 1) / 2 # golden ratio
gr = (np.sqrt(5) + 1) / 2 # golden ratio
thetaa = 0 # lower range of theta
thetab = 2*np.pi # upper range of theta
tol = 1e-1 # tol
tol = 1e-1 # tol

# 3. Execute iteratively using the Estimator primitive
# 3. Execute iteratively using the Estimator primitive
with Session(service=service, backend="ibmq_qasm_simulator") as session:
estimator = Estimator(session=session, options=options)
#next test range
#next test range
thetac = thetab - (thetab - thetaa) / gr
thetad = thetaa + (thetab - thetaa) / gr
while abs(thetab - thetaa) > tol:
Expand All @@ -245,8 +243,8 @@ with Session(service=service, backend="ibmq_qasm_simulator") as session:
thetaa = thetac
thetac = thetab - (thetab - thetaa) / gr
thetad = thetaa + (thetab - thetaa) / gr
# Final job to evaluate Estimator at midpoint found using golden search method

# Final job to evaluate Estimator at midpoint found using golden search method
theta_mid = (thetab + thetaa) / 2
job = estimator.run(circuits=qc_example, observables=M1, parameter_values=theta_mid)
print(f"Session ID is {session.session_id}")
Expand All @@ -256,6 +254,38 @@ with Session(service=service, backend="ibmq_qasm_simulator") as session:

This code returns `Job result is [4.] at theta = 1.575674623307102` using only nine iterations. This is a very powerful extension to the primitives. However, using too much code between iterative calls can lock the QPU and use excessive QPU time, which is expensive. We recommend only using sessions when needed. The Sampler can also be used within a session, but there are not any well-defined examples for this.

## Instances

Access to IBM Quantum Platform channel is controlled by the instances (previously called providers) to which you are assigned. An instance is defined by a hierarchical organization of hub, group, and project. A hub is the top level of a given hierarchy (organization) and contains within it one or more groups. These groups are in turn populated with projects. The combination of hub/group/project is called an instance. Users can belong to more than one instance at any time.

> **_NOTE:_** IBM Cloud instances are different from IBM Quantum Platform instances. IBM Cloud does not use the hub/group/project structure for user management. To view and create IBM Cloud instances, visit the [IBM Cloud Quantum Instances page](https://cloud.ibm.com/quantum/instances).

To view a list of your instances, visit your [account settings page](https://www.quantum-computing.ibm.com/account) or use the `instances()` method.

You can specify an instance when initializing the service or provider, or when picking a backend:

```python
# Optional: List all the instances you can access.
service = QiskitRuntimeService(channel='ibm_quantum')
print(service.instances())

# Optional: Specify the instance at service level. This becomes the default unless overwritten.
service = QiskitRuntimeService(channel='ibm_quantum', instance="hub1/group1/project1")
backend1 = service.backend("ibmq_manila")

# Optional: Specify the instance at the backend level, which overwrites the service-level specification when this backend is used.
backend2 = service.backend("ibmq_manila", instance="hub2/group2/project2")

sampler1 = Sampler(backend=backend1) # this will use hub1/group1/project1
sampler2 = Sampler(backend=backend2) # this will use hub2/group2/project2
```

If you do not specify an instance, then the code will select one in the following order:

1. If your account only has access to one instance, it is selected by default.
2. If your account has access to multiple instances, but only one can access the requested backend, the instance with access is selected.
3. In all other cases, the code selects the first instance other than ibm-q/open/main that has access to the backend.

## Access your IBM Quantum backends

A **backend** is a quantum device or simulator capable of running quantum circuits or pulse schedules.
Expand Down
10 changes: 3 additions & 7 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@

.. rubric:: Attributes

.. autosummary::
:toctree: ../stubs/
{% for item in all_attributes %}
{%- if not item.startswith('_') %}
{{ name }}.{{ item }}
.. autoattribute:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% endif %}
Expand All @@ -32,16 +30,14 @@

.. rubric:: Methods

.. autosummary::
:toctree: ../stubs/
{% for item in all_methods %}
{%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{{ name }}.{{ item }}
.. automethod:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% for item in inherited_members %}
{%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{{ name }}.{{ item }}
.. automethod:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}

Expand Down
2 changes: 1 addition & 1 deletion docs/cloud/cost.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Time limits on programs

The maximum execution time for the Sampler primitive is 10000 seconds (2.78 hours). The maximum execution time for the Estimator primitive is 18000 seconds (5 hours).

Additionally, the system limit on the job execution time is 3 hours for a job that is running on a simulator and 8 hours for a job running on a physical system.
Additionally, the system limit on the system execution time is 3 hours for a job that is running on a simulator and 8 hours for a job running on a physical system.

How to limit your cost
***********************
Expand Down
18 changes: 10 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '0.12.1'
release = '0.13.1'

docs_url_prefix = "ecosystem/ibm-runtime"

Expand Down Expand Up @@ -146,18 +146,20 @@

# -- Options for HTML output -------------------------------------------------

html_theme = 'qiskit_sphinx_theme'
html_theme = "qiskit-ecosystem"
html_title = f"{project} {release}"

html_logo = 'images/logo.png'
html_last_updated_fmt = '%Y/%m/%d'
html_logo = "images/ibm-quantum-logo.png"

html_theme_options = {
'logo_only': True,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': True,
# Because this is an IBM-focused project, we use a blue color scheme.
"light_css_variables": {
"color-brand-primary": "var(--qiskit-color-blue)",
},
}

html_last_updated_fmt = '%Y/%m/%d'

html_sourcelink_suffix = ''

autoclass_content = 'both'
50 changes: 11 additions & 39 deletions docs/faqs/max_execution_time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ a job exceeds this time limit, it is forcibly cancelled and a ``RuntimeJobMaxTim
exception is raised.

.. note::
As of August 7, 2023, the ``max_execution_time`` value is based on quantum
time instead of wall clock time. Quantum time represents the time that the QPU
As of August 7, 2023, the ``max_execution_time`` value is based on system execution time, which is the time that the QPU
complex (including control software, control electronics, QPU, and so on) is engaged in
processing the job.
processing the job, instead of wall clock time.

Simulator jobs continue to use wall clock time because they do not have quantum time.
Simulator jobs continue to use wall clock time.

You can set the maximum execution time (in seconds) on the job options by using one of the following methods:

Expand All @@ -32,12 +31,12 @@ You can set the maximum execution time (in seconds) on the job options by using
# Create the options object with attributes and values
options = {"max_execution_time": 360}

You can also find quantum time used by previously completed jobs by using:
You can also find the system execution time for previously completed jobs by using:

.. code-block:: python

# Find quantum time used by the job
print(f"Quantum time used by job {job.job_id()} was {job.metrics()['usage']['quantum_seconds']} seconds")
# Find the system execution time
print(f"Job {job.job_id()} system execution time was {job.metrics()['usage']['seconds']} seconds")

In addition, the system calculates an appropriate job timeout value based on the
input circuits and options. This system-calculated timeout is currently capped
Expand All @@ -48,42 +47,15 @@ For example, if you specify ``max_execution_time=5000``, but the system determin
it should not take more than 5 minutes (300 seconds) to execute the job, then the job will be
cancelled after 5 minutes.

Session time limits
***************************

When a session is started, it is assigned a maximum session timeout value.
After this timeout is reached, the session is terminated, any jobs that are already running continue running, and any queued jobs that remain in the session are put into a ``failed`` state.
You can set the maximum session timeout value using the ``max_time`` parameter:

.. code-block:: python

# Set the session max time
with Session(max_time="1h"):
...

If you don't specify a session ``max_time``, the system defaults are used:

+--------------+------------------+--------------+-----------+
| Primitive programs | Private programs |
+==============+==================+==============+===========+
| Premium User | Open User | Premium User | Open User |
+--------------+------------------+--------------+-----------+
| 8h | 4h | 8h | N/A |
+--------------+------------------+--------------+-----------+

Note that a *premium user* here means a user who has access to backends in providers other than ``ibm-q/open/main``.

.. note::
Session ``max_time`` is based on wall clock time, not quantum time.


Additionally, there is a 5 minute *interactive* timeout value. If there are no session jobs queued within that window, the session is temporarily deactivated and normal job selection resumes. During job selection, if the job scheduler gets a new job from the session and its maximum timeout value has not been reached, the session is reactivated until its maximum timeout value is reached.
Session maximum execution time
*******************************

.. note:: The timer for the session's ``max_time`` is not paused during any temporary deactivation periods.
When a session is started, it is assigned a maximum session timeout value. After this timeout is reached, the session is terminated, any jobs that are already running continue running, and any queued jobs that remain in the session are put into a failed state. For instructions to set the session maximum time, see `Specify the session length <../how_to/run_session#session_length.html>`__.


Other limitations
***************************

- Programs cannot exceed 750KB in size.
- Inputs to jobs cannot exceed 64MB in size.
- Inputs to jobs cannot exceed 64MB in size.
- Open plan users can use up to 10 minutes of system execution time per month (resets at 00:00 UTC on the first of each month). System execution time is the amount of time that the system is dedicated to processing your job. You can track your monthly usage on the `Platform dashboard, <https://quantum-computing.ibm.com/>`__ `Jobs, <https://quantum-computing.ibm.com/jobs>`__ and `Account <https://quantum-computing.ibm.com/account>`__ page.
8 changes: 3 additions & 5 deletions docs/how_to/backends.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,9 @@ If you are using a runtime session, add the ``backend`` option when starting you

service = QiskitRuntimeService()
with Session(service=service, backend="ibmq_qasm_simulator") as session:
estimator = Estimator(session=session, options=options)
job = estimator.run(circuit, observable)
result = job.result()
# Close the session only if all jobs are finished, and you don't need to run more in the session
session.close() # Closes the session
estimator = Estimator(session=session, options=options)
job = estimator.run(circuit, observable)
result = job.result()

display(circuit.draw("mpl"))
print(f" > Observable: {observable.paulis}")
Expand Down
Loading