Skip to content

Commit

Permalink
Merge branch 'local-job-class' of https://github.com/kt474/qiskit-ibm…
Browse files Browse the repository at this point in the history
…-runtime into local-job-class
  • Loading branch information
kt474 committed Dec 19, 2024
2 parents 5add37c + 85adf9f commit 436e340
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ Integration and E2E tests require an environment configuration and can be run ag
Sample configuration for IBM Quantum
```bash
QISKIT_IBM_TOKEN=... # IBM Quantum API token
QISKIT_IBM_URL=https://auth.quantum-computing.ibm.com/api # IBM Quantum API URL
QISKIT_IBM_URL=https://auth.quantum.ibm.com/api # IBM Quantum API URL
QISKIT_IBM_INSTANCE=ibm-q/open/main # IBM Quantum provider to use (hub/group/project)
QISKIT_IBM_QPU=... # IBM Quantum Processing Unit to use
```
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ Access to IBM Quantum Platform channel is controlled by the instances (previousl

> **_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.
To view a list of your instances, visit your [account settings page](https://www.quantum.ibm.com/account) or use the `instances()` method.

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

Expand Down Expand Up @@ -352,9 +352,9 @@ If you use Qiskit, please cite as per the included [BibTeX file](https://github.
[Apache License 2.0].


[IBM Quantum]: https://www.ibm.com/quantum-computing/
[IBM Quantum login page]: https://quantum-computing.ibm.com/login
[IBM Quantum account page]: https://quantum-computing.ibm.com/account
[IBM Quantum]: https://www.ibm.com/quantum/
[IBM Quantum login page]: https://quantum.ibm.com/login
[IBM Quantum account page]: https://quantum.ibm.com/account
[contribution guidelines]: https://github.com/Qiskit/qiskit-ibm-runtime/blob/main/CONTRIBUTING.md
[code of conduct]: https://github.com/Qiskit/qiskit-ibm-runtime/blob/main/CODE_OF_CONDUCT.md
[GitHub issues]: https://github.com/Qiskit/qiskit-ibm-runtime/issues
Expand Down
2 changes: 1 addition & 1 deletion qiskit_ibm_runtime/accounts/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
AccountType = Optional[Literal["cloud", "legacy"]]
ChannelType = Optional[Literal["ibm_cloud", "ibm_quantum", "local"]]

IBM_QUANTUM_API_URL = "https://auth.quantum-computing.ibm.com/api"
IBM_QUANTUM_API_URL = "https://auth.quantum.ibm.com/api"
IBM_CLOUD_API_URL = "https://cloud.ibm.com"
logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion qiskit_ibm_runtime/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .utils.runner_result import RunnerResult


QISKIT_IBM_RUNTIME_API_URL = "https://auth.quantum-computing.ibm.com/api"
QISKIT_IBM_RUNTIME_API_URL = "https://auth.quantum.ibm.com/api"

API_TO_JOB_STATUS = {
"QUEUED": JobStatus.QUEUED,
Expand Down
9 changes: 7 additions & 2 deletions qiskit_ibm_runtime/fake_provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
Here is an example of using a fake backend for transpilation and simulation.
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -53,14 +54,17 @@
circuit.draw('mpl', style="iqp")
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
# Transpile the ideal circuit to a circuit that can be directly executed by the backend
# 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")
.. plot::
:alt: Histogram output by the previous code.
:include-source:
:context: close-figs
Expand Down Expand Up @@ -89,7 +93,8 @@
service = QiskitRuntimeService()
backend = service.backend('ibmq_manila')
# generate a simulator that mimics the real quantum system with the latest calibration results
# generate a simulator that mimics the real quantum
# system with the latest calibration results
backend_sim = AerSimulator.from_backend(backend)
Expand Down
4 changes: 2 additions & 2 deletions qiskit_ibm_runtime/qiskit_runtime_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __init__(
token: IBM Cloud API key or IBM Quantum API token.
url: The API URL.
Defaults to https://cloud.ibm.com (ibm_cloud) or
https://auth.quantum-computing.ibm.com/api (ibm_quantum).
https://auth.quantum.ibm.com/api (ibm_quantum).
filename: Full path of the file where the account is created.
Default: _DEFAULT_ACCOUNT_CONFIG_JSON_FILE
name: Name of the account to load.
Expand Down Expand Up @@ -664,7 +664,7 @@ def save_account(
token: IBM Cloud API key or IBM Quantum API token.
url: The API URL.
Defaults to https://cloud.ibm.com (ibm_cloud) or
https://auth.quantum-computing.ibm.com/api (ibm_quantum).
https://auth.quantum.ibm.com/api (ibm_quantum).
instance: The CRN (ibm_cloud) or hub/group/project (ibm_quantum).
channel: Channel type. `ibm_cloud` or `ibm_quantum`.
filename: Full path of the file where the account is saved.
Expand Down
7 changes: 6 additions & 1 deletion qiskit_ibm_runtime/runtime_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ def __init__(
this time limit, it is forcibly cancelled. Simulator jobs continue to use wall
clock time.
session_time: Length of session in seconds.
private: Boolean of whether or not the job is marked as private.
private: Boolean that indicates whether the job is marked as private. This is only
supported for ``ibm_quantum`` channel. When set to true, input parameters are not
returned, and the results can only be read once. After the results are read or after
a specified time after the job is completed, the results are deleted from the service.
When set to false, the input parameters and results follow the standard retention
behavior.
"""
self.backend = backend
self.image = image
Expand Down
19 changes: 18 additions & 1 deletion qiskit_ibm_runtime/transpiler/passes/scheduling/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
of measurement results.
.. warning::
You should not mix these scheduling passes with Qiskit's builtin scheduling
You should not mix these scheduling passes with Qiskit's built in scheduling
passes as they will negatively interact with the scheduling routines for
dynamic circuits. This includes setting ``scheduling_method`` in
:func:`~qiskit.compiler.transpile` or
Expand All @@ -49,6 +49,7 @@
for a dynamic circuit backend's execution model:
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand Down Expand Up @@ -100,6 +101,7 @@
using the :class:`PadDynamicalDecoupling` pass as shown below:
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand Down Expand Up @@ -135,6 +137,7 @@
Scheduling with old format ``c_if`` conditioned gates is not supported.
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -150,6 +153,7 @@
We may then schedule the transpiled circuit without further modification.
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -174,6 +178,7 @@
prior to your scheduling pass.
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand Down Expand Up @@ -205,6 +210,7 @@
gates to the same measurement qubit.
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -224,6 +230,7 @@
on a different qubit than the measurement qubit.
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -238,6 +245,7 @@
and will not be performed using the fast-path.
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -254,6 +262,7 @@
padded out to the duration of the longest block.
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -272,6 +281,7 @@
This behavior is also applied to the else condition of a fast-path eligible branch.
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -292,6 +302,7 @@
the standard higher latency conditional branch.
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -311,6 +322,7 @@
the conditional branch.
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -326,6 +338,7 @@
Conditional measurements are not eligible for the fast-path.
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -340,6 +353,7 @@
Similarly nested control-flow is not eligible.
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -361,6 +375,7 @@
be padded out by the scheduler to ensure they are of the same duration in Qiskit
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -380,6 +395,7 @@
qc.draw(output="mpl", style="iqp")
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand All @@ -404,6 +420,7 @@
For example:
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class PadDynamicalDecoupling(BlockBasePadder):
(including global phase).
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand Down Expand Up @@ -86,6 +87,7 @@ class PadDynamicalDecoupling(BlockBasePadder):
circ_dd.draw('mpl', style="iqp")
.. plot::
:alt: Circuit diagram output by the previous code.
:include-source:
:context: close-figs
Expand Down
2 changes: 1 addition & 1 deletion test/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _get_integration_test_config():
os.getenv("QISKIT_IBM_INSTANCE"),
os.getenv("QISKIT_IBM_QPU"),
)
channel: Any = "ibm_quantum" if url.find("quantum-computing.ibm.com") >= 0 else "ibm_cloud"
channel: Any = "ibm_quantum" if url.find("quantum.ibm.com") >= 0 else "ibm_cloud"
return channel, token, url, instance, qpu


Expand Down
4 changes: 2 additions & 2 deletions test/unit/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
_TEST_IBM_QUANTUM_ACCOUNT = Account.create_account(
channel="ibm_quantum",
token="token-x",
url="https://auth.quantum-computing.ibm.com/api",
url="https://auth.quantum.ibm.com/api",
instance="ibm-q/open/main",
)

Expand All @@ -66,7 +66,7 @@ class TestAccount(IBMTestCase):

dummy_token = "123"
dummy_ibm_cloud_url = "https://us-east.quantum-computing.cloud.ibm.com"
dummy_ibm_quantum_url = "https://auth.quantum-computing.ibm.com/api"
dummy_ibm_quantum_url = "https://auth.quantum.ibm.com/api"

def test_skip_crn_resolution_for_crn(self):
"""Test that CRN resolution is skipped if the instance value is already a CRN."""
Expand Down
8 changes: 4 additions & 4 deletions test/unit/test_client_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ def test_get_runtime_api_base_url(self) -> None:
(
"ibm_quantum",
"h/g/p",
"https://auth.quantum-computing.ibm.com/api",
"https://auth.quantum.ibm.com/api",
None,
"https://auth.quantum-computing.ibm.com/api",
"https://auth.quantum.ibm.com/api",
),
(
"ibm_cloud",
Expand All @@ -92,9 +92,9 @@ def test_get_runtime_api_base_url(self) -> None:
(
"ibm_quantum",
"h/g/p",
"https://auth.quantum-computing.ibm.com/api",
"https://auth.quantum.ibm.com/api",
lambda a, b, c: f"{a}:{b}:{c}",
"https://auth.quantum-computing.ibm.com/api:h/g/p:False",
"https://auth.quantum.ibm.com/api:h/g/p:False",
),
]
for spec in test_specs:
Expand Down
11 changes: 5 additions & 6 deletions test/unit/test_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,8 @@ def test_rzz_parametrized_angle_validation(self, angle):
backend = FakeFractionalBackend()
param = Parameter("p")

with self.subTest("parameter"):
circ = QuantumCircuit(2)
circ.rzz(param, 0, 1)
# Should run without an error
SamplerV2(backend).run(pubs=[(circ, [1])])
circ = QuantumCircuit(2)
circ.rzz(param, 0, 1)

if angle == 1:
SamplerV2(backend).run(pubs=[(circ, [angle])])
Expand All @@ -320,7 +317,9 @@ def test_rzz_parametrized_angle_validation(self, angle):

@data(("a", -1), ("b", 2), ("d", 3), (-1, 1), (1, 2), None)
def test_rzz_complex(self, flawed_params):
"""Testing rzz validation in the currently non-existing case of dynamic instructions"""
"""Testing rzz validation, a variation of test_rzz_parametrized_angle_validation which
tests a more complex case. In addition, we test the currently non-existing case of dynamic
instructions."""
# pylint: disable=not-context-manager

# FakeFractionalBackend has both fractional and dynamic instructions
Expand Down

0 comments on commit 436e340

Please sign in to comment.