Skip to main content

"Orquestra Braket package"

Project description

orquestra-braket

What is it?

orquestra-braket is a Zapata library holding modules for integrating Amazon Braket supported devices with Orquestra. This version supports Braket's LocalSimlator() and on-demand simulators.

Installation

Even though it's intended to be used with Orquestra, orquestra-braket can be also used as a Python module. To install it, make to install orquestra-quantum first. Then you just need to run pip install . from the main directory.

Overview

orquestra-braket is a Python module that exposes Braket's runner and simulators as an orquestra CircuitRunner and WavefunctionSimulator. They can be imported with:

from orquestra.integrations.braket.runner import BraketRunner
from orquestra.integrations.braket.simulator import braket_local_simulator

In addition, it interfaces with the noise models and provides converters that allow switching between braket circuits and those of orquestra.

The module can be used directly in Python or in an Orquestra workflow. For more details, see the Orquestra Core docs.

For more information regarding Orquestra and resources, please refer to the Orquestra documentation.

On Demand Simulator

In order to use Braket's on-demand simulator, a boto.Session must be created using AWS credentials. See Boto Session for information on creating creating a session. It highly recommended that credentials are configured in the local AWS CLI profile. Following is an example of working with BraketOnDemandSimulator using credentials stored in AWS CLI profile:

from orquestra.integrations.braket.runner import aws_runner
from boto3 import Session

# Insert CLI profile name here
boto_session = Session(profile_name=`profile`, region_name='us-east-1')
simulator_name = "SV1"
noise_model = None
simulator = aws_runner(name = simulator_name, noise_model = noise_model, boto_session=boto_session)

Below is an example of finding the names of on-demand simulators:

from boto3 import Session
from braket.aws import AwsSession, AwsDevice

boto_session = Session(profile_name=`profile`, region_name='us-east-1')
aws_session = AwsSession(boto_session)

Simulators = AwsDevice.get_devices(types=['SIMULATOR'], aws_session)

Braket QPUs

This library will allow you to access the QPUs provided by AWS Braket. The process is very similar to the BraketOnDemandSimulator. Here is how we can get started:

from orquestra.integrations.braket.runner import aws_runner

QPU_name = "IonQ Device"
s3 = "https://my-bucket.s3-us-west-2.amazonaws.com"
backend = aws_runner(name = QPU_name, s3_destination_folder = s3, boto_session = boto_session )

If you want to find the list of QPU names provided by Braket, use the following method:

from orquestra.integrations.braket.runner import get_QPU_names

QPU_names = get_QPU_names(boto_session)

After setting up the QPU, you can use the following approach to send a task to a QPU.

QPU_task = backend.run_and_measure(circ, n_samples)

Since the quantum devices are not readily accessible, the results are not returned immediately. We can monitor the status of our task by QPU_task.state(). You can cancel the task by QPU.cancel().

The outcome of the task will be stored in a S3 Bucket. You are required to have access to the bucket to retrive the results. You can find out more accessing S3 bucket here

Development and contribution

You can find the development guidelines in the orquestra-core repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

orquestra-braket-0.4.0.tar.gz (26.8 kB view details)

Uploaded Source

File details

Details for the file orquestra-braket-0.4.0.tar.gz.

File metadata

  • Download URL: orquestra-braket-0.4.0.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for orquestra-braket-0.4.0.tar.gz
Algorithm Hash digest
SHA256 0c54d51f546a8185d9484bb49ba25999d943d13dec93169ef376b93b4cd9d10b
MD5 0aa8ccf788f31c8370b48e225f452e98
BLAKE2b-256 35131632dc4208418d374a718b4c5bd52237afec0baa03d212af45b37d267caa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page