Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pip install -e ".[dev]"

### Open an issue

* For documentation issues relating to pages in the Start, Build, Transpile, Verify, Run, and Migration guides sections of https://docs.quantum.ibm.com, please open an issue in the [Qiskit/documentation repo](https://github.com/Qiskit/documentation/issues/new/choose) rather than the Qiskit/qiskit-ibm-runtime repo. In other words, any page that DOES NOT have `/api/` in the url should be addressed in the Qiskit/documentation repo. (Exception: the Migration guide urls contain `/api/` but are managed in the Qiskit/documentation repo.)
* For documentation issues relating to pages in the Guides, Tutorials, and Migration guides sections of https://quantum.cloud.ibm.com/docs, please open an issue in the [Qiskit/documentation repo](https://github.com/Qiskit/documentation/issues/new/choose) rather than the Qiskit/qiskit-ibm-runtime repo. In other words, any page that DOES NOT have `/api/` in the url should be addressed in the Qiskit/documentation repo. (Exception: the Migration guide urls contain `/api/` but are managed in the Qiskit/documentation repo.)
* For issues relating to API reference pages (any page that contains /api/ in the url), please open an issue in the repo specific to that API reference.

### Pull request checklist
Expand Down Expand Up @@ -219,7 +219,7 @@ Integration tests require an environment configuration and can be run against th
Sample configuration for IBM Cloud (ibm_quantum_platform)
```bash
QISKIT_IBM_TOKEN=... # IBM Cloud API key
QISKIT_IBM_URL=https://cloud.ibm.com # Cloud URL
QISKIT_IBM_URL=https://quantum.cloud.ibm.com # Cloud URL
QISKIT_IBM_INSTANCE=crn:v1:bluemix:... # The CRN value of the Quantum service instance
QISKIT_IBM_QPU=... # The Quantum Processing Unit to use
```
Expand Down
6 changes: 3 additions & 3 deletions DEPRECATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ The guiding principles are:

The public API comprises all *publicly documented* packages, modules, classes, functions, methods, and attributes.

An object is *publicly documented* if and only if it appears in [the hosted API documentation](https://docs.quantum.ibm.com/api/qiskit-ibm-runtime) for `qiskit-ibm-runtime`.
An object is *publicly documented* if and only if it appears in [the hosted API documentation](https://quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime) for `qiskit-ibm-runtime`.
The presence of a docstring in the Python source (or a `__doc__` attribute) is not sufficient to make an object publicly documented; this documentation must also be rendered in the public API documentation.

As well as the objects themselves needing to be publicly documented, the only public-API *import locations* for a given object is the location it is documented at in [the public API documentation](https://docs.quantum.ibm.com/api/qiskit-ibm-runtime), and parent modules or packages that re-export the object (if any).
For example, while it is possible to import `RuntimeEncoder` from `qiskit_ibm_runtime.utils.json`, this is not a supported part of the public API because the[`RuntimeEncoder` object is documented as being in `qiskit_ibm_runtime`](https://docs.quantum.ibm.com/api/qiskit-ibm-runtime/qiskit_ibm_runtime.RuntimeEncoder).
As well as the objects themselves needing to be publicly documented, the only public-API *import locations* for a given object is the location it is documented at in [the public API documentation](https://quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime), and parent modules or packages that re-export the object (if any).
For example, while it is possible to import `RuntimeEncoder` from `qiskit_ibm_runtime.utils.json`, this is not a supported part of the public API because the[`RuntimeEncoder` object is documented as being in `qiskit_ibm_runtime`](https://quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime/runtime-encoder).

As a rule of thumb, if you are using `qiskit-ibm-runtime`, you should import objects from the highest-level package that exports that object.

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ All quantum applications and algorithms level are fundamentally built using thes
**Primitives** are base-level functions that serve as building blocks for many quantum algorithms and applications.
Primitives accept vectorized inputs, where single circuits can be grouped with array-valued specifications. That is, one circuit can be executed for arrays of n parameter sets, n observables, or both (in the case of the estimator). Each group is called a Primitive Unified Bloc (PUB), and can be represented as a tuple.

The [primitive interfaces](https://docs.quantum.ibm.com/api/qiskit/primitives) are defined in Qiskit.
The [primitive interfaces](https://quantum.cloud.ibm.com/docs/api/qiskit/primitives) are defined in Qiskit.

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 [Primitive options](https://docs.quantum.ibm.com/api/qiskit-ibm-runtime/options) for more information.
There are several different options you can specify when calling the primitives. See [Primitive options](https://quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime/options) for more information.

### Primitive versions

Version 2 of the primitives is introduced by `qiskit-ibm-runtime` release 0.21.0. Version 1 of the primitives is no longer supported. Refer to [Migrate to the V2 primitives](https://docs.quantum.ibm.com/migration-guides/v2-primitives) on how to migratie to V2 primitives. The examples below all use V2 primitives.
Version 2 of the primitives is introduced by `qiskit-ibm-runtime` release 0.21.0. Version 1 of the primitives is no longer supported. Refer to [Migrate to the V2 primitives](https://quantum.cloud.ibm.com/docs/migration-guides/v2-primitives) on how to migratie to V2 primitives. The examples below all use V2 primitives.

### Sampler

Expand Down Expand Up @@ -279,7 +279,7 @@ This code returns `Job result is [4.] at theta = 1.575674623307102` using only n

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).
> **_NOTE:_** IBM Cloud instances are different from IBM Quantum Platform classic 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.ibm.com/account) or use the `instances()` method.

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
# Even though alabaster isn't very pretty, we use it
# over the normal qiskit-ecosystem theme because it's
# faster to build and these docs are only necessary
# so the API docs can be integrated into docs.quantum.ibm.com.
# so the API docs can be integrated into quantum.cloud.ibm.com/docs.
html_theme = "alabaster"
html_title = f"{project} {release}"

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Qiskit Runtime |release| API Docs Preview
#########################################

Qiskit Runtime docs live at docs.quantum.ibm.com and come from https://github.com/Qiskit/documentation.
Qiskit Runtime docs live at http://quantum.cloud.ibm.com/docs and come from https://github.com/Qiskit/documentation.
This site is only used to generate our API docs, which then get migrated to
https://github.com/Qiskit/documentation.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ibm_dynamic_circuits = "qiskit_ibm_runtime.transpiler.plugin:IBMDynamicTranslati
ibm_fractional = "qiskit_ibm_runtime.transpiler.plugin:IBMFractionalTranslationPlugin"

[project.urls]
documentation = "https://docs.quantum.ibm.com/"
documentation = "https://quantum.cloud.ibm.com/docs/"
repository = "https://github.com/Qiskit/qiskit-ibm-runtime"
issues = "https://github.com/Qiskit/qiskit-ibm-runtime/issues"

Expand Down
2 changes: 1 addition & 1 deletion qiskit_ibm_runtime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
can use the :meth:`QiskitRuntimeService.save_account` method to save the credentials
on disk.

Qiskit Runtime is available on IBM Cloud, and you can specify the channel with
Qiskit Runtime is available on IBM Cloud, and you can specify the channel with
``channel="ibm_cloud"`` or ``channel="ibm_quantum_platform"``.

Runtime Jobs
Expand Down
32 changes: 21 additions & 11 deletions qiskit_ibm_runtime/accounts/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@
]
]

IBM_QUANTUM_API_URL = "https://auth.quantum.ibm.com/api"
IBM_QUANTUM_PLATFORM_API_URL = "https://quantum.cloud.ibm.com"
IBM_CLOUD_API_URL = "https://cloud.ibm.com"
IBM_QUANTUM_API_URL = "https://auth.quantum.ibm.com/api"

logger = logging.getLogger(__name__)

Expand All @@ -65,9 +66,8 @@ def __init__(
"""Account constructor.

Args:
channel: Channel type, ``ibm_cloud``, ``ibm_quantum``, ``ibm_quantum_platform``.
channel: Channel type, ``ibm_quantum_platform``, ``ibm_cloud``, ``ibm_quantum``,.
token: Account token to use.
url: Authentication URL.
instance: Service instance to use.
proxies: Proxy configuration.
verify: Whether to verify server's TLS certificate.
Expand Down Expand Up @@ -148,6 +148,7 @@ def create_account(
private_endpoint=private_endpoint,
region=region,
plans_preference=plans_preference,
channel=channel,
)
else:
raise InvalidAccountError(
Expand Down Expand Up @@ -276,7 +277,7 @@ def _assert_valid_instance(instance: str) -> None:


class CloudAccount(Account):
"""Class that represents an account with channel 'ibm_cloud'."""
"""Class that represents an account with channel 'ibm_cloud' or 'ibm_quantum_platform'."""

def __init__(
self,
Expand All @@ -288,6 +289,7 @@ def __init__(
private_endpoint: Optional[bool] = False,
region: Optional[str] = None,
plans_preference: Optional[List[str]] = None,
channel: Optional[str] = "ibm_quantum_platform",
):
"""Account constructor.

Expand All @@ -298,10 +300,16 @@ def __init__(
proxies: Proxy configuration.
verify: Whether to verify server's TLS certificate.
private_endpoint: Connect to private API URL.
region: Set a region preference. Accepted values are ``us-east`` or ``eu-de``.
plans_preference: A list of account types, ordered by preference.
channel: Channel identifier. Accepted values are ``ibm_cloud`` or ``ibm_quantum_platform``.
Defaults to ``ibm_quantum_platform``.
"""
super().__init__(token, instance, proxies, verify)
resolved_url = url or IBM_CLOUD_API_URL
self.channel = "ibm_quantum_platform" # should this be ibm_quantum_platform?
resolved_url = url or (
IBM_CLOUD_API_URL if channel == "ibm_cloud" else IBM_QUANTUM_PLATFORM_API_URL
)
self.channel = channel
self.url = resolved_url
self.private_endpoint = private_endpoint
self.region = region
Expand All @@ -320,9 +328,10 @@ def resolve_crn(self) -> None:
Raises:
CloudResourceNameResolutionError: if CRN value cannot be resolved.
"""
cloud_url = self.url if "quantum" not in self.url else IBM_CLOUD_API_URL
crn = resolve_crn(
channel="ibm_cloud",
url=self.url,
channel=self.channel,
url=cloud_url,
token=self.token,
instance=self.instance,
)
Expand All @@ -343,12 +352,13 @@ def resolve_crn(self) -> None:

def list_instances(self) -> List[Dict[str, str]]:
"""Retrieve all crns with the IBM Cloud Global Search API."""
iam_url = get_iam_api_url(self.url)
cloud_url = self.url if "quantum" not in self.url else IBM_CLOUD_API_URL
iam_url = get_iam_api_url(cloud_url)
authenticator = IAMAuthenticator(self.token, url=iam_url)
client = GlobalSearchV2(authenticator=authenticator)
catalog = GlobalCatalogV1(authenticator=authenticator)
client.set_service_url(get_global_search_api_url(self.url))
catalog.set_service_url(get_global_catalog_api_url(self.url))
client.set_service_url(get_global_search_api_url(cloud_url))
catalog.set_service_url(get_global_catalog_api_url(cloud_url))
search_cursor = None
all_crns = []
while True:
Expand Down
12 changes: 8 additions & 4 deletions qiskit_ibm_runtime/accounts/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
_DEFAULT_ACCOUNT_NAME = "default"
_DEFAULT_ACCOUNT_NAME_IBM_QUANTUM = "default-ibm-quantum"
_DEFAULT_ACCOUNT_NAME_IBM_CLOUD = "default-ibm-cloud"
_DEFAULT_ACCOUNT_NAME_IBM_QUANTUM_PLATFORM = "default-ibm-quantum-platform"
_DEFAULT_CHANNEL_TYPE: ChannelType = "ibm_quantum_platform"
_CHANNEL_TYPES = [_DEFAULT_CHANNEL_TYPE, "ibm_quantum"]
_CHANNEL_TYPES = [_DEFAULT_CHANNEL_TYPE, "ibm_cloud", "ibm_quantum"]

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -102,6 +103,7 @@ def _matching_default(account_name: str) -> bool:
default_accounts = [
_DEFAULT_ACCOUNT_NAME,
_DEFAULT_ACCOUNT_NAME_IBM_QUANTUM,
_DEFAULT_ACCOUNT_NAME_IBM_QUANTUM_PLATFORM,
_DEFAULT_ACCOUNT_NAME_IBM_CLOUD,
]
if default is None:
Expand All @@ -119,7 +121,6 @@ def _matching_default(account_name: str) -> bool:
),
read_config(filename=filename).items(),
)

# filter based on input parameters
filtered_accounts = dict(
list(
Expand All @@ -131,7 +132,6 @@ def _matching_default(account_name: str) -> bool:
)
)
)

return filtered_accounts

@classmethod
Expand Down Expand Up @@ -266,5 +266,9 @@ def _get_default_account_name(cls, channel: ChannelType) -> str:
return (
_DEFAULT_ACCOUNT_NAME_IBM_QUANTUM
if channel == "ibm_quantum"
else _DEFAULT_ACCOUNT_NAME_IBM_CLOUD
else (
_DEFAULT_ACCOUNT_NAME_IBM_CLOUD
if channel == "ibm_cloud"
else _DEFAULT_ACCOUNT_NAME_IBM_QUANTUM_PLATFORM
)
)
1 change: 0 additions & 1 deletion qiskit_ibm_runtime/accounts/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def read_config(
"""Read configuration data from a JSON file."""
logger.debug("Read configuration data for '%s' from '%s'", name, filename)
_ensure_file_exists(filename)

with open(filename, encoding="utf-8") as json_file:
data = json.load(json_file)
if name is None:
Expand Down
1 change: 1 addition & 0 deletions qiskit_ibm_runtime/api/clients/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(
)
self._api = Runtime(self._session)
self._configuration_registry: Dict[str, Dict[str, Any]] = {}
self._instance = params.instance

def program_run(
self,
Expand Down
1 change: 1 addition & 0 deletions qiskit_ibm_runtime/api/rest/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def backends(
params = {}
if hgp:
params["provider"] = hgp

return self.session.get(
url, params=params, timeout=timeout, headers=self._HEADER_JSON_ACCEPT
).json()
Expand Down
6 changes: 3 additions & 3 deletions qiskit_ibm_runtime/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Batch(Session):
jobs.append(job)

For more details, check the "`Run jobs in a batch
<https://docs.quantum.ibm.com/guides/run-jobs-batch>`_" page.
<https://quantum.cloud.ibm.com/docs/guides/run-jobs-batch>`_" page.
"""

def __init__(
Expand All @@ -99,7 +99,7 @@ def __init__(
forcibly closed. Can be specified as seconds (int) or a string like "2h 30m 40s".
This value must be less than the
`system imposed maximum
<https://docs.quantum.ibm.com/guides/max-execution-time>`_.
<https://quantum.cloud.ibm.com/docs/guides/max-execution-time>`_.
create_new: If True, the POST session API endpoint will be called to create a new session.
Prevents creating a new session when ``from_id()`` is called.
Raises:
Expand All @@ -111,7 +111,7 @@ def __init__(
def _create_session(self, *, create_new: Optional[bool] = True) -> Optional[str]:
"""Create a session."""
if isinstance(self._service, QiskitRuntimeService) and create_new:
session = self._service._api_client.create_session(
session = self._service._get_api_client(self._instance).create_session(
self.backend(), self._instance, self._max_time, self._service.channel, "batch"
)
return session.get("id")
Expand Down
2 changes: 1 addition & 1 deletion qiskit_ibm_runtime/debug_tools/neat_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

""" A class to store Neat results."""
"""A class to store Neat results."""

from __future__ import annotations

Expand Down
3 changes: 2 additions & 1 deletion qiskit_ibm_runtime/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ def __init__(
* A :class:`Batch` if you are using batch execution mode.

Refer to the
`Qiskit Runtime documentation <https://docs.quantum.ibm.com/guides/execution-modes>`_.
`Qiskit Runtime documentation
<https://quantum.cloud.ibm.com/docs/guides/execution-modes>`_.
for more information about the ``Execution modes``.

options: Estimator options, see :class:`EstimatorOptions` for detailed description.
Expand Down
4 changes: 2 additions & 2 deletions qiskit_ibm_runtime/execution_span/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
Overview
========

An :class:`~.ExecutionSpans` class instance is an iterable of :class:`~.ExecutionSpan`\\s, where
each iterand gives timing information about a chunk of data. Execution spans are returned as part
An :class:`~.ExecutionSpans` class instance is an iterable of :class:`~.ExecutionSpan`\\s, where
each iterand gives timing information about a chunk of data. Execution spans are returned as part
of the metadata of a primitive job result.

Classes
Expand Down
8 changes: 4 additions & 4 deletions qiskit_ibm_runtime/fake_provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
:include-source:
:context: close-figs

# Transpile the ideal circuit to a circuit that can be
# Transpile the ideal circuit to a circuit that can be
# directly executed by the backend
transpiled_circuit = transpile(circuit, backend)
transpiled_circuit.draw('mpl', style="iqp")
Expand All @@ -67,7 +67,7 @@
:alt: Histogram output by the previous code.
:include-source:
:context: close-figs

# Run the transpiled circuit using the simulated fake backend
sampler = SamplerV2(backend)
job = sampler.run([transpiled_circuit])
Expand All @@ -79,14 +79,14 @@

Please note that the simulation is done using a noise model generated from system snapshots
obtained in the past (sometimes a few years ago) and the results are not representative of the
latest behaviors of the real quantum system that the fake backend is mimicking. If you want
latest behaviors of the real quantum system that the fake backend is mimicking. If you want
to run noisy simulations with the latest backend snapshots, you can use the ``refresh()`` method.

.. code-block:: python

from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime.fake_provider import FakeSherbrooke

# initialize service to access real backends
service = QiskitRuntimeService()

Expand Down
Loading