|
20 | 20 | "source": [ |
21 | 21 | "In Qiskit we have an interface for backends and jobs that is useful for running circuits and extending to third-party backends. In this tutorial, we will review the core components of Qiskit’s base backend framework, using the IBM Q account as an example.\n", |
22 | 22 | "\n", |
23 | | - "The interface has four main component: the account, providers, backends, and jobs:\n", |
| 23 | + "The interface has four main components: the account, providers, backends, and jobs:\n", |
24 | 24 | "\n", |
25 | | - "- **account**: Gives access to one or more ‘providers’ based on account permissions.\n", |
| 25 | + "- **account**: Gives access to one or more ‘providers’ based on the account's permissions.\n", |
26 | 26 | "\n", |
27 | | - "- **providers**: Provides access to quantum devices and simulators, collectively called ‘backends’, and additional services tailored to a specific backend instance.\n", |
| 27 | + "- **provider**: Provides access to quantum devices and simulators, collectively called ‘backends’, and additional services tailored to a specific backend instance.\n", |
28 | 28 | "\n", |
29 | | - "- **backends**: A quantum device or simulator capable of running quantum circuits or pulse schedules.\n", |
| 29 | + "- **backend**: A quantum device or simulator capable of running quantum circuits or pulse schedules.\n", |
30 | 30 | "\n", |
31 | | - "- **jobs**: A local reference to a collection of quantum circuits or pulse schedules submitted to a given backend." |
| 31 | + "- **job**: A local reference to a collection of quantum circuits or pulse schedules submitted to a given backend." |
32 | 32 | ] |
33 | 33 | }, |
34 | 34 | { |
|
51 | 51 | "3) [Backends](#backends)\n", |
52 | 52 | " \n", |
53 | 53 | " \n", |
54 | | - "3) [Jobs](#jobs)" |
| 54 | + "4) [Jobs](#jobs)\n", |
| 55 | + "\n", |
| 56 | + "\n", |
| 57 | + "5) [Updating from previous versions](#updating)" |
55 | 58 | ] |
56 | 59 | }, |
57 | 60 | { |
|
64 | 67 | "\n", |
65 | 68 | "The `IBMQ` account has functions for handling administrative tasks. The credentials can be saved to disk, or used in a session and never saved.\n", |
66 | 69 | "\n", |
67 | | - "- `enable_account(TOKEN)`: Enable your account in the current session\n", |
| 70 | + "- `enable_account(TOKEN)`: Enable your account in the current session.\n", |
68 | 71 | "- `save_account(TOKEN)`: Save your account to disk for future use.\n", |
69 | 72 | "- `load_account()`: Load account using stored credentials.\n", |
70 | 73 | "- `disable_account()`: Disable your account in the current session.\n", |
|
74 | 77 | "\n", |
75 | 78 | "\n", |
76 | 79 | "\n", |
77 | | - "In order to access quantum devices, simulators, or other services, you must specify the source of these items by selecting a provider. To see all the providers available:\n", |
78 | | - "\n", |
79 | | - "\n", |
80 | | - "<div class=\"alert alert-block alert-info\">\n", |
81 | | - "<b>Note:</b> The use of `provider` instances is the default way of retrieving backends from Qiskit 0.11 onwards - if you have been using earlier versions of Qiskit, check the \"Updating from previous versions\" section for more detailed instructions on updating and using the different options.</div>\n", |
82 | | - "</div>" |
| 80 | + "In order to access quantum devices, simulators, or other services, you must specify the source of these items by selecting a provider. To see all the providers available do the following:" |
83 | 81 | ] |
84 | 82 | }, |
85 | 83 | { |
|
120 | 118 | "source": [ |
121 | 119 | "where we have assumed that the user has stored their IBMQ account information locally ahead of time using `IBMQ.save_account(TOKEN)`.\n", |
122 | 120 | "\n", |
| 121 | + "<div class=\"alert alert-block alert-info\">\n", |
| 122 | + "<b>Note:</b> The use of `provider` instances is the default way of retrieving backends from Qiskit 0.11 onwards - if you have been using earlier versions of Qiskit, check the <a href=\"#updating\">\"Updating from previous versions\"</a> section for more detailed instructions on updating and using the different options.</div>\n", |
| 123 | + "</div>\n", |
| 124 | + "\n", |
123 | 125 | "The above example shows two different providers. All `IBMQ` providers are specified by a `hub`, `group`, and `project`. The provider given by `hub='ibm-q', group='open', project='main'` is the provider that gives access to the public IBM Q devices available to all IQX users. The second is an example of a provider that is only unlocked for a specific set of users. Members of the IBM Q network may see one or more providers (with names different than those shown above) depending on the access level granted to them." |
124 | 126 | ] |
125 | 127 | }, |
126 | 128 | { |
127 | 129 | "cell_type": "markdown", |
128 | 130 | "metadata": {}, |
129 | 131 | "source": [ |
130 | | - "To access a given provider one should use the get_provider() method of the IBMQ account, filtering by `hub`, `group`, or `project`:" |
| 132 | + "To access a given provider one should use the `get_provider()` method of the `IBMQ` account, filtering by `hub`, `group`, or `project`:" |
131 | 133 | ] |
132 | 134 | }, |
133 | 135 | { |
|
265 | 267 | "backend" |
266 | 268 | ] |
267 | 269 | }, |
268 | | - { |
269 | | - "cell_type": "markdown", |
270 | | - "metadata": {}, |
271 | | - "source": [ |
272 | | - "and backends which are available in the default provider" |
273 | | - ] |
274 | | - }, |
275 | | - { |
276 | | - "cell_type": "code", |
277 | | - "execution_count": 7, |
278 | | - "metadata": {}, |
279 | | - "outputs": [ |
280 | | - { |
281 | | - "data": { |
282 | | - "text/plain": [ |
283 | | - "[<IBMQBackend('ibmqx4') from IBMQ()>,\n", |
284 | | - " <IBMQBackend('ibmqx2') from IBMQ()>,\n", |
285 | | - " <IBMQBackend('ibmq_16_melbourne') from IBMQ()>,\n", |
286 | | - " <IBMQSimulator('ibmq_qasm_simulator') from IBMQ()>]" |
287 | | - ] |
288 | | - }, |
289 | | - "execution_count": 7, |
290 | | - "metadata": {}, |
291 | | - "output_type": "execute_result" |
292 | | - } |
293 | | - ], |
294 | | - "source": [ |
295 | | - "provider.backends()" |
296 | | - ] |
297 | | - }, |
298 | 270 | { |
299 | 271 | "cell_type": "markdown", |
300 | 272 | "metadata": {}, |
301 | 273 | "source": [ |
302 | 274 | "### Filtering the Backends\n", |
303 | 275 | "\n", |
304 | | - "You may also optionally filter the set of returned backends, by passing arguments that query the backend’s `configuration`, `status`, or `properties`. The filters are passed by conditions and, for more general filters, you can make advanced functions using the lambda function.\n", |
| 276 | + "You may also optionally filter the set of returned backends, by passing arguments that query the backend’s `configuration`, `status`, or `properties`. The filters are passed by conditions and, for more general filters, you can make advanced functions using a lambda function.\n", |
305 | 277 | "\n", |
306 | 278 | "As a first example lets return only those backends that are real quantum devices, and that are currently operational:" |
307 | 279 | ] |
|
438 | 410 | "cell_type": "markdown", |
439 | 411 | "metadata": {}, |
440 | 412 | "source": [ |
441 | | - "For remote backends they must support the additional\n", |
| 413 | + "For remote backends they must support the additional methods:\n", |
442 | 414 | "\n", |
443 | 415 | "- `jobs()`: Returns a list of previous jobs executed on this backend through the current provider instance.\n", |
444 | 416 | "- `retrieve_job(JOB_ID)`: Returns a job by a job_id.\n", |
445 | 417 | "\n", |
446 | 418 | "On a per device basis, the following commands may be supported:\n", |
447 | 419 | "\n", |
448 | 420 | "- `defaults()`: Gives a data structure of typical default parameters.\n", |
449 | | - "- `schema()`: Fets a schema for the backend.\n", |
| 421 | + "- `schema()`: Gets a schema for the backend.\n", |
450 | 422 | "\n", |
451 | | - "There are some IBM Q backend only attributes:\n", |
| 423 | + "There are some \"IBM Q backend\"-only attributes:\n", |
452 | 424 | "\n", |
453 | 425 | "- `hub`: The IBMQ hub for this backend.\n", |
454 | 426 | "- `group`: The IBMQ group for this backend.\n", |
|
656 | 628 | "cell_type": "markdown", |
657 | 629 | "metadata": {}, |
658 | 630 | "source": [ |
659 | | - "A `job` can be retrieved using `retrieve_job(JOB_ID)` method" |
| 631 | + "A `job` can be retrieved using the `retrieve_job(JOB_ID)` method:" |
660 | 632 | ] |
661 | 633 | }, |
662 | 634 | { |
|
687 | 659 | "- `cancel()`: Cancels the job.\n", |
688 | 660 | "- `result()`: Gets the results from the circuit run.\n", |
689 | 661 | "\n", |
690 | | - "IBM Q job only functions include:\n", |
| 662 | + "\"IBM Q job\"-only functions include:\n", |
691 | 663 | "\n", |
692 | 664 | "- `creation_date()`: Gives the date at which the job was created.\n", |
693 | 665 | "- `queue_position()`: Returns the position of the job in the queue.\n", |
694 | | - "- `error_message()`: The error message of failed jobs, if any.\n", |
695 | | - "\n", |
696 | | - "Let’s start with the `status()`. This returns the job status and a message" |
| 666 | + "- `error_message()`: The error message of failed jobs, if any." |
697 | 667 | ] |
698 | 668 | }, |
699 | 669 | { |
700 | 670 | "cell_type": "markdown", |
701 | 671 | "metadata": {}, |
702 | 672 | "source": [ |
703 | | - "Let's start with the `status()`. This returns the job status and a message" |
| 673 | + "Let's start with the `status()`. This returns the job status and a message:" |
704 | 674 | ] |
705 | 675 | }, |
706 | 676 | { |
|
732 | 702 | "cell_type": "markdown", |
733 | 703 | "metadata": {}, |
734 | 704 | "source": [ |
735 | | - "To get a backend object from the job, use the `backend()` method" |
| 705 | + "To get a backend object from the job, use the `backend()` method:" |
736 | 706 | ] |
737 | 707 | }, |
738 | 708 | { |
|
765 | 735 | "cell_type": "markdown", |
766 | 736 | "metadata": {}, |
767 | 737 | "source": [ |
768 | | - "To get the job_id use the `job_id()` method" |
| 738 | + "To get the job_id use the `job_id()` method:" |
769 | 739 | ] |
770 | 740 | }, |
771 | 741 | { |
|
797 | 767 | "cell_type": "markdown", |
798 | 768 | "metadata": {}, |
799 | 769 | "source": [ |
800 | | - "To get the result from the job, use the `result()` method" |
| 770 | + "To get the result from the job, use the `result()` method:" |
801 | 771 | ] |
802 | 772 | }, |
803 | 773 | { |
|
828 | 798 | "cell_type": "markdown", |
829 | 799 | "metadata": {}, |
830 | 800 | "source": [ |
831 | | - "If you want to check the creation date, use `creation_date()`" |
| 801 | + "If you want to check the creation date, use `creation_date()`:" |
832 | 802 | ] |
833 | 803 | }, |
834 | 804 | { |
|
860 | 830 | "cell_type": "markdown", |
861 | 831 | "metadata": {}, |
862 | 832 | "source": [ |
863 | | - "Let's make an active example" |
| 833 | + "Let's make an active example." |
864 | 834 | ] |
865 | 835 | }, |
866 | 836 | { |
|
965 | 935 | "cell_type": "markdown", |
966 | 936 | "metadata": {}, |
967 | 937 | "source": [ |
968 | | - "## Updating from previous versions\n", |
| 938 | + "## Updating from previous versions <a name='updating'></a>\n", |
969 | 939 | "\n", |
970 | 940 | "Since `Qiskit` version `0.11`, the IBM Q account defaults to using the new [IBM Q Experience](https://quantum-computing.ibm.com), which supersedes the legacy Quantum Experience and Q-console.\n", |
971 | 941 | "\n", |
|
0 commit comments