Package: orquestra-braket
orquestra-braketWhat is it?orquestra-braketis aZapatalibrary holding modules for integratingAmazon Braket supported deviceswithOrquestra. This version supports Braket'sLocalSimlator()and on-demand simulators.InstallationEven though it's intended to be used with Orquestra,orquestra-braketcan be also used as a Python module.
To install it, make to installorquestra-quantumfirst. Then you just need to runpip install .from the main directory.Overvieworquestra-braketis a Python module that exposes Braket's runner and simulators as anorquestraCircuitRunnerandWavefunctionSimulator. They can be imported with:fromorquestra.integrations.braket.runnerimportBraketRunnerfromorquestra.integrations.braket.simulatorimportbraket_local_simulatorIn addition, it interfaces with the noise models and provides converters that allow switching betweenbraketcircuits and those oforquestra.The module can be used directly in Python or in anOrquestraworkflow.
For more details, see theOrquestra Core docs.For more information regarding Orquestra and resources, please refer to theOrquestra documentation.On Demand SimulatorIn order to use Braket'son-demand simulator, aboto.Sessionmust be created using AWS credentials. SeeBoto Sessionfor information on creating creating a session. It highly recommended that credentials are configured in the localAWS CLI profile. Following is an example of working withBraketOnDemandSimulatorusing credentials stored in AWS CLI profile:fromorquestra.integrations.braket.runnerimportaws_runnerfromboto3importSession# Insert CLI profile name hereboto_session=Session(profile_name=`profile`,region_name='us-east-1')simulator_name="SV1"noise_model=Nonesimulator=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:fromboto3importSessionfrombraket.awsimportAwsSession,AwsDeviceboto_session=Session(profile_name=`profile`,region_name='us-east-1')aws_session=AwsSession(boto_session)Simulators=AwsDevice.get_devices(types=['SIMULATOR'],aws_session)Braket QPUsThis library will allow you to access the QPUs provided by AWS Braket. The process is very similar to theBraketOnDemandSimulator. Here is how we can get started:fromorquestra.integrations.braket.runnerimportaws_runnerQPU_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:fromorquestra.integrations.braket.runnerimportget_QPU_namesQPU_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 byQPU_task.state(). You can cancel the task byQPU.cancel().The outcome of the task will be stored in aS3 Bucket. You are required to have access to the bucket to retrive the results. You can find out more accessing S3 buckethereDevelopment and contributionYou can find the development guidelines in theorquestra-corerepository.