Skip to content

Commit

Permalink
Merge branch 'feature/autoqasm' into rmshaffer/autoqasm-device-valida…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
rmshaffer committed Sep 11, 2023
2 parents 6b062cf + a69c39b commit a4cb40f
Show file tree
Hide file tree
Showing 46 changed files with 888 additions and 320 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
check-code-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Set up Python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependent-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- amazon-braket-pennylane-plugin-python

steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Build and publish distribution to PyPi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Set up Python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/twine-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
name: Check long description
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Set up Python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## v1.55.0 (2023-09-09)

### Features

* add Aria2 enum

## v1.54.3.post0 (2023-09-04)

### Documentation Changes

* standardize task and job naming to quantum task and hybrid job

## v1.54.3 (2023-08-30)

### Bug Fixes and Other Changes

* Move inline `_flatten` to top of `qubit_set.py`
* build(deps): bump actions/setup-python from 4.6.1 to 4.7.0

## v1.54.2 (2023-08-28)

### Bug Fixes and Other Changes
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@ task = device.run(bell, shots=100)
print(task.result().measurement_counts)
```

The code sample imports the Amazon Braket framework, then defines the device to use (the SV1 AWS simulator). It then creates a Bell Pair circuit, executes the circuit on the simulator and prints the results of the job. This example can be found in `../examples/bell.py`.
The code sample imports the Amazon Braket framework, then defines the device to use (the SV1 AWS simulator). It then creates a Bell Pair circuit, executes the circuit on the simulator and prints the results of the hybrid job. This example can be found in `../examples/bell.py`.

### Running multiple tasks at once
### Running multiple quantum tasks at once

Many quantum algorithms need to run multiple independent circuits, and submitting the circuits in parallel can be faster than submitting them one at a time. In particular, parallel task processing provides a significant speed up when using simulator devices. The following example shows how to run a batch of tasks on SV1:
Many quantum algorithms need to run multiple independent circuits, and submitting the circuits in parallel can be faster than submitting them one at a time. In particular, parallel quantum task processing provides a significant speed up when using simulator devices. The following example shows how to run a batch of quantum tasks on SV1:

```python
circuits = [bell for _ in range(5)]
batch = device.run_batch(circuits, shots=100)
print(batch.results()[0].measurement_counts) # The result of the first task in the batch
print(batch.results()[0].measurement_counts) # The result of the first quantum task in the batch
```

### Running a hybrid job
Expand All @@ -112,19 +112,19 @@ print(job.result())
where `run_job` is a function in the file `job.py`.


The code sample imports the Amazon Braket framework, then creates a hybrid job with the entry point being the `run_job` function. The hybrid job creates quantum tasks against the SV1 AWS Simulator. The job runs synchronously, and prints logs until it completes. The complete example can be found in `../examples/job.py`.
The code sample imports the Amazon Braket framework, then creates a hybrid job with the entry point being the `run_job` function. The hybrid job creates quantum tasks against the SV1 AWS Simulator. The hybrid job runs synchronously, and prints logs until it completes. The complete example can be found in `../examples/job.py`.

### Available Simulators
Amazon Braket provides access to two types of simulators: fully managed simulators, available through the Amazon Braket service, and the local simulators that are part of the Amazon Braket SDK.

- Fully managed simulators offer high-performance circuit simulations. These simulators can handle circuits larger than circuits that run on quantum hardware. For example, the SV1 state vector simulator shown in the previous examples requires approximately 1 or 2 hours to complete a 34-qubit, dense, and square circuit (circuit depth = 34), depending on the type of gates used and other factors.
- The Amazon Braket Python SDK includes an implementation of quantum simulators that can run circuits on your local, classic hardware. For example the braket_sv local simulator is well suited for rapid prototyping on small circuits up to 25 qubits, depending on the hardware specifications of your Braket notebook instance or your local environment. An example of how to execute the task locally is included in the repository `../examples/local_bell.py`.
- The Amazon Braket Python SDK includes an implementation of quantum simulators that can run circuits on your local, classic hardware. For example the braket_sv local simulator is well suited for rapid prototyping on small circuits up to 25 qubits, depending on the hardware specifications of your Braket notebook instance or your local environment. An example of how to execute the quantum task locally is included in the repository `../examples/local_bell.py`.

For a list of available simulators and their features, consult the [Amazon Braket Developer Guide](https://docs.aws.amazon.com/braket/latest/developerguide/braket-devices.html).

### Debugging logs

Tasks sent to QPUs don't always run right away. To view task status, you can enable debugging logs. An example of how to enable these logs is included in repo: `../examples/debug_bell.py`. This example enables task logging so that status updates are continuously printed to the terminal after a quantum task is executed. The logs can also be configured to save to a file or output to another stream. You can use the debugging example to get information on the tasks you submit, such as the current status, so that you know when your task completes.
Quantum tasks sent to QPUs don't always run right away. To view quantum task status, you can enable debugging logs. An example of how to enable these logs is included in repo: `../examples/debug_bell.py`. This example enables quantum task logging so that status updates are continuously printed to the terminal after a quantum task is executed. The logs can also be configured to save to a file or output to another stream. You can use the debugging example to get information on the quantum tasks you submit, such as the current status, so that you know when your quantum task completes.

### Running a Quantum Algorithm on a Quantum Computer
With Amazon Braket, you can run your quantum circuit on a physical quantum computer.
Expand Down Expand Up @@ -152,7 +152,7 @@ print(task.result().measurement_counts)

To select a quantum hardware device, specify its ARN as the value of the `device_arn` argument. A list of available quantum devices and their features can be found in the [Amazon Braket Developer Guide](https://docs.aws.amazon.com/braket/latest/developerguide/braket-devices.html).

**Important** Tasks may not run immediately on the QPU. The QPUs only execute tasks during execution windows. To find their execution windows, please refer to the [AWS console](https://console.aws.amazon.com/braket/home) in the "Devices" tab.
**Important** Quantum tasks may not run immediately on the QPU. The QPUs only execute quantum tasks during execution windows. To find their execution windows, please refer to the [AWS console](https://console.aws.amazon.com/braket/home) in the "Devices" tab.

## Sample Notebooks
Sample Jupyter notebooks can be found in the [amazon-braket-examples](https://github.com/aws/amazon-braket-examples/) repo.
Expand Down Expand Up @@ -214,7 +214,7 @@ After you create a profile, use the following command to set the `AWS_PROFILE` s
```bash
export AWS_PROFILE=YOUR_PROFILE_NAME
```
To run the integration tests for local jobs, you need to have Docker installed and running. To install Docker follow these instructions: [Install Docker](https://docs.docker.com/get-docker/)
To run the integration tests for local hybrid jobs, you need to have Docker installed and running. To install Docker follow these instructions: [Install Docker](https://docs.docker.com/get-docker/)

Run the tests:

Expand Down
4 changes: 2 additions & 2 deletions doc/examples-braket-features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Learn more about the indivudal features of Amazon Braket.
:maxdepth: 2

*******************************************************************************************************************************************************************************************************************************
`Getting notifications when a task completes <https://github.com/aws/amazon-braket-examples/blob/main/examples/braket_features/Getting_notifications_when_a_task_completes/Getting_notifications_when_a_task_completes.ipynb>`_
`Getting notifications when a quantum task completes <https://github.com/aws/amazon-braket-examples/blob/main/examples/braket_features/Getting_notifications_when_a_quantum_task_completes/Getting_notifications_when_a_quantum_task_completes.ipynb>`_
*******************************************************************************************************************************************************************************************************************************

This tutorial illustrates how Amazon Braket integrates with Amazon EventBridge for
event-based processing. In the tutorial, you will learn how to configure Amazon Braket
and Amazon Eventbridge to receive text notification about task completions on your phone.
and Amazon Eventbridge to receive text notification about quantum task completions on your phone.

*************************************************************************************************************************************************************
`Allocating Qubits on QPU Devices <https://github.com/aws/amazon-braket-examples/blob/main/examples/braket_features/Allocating_Qubits_on_QPU_Devices.ipynb>`_
Expand Down
2 changes: 1 addition & 1 deletion doc/examples-hybrid-jobs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This tutorial shows how to run your first Amazon Braket Hybrid Job.
This notebook demonstrates a typical quantum machine learning workflow, including uploading data, monitoring training, and tuning hyperparameters.

********************************************************************************************************************************************************************************************
`Using Pennylane with Braket Jobs <https://github.com/aws/amazon-braket-examples/blob/main/examples/hybrid_jobs/2_Using_PennyLane_with_Braket_Jobs/Using_PennyLane_with_Braket_Jobs.ipynb>`_
`Using Pennylane with Braket Hybrid Jobs <https://github.com/aws/amazon-braket-examples/blob/main/examples/hybrid_jobs/2_Using_PennyLane_with_Braket_Hybrid_Jobs/Using_PennyLane_with_Braket_Hybrid_Jobs.ipynb>`_
********************************************************************************************************************************************************************************************

In this tutorial, we use PennyLane within Amazon Braket Hybrid Jobs to run the Quantum Approximate Optimization Algorithm (QAOA) on a Max-Cut problem.
Expand Down
1 change: 1 addition & 0 deletions examples/autoqasm/ionq_gates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np

import braket.experimental.autoqasm as aq
from braket.experimental.autoqasm.instructions import gpi, gpi2, ms

Expand Down
2 changes: 1 addition & 1 deletion src/braket/_sdk/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "1.54.3.dev0"
__version__ = "1.55.1.dev0"
19 changes: 10 additions & 9 deletions src/braket/aws/aws_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,16 @@ def run(
**aws_quantum_task_kwargs,
) -> AwsQuantumTask:
"""
Run a quantum task specification on this device. A task can be a circuit or an
Run a quantum task specification on this device. A quantum task can be a circuit or an
annealing problem.
Args:
task_specification (Union[Circuit, Problem, OpenQasmProgram, BlackbirdProgram, PulseSequence, AnalogHamiltonianSimulation]): # noqa
Specification of task (circuit or annealing problem or program) to run on device.
Specification of quantum task (circuit, OpenQASM program or AHS program)
to run on device.
s3_destination_folder (Optional[S3DestinationFolder]): The S3 location to
save the task's results to. Default is `<default_bucket>/tasks` if evoked outside a
Braket Job, `<Job Bucket>/jobs/<job name>/tasks` if evoked inside a Braket Job.
save the quantum task's results to. Default is `<default_bucket>/tasks` if evoked outside a
Braket Hybrid Job, `<Job Bucket>/jobs/<job name>/tasks` if evoked inside a Braket Hybrid Job.
shots (Optional[int]): The number of times to run the circuit or annealing problem.
Default is 1000 for QPUs and 0 for simulators.
poll_timeout_seconds (float): The polling timeout for `AwsQuantumTask.result()`,
Expand Down Expand Up @@ -233,20 +234,20 @@ def run_batch(
*aws_quantum_task_args,
**aws_quantum_task_kwargs,
) -> AwsQuantumTaskBatch:
"""Executes a batch of tasks in parallel
"""Executes a batch of quantum tasks in parallel
Args:
task_specifications (Union[Union[Circuit, Problem, OpenQasmProgram, BlackbirdProgram, PulseSequence, AnalogHamiltonianSimulation], List[Union[ Circuit, Problem, OpenQasmProgram, BlackbirdProgram, PulseSequence, AnalogHamiltonianSimulation]]]): # noqa
Single instance or list of circuits, annealing problems, pulse sequences,
or photonics program to run on device.
s3_destination_folder (Optional[S3DestinationFolder]): The S3 location to
save the tasks' results to. Default is `<default_bucket>/tasks` if evoked outside a
save the quantum tasks' results to. Default is `<default_bucket>/tasks` if evoked outside a
Braket Job, `<Job Bucket>/jobs/<job name>/tasks` if evoked inside a Braket Job.
shots (Optional[int]): The number of times to run the circuit or annealing problem.
Default is 1000 for QPUs and 0 for simulators.
max_parallel (Optional[int]): The maximum number of tasks to run on AWS in parallel.
max_parallel (Optional[int]): The maximum number of quantum tasks to run on AWS in parallel.
Batch creation will fail if this value is greater than the maximum allowed
concurrent tasks on the device. Default: 10
concurrent quantum tasks on the device. Default: 10
max_connections (int): The maximum number of connections in the Boto3 connection pool.
Also the maximum number of thread pool workers for the batch. Default: 100
poll_timeout_seconds (float): The polling timeout for `AwsQuantumTask.result()`,
Expand All @@ -264,7 +265,7 @@ def run_batch(
Default: None.
Returns:
AwsQuantumTaskBatch: A batch containing all of the tasks run
AwsQuantumTaskBatch: A batch containing all of the quantum tasks run
See Also:
`braket.aws.aws_quantum_task_batch.AwsQuantumTaskBatch`
Expand Down
Loading

0 comments on commit a4cb40f

Please sign in to comment.