Skip to content

Commit 7d6742b

Browse files
authored
Merge f199732 into e00218a
2 parents e00218a + f199732 commit 7d6742b

File tree

4 files changed

+187
-66
lines changed

4 files changed

+187
-66
lines changed

Untitled.ipynb

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 8,
6+
"id": "993765f0-ea6b-405c-bc85-d3d1a7a07096",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
" from qiskit_ibm_runtime import QiskitRuntimeService\n",
11+
" service = QiskitRuntimeService.save_account(\n",
12+
" token=token, # Your token is confidential.\n",
13+
" # Do not share your key in public code.\n",
14+
" instance=\"crn:v1:bluemix:public:quantum-computing:us-east:a/0c948648d03644309c478e42933a2db9:e51702e8-1d09-4af6-8f07-324073b86a34::\",\n",
15+
" name=\"open\", # Optionally name this set of account credentials.\n",
16+
" set_as_default=True, # Optionally set these as your default credentials.\n",
17+
" overwrite=True\n",
18+
" )"
19+
]
20+
},
21+
{
22+
"cell_type": "code",
23+
"execution_count": 10,
24+
"id": "236b9060-3488-460b-9c61-e89d1b4abbf1",
25+
"metadata": {},
26+
"outputs": [
27+
{
28+
"name": "stdout",
29+
"output_type": "stream",
30+
"text": [
31+
"[]\n"
32+
]
33+
}
34+
],
35+
"source": [
36+
"print(service.instances())"
37+
]
38+
},
39+
{
40+
"cell_type": "code",
41+
"execution_count": 14,
42+
"id": "ac1df417-149c-4399-832d-4b31b9e6af1d",
43+
"metadata": {},
44+
"outputs": [
45+
{
46+
"data": {
47+
"text/plain": [
48+
"[]"
49+
]
50+
},
51+
"execution_count": 14,
52+
"metadata": {},
53+
"output_type": "execute_result"
54+
}
55+
],
56+
"source": [
57+
"service.instances()"
58+
]
59+
},
60+
{
61+
"cell_type": "code",
62+
"execution_count": 16,
63+
"id": "47e07def-a069-4445-9022-34f3dead4ae7",
64+
"metadata": {},
65+
"outputs": [],
66+
"source": [
67+
"service = QiskitRuntimeService(instance=\"crn:v1:bluemix:public:quantum-computing:us-east:a/0c948648d03644309c478e42933a2db9:e51702e8-1d09-4af6-8f07-324073b86a34::\")\n",
68+
"backend1 = service.backend(\"ibm_brisbane\")"
69+
]
70+
},
71+
{
72+
"cell_type": "code",
73+
"execution_count": 17,
74+
"id": "9a9a2eea-622a-49f9-a841-1bb46eb0b252",
75+
"metadata": {},
76+
"outputs": [],
77+
"source": [
78+
"from qiskit_ibm_runtime import SamplerV2 as sampler"
79+
]
80+
},
81+
{
82+
"cell_type": "code",
83+
"execution_count": 19,
84+
"id": "1e2bd227-ebc5-4987-951d-511a0d141dcc",
85+
"metadata": {},
86+
"outputs": [],
87+
"source": [
88+
"sampler1 = sampler(mode=backend1)"
89+
]
90+
},
91+
{
92+
"cell_type": "code",
93+
"execution_count": 20,
94+
"id": "0017763b-63b3-4c75-a25a-3bce92a2f3c6",
95+
"metadata": {},
96+
"outputs": [
97+
{
98+
"ename": "IBMInputValueError",
99+
"evalue": "\"The 'instance' keyword is only supported for ``ibm_quantum`` runtime.\"",
100+
"output_type": "error",
101+
"traceback": [
102+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
103+
"\u001b[1;31mIBMInputValueError\u001b[0m Traceback (most recent call last)",
104+
"Cell \u001b[1;32mIn[20], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m backend2 \u001b[38;5;241m=\u001b[39m \u001b[43mservice\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbackend\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mibm_torino\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43minstance\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mcrn:v1:bluemix:public:quantum-computing:us-east:a/0c948648d03644309c478e42933a2db9:e51702e8-1d09-4af6-8f07-324073b86a34::\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
105+
"File \u001b[1;32mC:\\1docs\\.venv\\Lib\\site-packages\\qiskit_ibm_runtime\\qiskit_runtime_service.py:760\u001b[0m, in \u001b[0;36mQiskitRuntimeService.backend\u001b[1;34m(self, name, instance, use_fractional_gates)\u001b[0m\n\u001b[0;32m 728\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mbackend\u001b[39m(\n\u001b[0;32m 729\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[0;32m 730\u001b[0m name: \u001b[38;5;28mstr\u001b[39m,\n\u001b[0;32m 731\u001b[0m instance: Optional[\u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[0;32m 732\u001b[0m use_fractional_gates: Optional[\u001b[38;5;28mbool\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 733\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Backend:\n\u001b[0;32m 734\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Return a single backend matching the specified filtering.\u001b[39;00m\n\u001b[0;32m 735\u001b[0m \n\u001b[0;32m 736\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 758\u001b[0m \u001b[38;5;124;03m QiskitBackendNotFoundError: if no backend could be found.\u001b[39;00m\n\u001b[0;32m 759\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 760\u001b[0m backends \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbackends\u001b[49m\u001b[43m(\u001b[49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43minstance\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minstance\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43muse_fractional_gates\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muse_fractional_gates\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 761\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m backends:\n\u001b[0;32m 762\u001b[0m cloud_msg_url \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\n",
106+
"File \u001b[1;32mC:\\1docs\\.venv\\Lib\\site-packages\\qiskit_ibm_runtime\\qiskit_runtime_service.py:519\u001b[0m, in \u001b[0;36mQiskitRuntimeService.backends\u001b[1;34m(self, name, min_num_qubits, instance, dynamic_circuits, filters, use_fractional_gates, **kwargs)\u001b[0m\n\u001b[0;32m 517\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 518\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m instance:\n\u001b[1;32m--> 519\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m IBMInputValueError(\n\u001b[0;32m 520\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mThe \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124minstance\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m keyword is only supported for ``ibm_quantum`` runtime.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 521\u001b[0m )\n\u001b[0;32m 522\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m backend_name \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backend_allowed_list:\n\u001b[0;32m 523\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m backend \u001b[38;5;241m:=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_create_backend_obj(\n\u001b[0;32m 524\u001b[0m backend_name,\n\u001b[0;32m 525\u001b[0m instance\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_account\u001b[38;5;241m.\u001b[39minstance,\n\u001b[0;32m 526\u001b[0m use_fractional_gates\u001b[38;5;241m=\u001b[39muse_fractional_gates,\n\u001b[0;32m 527\u001b[0m ):\n",
107+
"\u001b[1;31mIBMInputValueError\u001b[0m: \"The 'instance' keyword is only supported for ``ibm_quantum`` runtime.\""
108+
]
109+
}
110+
],
111+
"source": [
112+
"backend2 = service.backend(\"ibm_torino\", instance=\"crn:v1:bluemix:public:quantum-computing:us-east:a/0c948648d03644309c478e42933a2db9:e51702e8-1d09-4af6-8f07-324073b86a34::\")"
113+
]
114+
},
115+
{
116+
"cell_type": "code",
117+
"execution_count": null,
118+
"id": "680fd968-925b-4283-920d-0eedb2c70e0e",
119+
"metadata": {},
120+
"outputs": [],
121+
"source": []
122+
}
123+
],
124+
"metadata": {
125+
"kernelspec": {
126+
"display_name": "Python 3 (ipykernel)",
127+
"language": "python",
128+
"name": "python3"
129+
},
130+
"language_info": {
131+
"codemirror_mode": {
132+
"name": "ipython",
133+
"version": 3
134+
},
135+
"file_extension": ".py",
136+
"mimetype": "text/x-python",
137+
"name": "python",
138+
"nbconvert_exporter": "python",
139+
"pygments_lexer": "ipython3",
140+
"version": "3.12.2"
141+
}
142+
},
143+
"nbformat": 4,
144+
"nbformat_minor": 5
145+
}

docs/guides/cloud-setup.mdx

+12-14
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ The [updated version of IBM Quantum Platform](https://quantum.cloud.ibm.com/) is
4242
</Admonition>
4343

4444
1. Find your access credentials.
45-
1. Find your API key. From the [API keys page](https://cloud.ibm.com/iam/apikeys), view or create your API key, then copy it to a secure location so you can use it for authentication.
46-
2. Find your Cloud Resource Name (CRN). Open the [Instances page](https://cloud.ibm.com/quantum/instances) and click your instance. In the page that opens, click the icon to copy your CRN. Save it in a secure location so you can use it for authentication.
45+
1. Find your API key. From the [dashboard](https://quantum.cloud.ibm.com/), create your API key, then copy it to a secure location so you can use it for authentication.
46+
2. Find your Cloud Resource Name (CRN) from the Instances section of the dashboard. Click the icon to copy your CRN for the instance you want to use, then save it in a secure location so you can use it for authentication.
4747

4848
1. <span id="cloud-save"></span>**If you are working in a trusted Python environment (such as on a personal laptop or workstation),** use the `save_account()` method to save your credentials locally. ([Skip to the next step](#cloud-untrusted) if you are not using a trusted environment, such as a shared or public computer, to authenticate to IBM Cloud.) To use `save_account()`, activate a Python virtual environment (see the [installation instructions](/docs/guides/install-qiskit#local) if you do not already have a virtual environment set up). Then, run Python in your virtual environment and enter the following:
4949

@@ -52,17 +52,16 @@ The [updated version of IBM Quantum Platform](https://quantum.cloud.ibm.com/) is
5252
token = "<your-API-token>"
5353
```
5454

55-
```python
56-
from qiskit_ibm_runtime import QiskitRuntimeService
57-
service = QiskitRuntimeService.save_account(
58-
channel="ibm_cloud", # `channel` distinguishes between different account types
59-
token=token, # Your token is confidential.
60-
# Do not share your key in public code.
61-
instance="<IBM Cloud CRN>",
62-
name="<account-name>", # Optionally name this set of account credentials.
63-
set_as_default=True, # Optionally set these as your default credentials.
64-
)
65-
```
55+
```python
56+
from qiskit_ibm_runtime import QiskitRuntimeService
57+
service = QiskitRuntimeService.save_account(
58+
token=token, # Your token is confidential.
59+
# Do not share your key in public code.
60+
instance="<IBM Cloud CRN>",
61+
name="<account-name>", # Optionally name this set of account credentials.
62+
set_as_default=True, # Optionally set these as your default credentials.
63+
)
64+
```
6665

6766
1. Type `exit()`. From now on, whenever you need to authenticate to the service, you can load your credentials with `QiskitRuntimeService()`. Test your setup and ensure that you can connect to the service:
6867

@@ -94,7 +93,6 @@ The [updated version of IBM Quantum Platform](https://quantum.cloud.ibm.com/) is
9493
from qiskit_ibm_runtime import QiskitRuntimeService
9594

9695
service = QiskitRuntimeService(
97-
channel="ibm_cloud",
9896
# Delete your key on the API keys page after entering this code:
9997
token="<IBM Cloud API key>",
10098
instance="<IBM Cloud CRN>"

docs/guides/estimate-job-run-time.mdx

+1-18
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Usage is a measurement of the amount of time the QPU is locked for your workload
2828
The usage reported on the dashboard or by using the API is the time a QPU is locked for your workload. Failed or canceled jobs count toward your usage in certain circumstances - see the [Failed and canceled jobs](#failed-job) section for details.
2929
</LegacyContent>
3030
<CloudContent>
31-
Failed or canceled jobs count toward your usage in certain circumstances - see the [Failed and canceled jobs](#failed-job) section for details.
31+
The usage reported on the dashboard or by using the API is the time a QPU is locked for your workload. Failed or canceled jobs count toward your usage in certain circumstances - see the [Failed and canceled jobs](#failed-job) section for details.
3232

3333
For Standard Plan users, usage determines how much the workload costs. See [Manage cost](/docs/guides/manage-cost) for details.
3434
</CloudContent>
@@ -42,20 +42,11 @@ Your usage has different impacts, depending on which channel you're using:
4242

4343
<span id="failed-job"></span>
4444
## Usage for failed and canceled jobs
45-
<CloudContent>
46-
When a job is failed or canceled, the usage is as follows:
47-
48-
* Job or batch mode: The usage is the time the QPU was locked for executing your workload until the time it failed or was canceled. Therefore, if the failure or cancellation occurred before the lock, the usage is zero. Otherwise, the workload's usage is the amount of usage before the workload failed or was canceled. Thus, some failed jobs do not appear in your usage and others do.
49-
50-
* Session mode: The usage is the wall-clock time from when the first job started executing in the session until the session terminates, regardless of the number of jobs that fail or are canceled.
51-
</CloudContent>
52-
<LegacyContent>
5345
When a job is failed or canceled, the reported usage is as follows:
5446

5547
* Job or batch mode: The reported usage is the time the QPU was locked for executing your workload until the time it failed or was canceled. Therefore, if the failure or cancellation occurred before the lock, the reported usage is zero. Otherwise, the workload's reported usage is the amount of usage before the workload failed or was canceled. Thus, some failed jobs do not appear in your reported usage and others do.
5648

5749
* Session mode: The reported usage is the wall-clock time from when the first job started executing in the session until the session terminates, regardless of the number of jobs that fail or are canceled.
58-
</LegacyContent>
5950

6051
<span id="view-usage"></span>
6152
## Determine a workload's actual usage
@@ -83,17 +74,9 @@ After submitting a job to the IBM Quantum channel, you can see an estimation for
8374

8475
Quantum time is the duration, in seconds, a QPU is committed to fulfilling a user request.
8576

86-
<LegacyContent>
87-
<Admonition type="note" title="Notes">
88-
- This only applies to jobs that use primitives.
89-
- This is not yet available on the Qiskit Runtime on IBM Cloud&reg; channel.
90-
</Admonition>
91-
</LegacyContent>
92-
<CloudContent>
9377
<Admonition type="note">
9478
This only applies to jobs that use primitives.
9579
</Admonition>
96-
</CloudContent>
9780

9881
Example:
9982

0 commit comments

Comments
 (0)