Skip to content

Commit

Permalink
Merge branch 'main' into ajc/rmv-run-new
Browse files Browse the repository at this point in the history
  • Loading branch information
abbycross committed May 14, 2024
2 parents 5ca741e + be09a6c commit 254446e
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 26 deletions.
9 changes: 7 additions & 2 deletions docs/run/_toc.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
{
"title": "Introduction to execution modes",
"url": "/run/execution-modes"
},{
},
{
"title": "About sessions",
"url": "/run/sessions"
},
Expand All @@ -58,6 +59,10 @@
"title": "Run jobs in a batch",
"url": "/run/run-jobs-batch"
},
{
"title": "Fixed and dynamic repetition rate execution",
"url": "/run/circuit-execution"
},
{
"title": "FAQs",
"url": "/run/execution-modes-faq"
Expand Down Expand Up @@ -94,7 +99,7 @@
"url": "/run/visualize-results"
},
{
"title": "Quantum Serverless workloads",
"title": "Qiskit Serverless workloads",
"url": "/run/quantum-serverless"
},
{
Expand Down
31 changes: 28 additions & 3 deletions docs/run/circuit-execution.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: System circuit execution
title: Fixed and dynamic repetition rate execution
description: Explanatory content on fixed and dynamic repetition rate execution

---

# System circuit execution
# Fixed and dynamic repetition rate execution

## Fixed repetition rate execution

Expand All @@ -26,4 +26,29 @@ Therefore, each circuit is equal in duration to the longest circuit in the batch

## Dynamic repetition rate execution

Some IBM Quantum systems allow for dynamic repetition rate execution. These systems are identified in Qiskit using `backend.configuration().dynamic_reprate_enabled`, and return a value of `True`. On these systems, it is possible to manually set the above idle time by setting the `rep_delay` of the submitted job. One can see from the above figures that by reducing the idle time one can potentially see a greater throughput of circuits on the systems that support dynamic repetition rates. See the the next section on conditional reset for more detailed usage examples.
Some IBM Quantum systems allow for dynamic repetition rate execution. These systems are identified in Qiskit using `backend.configuration().dynamic_reprate_enabled`, and return a value of `True`. On these systems, it is possible to manually set the above idle time by setting the `rep_delay` of the submitted job. One can see from the above figures that by reducing the idle time one can potentially see a greater throughput of circuits on the systems that support dynamic repetition rates.

## Specify rep_delay for a primitive job

```python
from qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2 as Sampler

service = QiskitRuntimeService()

# Make sure your backend supports it
backend = service.least_busy(operational=True, min_num_qubits=100, dynamic_reprate_enabled=True)

# Determine the allowable range
backend.rep_delay_range
sampler = Sampler(backend=backend)

#Specify a value in the supported range
sampler.options.execution.rep_delay = 0.0005
```

## Next steps

<Admonition type="tip" title="Recommendations">
- Try an example in the [Quantum approximate optimization algorithm (QAOA)](https://learning.quantum.ibm.com/tutorial/quantum-approximate-optimization-algorithm) tutorial.
- Review how to [get started with primitives.](primitives-get-started)
</Admonition>
42 changes: 21 additions & 21 deletions docs/run/quantum-serverless.mdx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
---
title: Run workloads remotely with Quantum Serverless
description: How to run quantum computing workloads remotely using Quantum Serverless.
title: Run workloads remotely with Qiskit Serverless
description: How to run quantum computing workloads remotely using Qiskit Serverless on IBM Quantum.
---

# Run workloads remotely with Quantum Serverless
# Run workloads remotely with Qiskit Serverless

Premium users can build, deploy, and run their workloads remotely on classical compute made available through the IBM Quantum&trade; Platform.

Try out the tutorials in [IBM Quantum Learning](https://learning.quantum.ibm.com/catalog/tutorials?topics=qiskit-patterns) (note: these are accessible in the Premium Plan once you have logged into your IBM Quantum account) and explore more of the features of Quantum Serverless in the [documentation](https://qiskit.github.io/qiskit-serverless/).
Try out the tutorials in [IBM Quantum Learning](https://learning.quantum.ibm.com/catalog/tutorials?topics=qiskit-patterns) (note: these are accessible in the Premium Plan once you have logged into your IBM Quantum account) and explore more of the features of Qiskit Serverless in the [documentation](https://qiskit.github.io/qiskit-serverless/).


<Admonition type="note">
This is an experimental feature, subject to change.
</Admonition>

## Qiskit Patterns with Quantum Serverless
## Building Qiskit Patterns with Qiskit Serverless

Creating utility-scale quantum applications generally requires a variety of compute resource requirements. You can use Quantum Serverless to easily submit quantum workflows for remote, managed execution. These quantum workflows can typically be implemented within a common pattern, called a Qiskit Pattern. A Qiskit Pattern is an intuitive, repeatable set of steps for implementing a quantum computing workflow.
Creating utility-scale quantum applications generally requires a variety of compute resource requirements. You can use Qiskit Serverless to easily submit quantum workflows for remote, managed execution on IBM Quantum Platform. These quantum workflows can typically be implemented within a common pattern, called a Qiskit Pattern. A Qiskit Pattern is an intuitive, repeatable set of steps for implementing a quantum computing workflow.

Steps in a Qiskit Pattern:

Expand All @@ -25,11 +25,11 @@ Steps in a Qiskit Pattern:
3. Execute using Qiskit Runtime primitives
4. Post-process, return result in classical format

Once you have built a Qiskit Pattern, you can use Quantum Serverless to deploy it and submit it for managed execution. Overall, the process of creating quantum software and submitting it for managed execution on a remote cluster can be broken down into three steps:
Once you have built a Qiskit Pattern, you can use Qiskit Serverless to deploy it and submit it for managed execution. Overall, the process of creating quantum software and submitting it for managed execution on a remote cluster can be broken down into three steps:

1. Build the Qiskit Pattern
2. Deploy to the Quantum Serverless
3. Run remotely on Quantum Serverless
2. Deploy to the Qiskit Serverless
3. Run remotely on Qiskit Serverless

## Build a Qiskit Pattern

Expand All @@ -43,7 +43,7 @@ from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit.circuit.random import random_circuit
from qiskit.quantum_info import SparsePauliOp
from qiskit_ibm_runtime import QiskitRuntimeService
from quantum_serverless import save_result
from qiskit_serverless import save_result

service = QiskitRuntimeService()
backend = service.least_busy(simulator=False)
Expand Down Expand Up @@ -89,11 +89,11 @@ After creating a workflow, authenticate to the `IBMServerlessProvider` with your

```python
# Authenticate to the IBM serverless provider
from quantum_serverless import IBMServerlessProvider
from qiskit_serverless import IBMServerlessProvider
serverless = IBMServerlessProvider("YOUR_IBM_QUANTUM_TOKEN")

# Deploy the pattern
from quantum_serverless import QiskitPattern
from qiskit_serverless import QiskitPattern
serverless.upload(
QiskitPattern(
title="My-Qiskit-Pattern",
Expand All @@ -103,7 +103,7 @@ serverless.upload(
)
```

## Run a Qiskit Pattern remotely on Quantum Serverless
## Run a Qiskit Pattern remotely on Qiskit Serverless

Finally, the pattern is ready to run remotely.

Expand All @@ -119,15 +119,15 @@ job.result()

## Migration guide

Qiskit Runtime custom programs can be easily migrated to Quantum Serverless via this [migration guide](https://qiskit.github.io/qiskit-serverless/migration/migration_from_qiskit_runtime_programs.html).
Qiskit Runtime custom programs can be easily migrated to Qiskit Serverless via this [migration guide](https://qiskit.github.io/qiskit-serverless/migration/migration_from_qiskit_runtime_programs.html).

## Resource management (alpha)

Premium Plan users have access to an alpha release of resource management functionality through Quantum Serverless. This enables automatic selection of quantum hardware for your workloads.
Premium Plan users have access to an alpha release of resource management functionality through Qiskit Serverless. This enables automatic selection of quantum hardware for your workloads.

The example below demonstrates how to use `IBMQPUSelector` to automate the process of selecting which qubits will be used from a set of available systems. This illustrates how the selectors can be used within a four-step Qiskit Pattern.

Instead of manually selecting a system, step 2 of the Qiskit Pattern optimizes the circuits for execution by using the QPU selectors from Quantum Serverless to automatically allocate a system according to desired criteria. Here, `IBMLeastNoisyQPUSelector` finds the system, among the ones available to you through your IBM Quantum account, that yields the least-noisy qubit subgraph for the input circuit. You can also use the `IBMLeastBusyQPUSelector` to find a system that can support the circuit width but with the shortest queue.
Instead of manually selecting a system, step 2 of the Qiskit Pattern optimizes the circuits for execution by using the QPU selectors from Qiskit Serverless to automatically allocate a system according to desired criteria. Here, `IBMLeastNoisyQPUSelector` finds the system, among the ones available to you through your IBM Quantum account, that yields the least-noisy qubit subgraph for the input circuit. You can also use the `IBMLeastBusyQPUSelector` to find a system that can support the circuit width but with the shortest queue.

For each `IBMQPUSelector`, the context is set in the constructor. All `IBMQPUSelectors` require Qiskit Runtime credentials. The `IBMLeastNoisyQPUSelector` requires a circuit and transpile options specifying how the circuit should be optimized for each system when determining the most optimal QPU and qubit layout. All `IBMQPUSelector`s implement a `get_backend` method, which retrieves the optimal system with respect to the given context. The `get_backend` method also allows for additional filtering of the systems. It is implemented using the same interface as the [QiskitRuntimeService.backends method](/api/qiskit-ibm-runtime/qiskit_ibm_runtime.QiskitRuntimeService#backends).

Expand All @@ -140,7 +140,7 @@ Then, in step 3 of the pattern, you execute the target circuit on the system cho

from qiskit_ibm_runtime import QiskitRuntimeService, Session, Samplerv2 as Sampler
from qiskit.circuit.random import random_circuit
from quantum_serverless_tools.selectors import IBMLeastNoisyQPUSelector
from qiskit_serverless_tools.selectors import IBMLeastNoisyQPUSelector

service = QiskitRuntimeService()

Expand All @@ -158,7 +158,7 @@ target_circuit = selector.optimized_circuit

## Alternatively, one can automatically select a system according to most available:
# from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
# from quantum_serverless_tools.selectors import IBMLeastBusyQPUSelector
# from qiskit_serverless_tools.selectors import IBMLeastBusyQPUSelector
#
# backend = IBMLeastBusyQPUSelector(service).get_backend(min_num_qubits=127)
# pm = generate_preset_pass_manager(optimization_level=3, backend=backend)
Expand All @@ -184,7 +184,7 @@ save_result(result)

from qiskit_ibm_runtime import QiskitRuntimeService, Session, Sampler, Options
from qiskit.circuit.random import random_circuit
from quantum_serverless_tools.selectors import IBMLeastNoisyQPUSelector
from qiskit_serverless_tools.selectors import IBMLeastNoisyQPUSelector

service = QiskitRuntimeService()

Expand All @@ -202,7 +202,7 @@ target_circuit = selector.optimized_circuit

## Alternatively, one can automatically select a system according to most available:
# from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
# from quantum_serverless_tools.selectors import IBMLeastBusyQPUSelector
# from qiskit_serverless_tools.selectors import IBMLeastBusyQPUSelector
#
# backend = IBMLeastBusyQPUSelector(service).get_backend(min_num_qubits=127)
# pm = generate_preset_pass_manager(optimization_level=3, backend=backend)
Expand All @@ -228,4 +228,4 @@ save_result(result)
</TabItem>
</Tabs>

After creating this pattern, you can deploy and run it remotely with Quantum Serverless as described above.
After creating this pattern, you can deploy and run it remotely with Qiskit Serverless as described above.

0 comments on commit 254446e

Please sign in to comment.