braket.aws.aws_qpu module¶
-
class
braket.aws.aws_qpu.
AwsQpu
(arn: str, aws_session=None)[source]¶ Bases:
braket.devices.device.Device
Amazon Braket implementation of a Quantum Processing Unit (QPU). Use this class to retrieve the latest metadata about the QPU, and to run a quantum task on the QPU.
- Parameters
arn (str) – The ARN of the QPU, for example, “arn:aws:aqx:::qpu:ionq”
aws_session (AwsSession, optional) – An AWS session object. Default = None.
- Raises
ValueError – If an unknown
arn
is specified.
Note
QPUs are physically located in specific AWS Regions. In some cases, the current
aws_session
connects to a Region other than the Region in which the QPU is physically located. When this occurs, a clonedaws_session
is created for the Region the QPU is located in.See
braket.aws.aws_qpu.AwsQpu.QPU_REGIONS
for the AWS Regions the QPUs are located in.-
QPU_REGIONS
= {<AwsQpuArns.DWAVE: 'arn:aws:aqx:::qpu:d-wave'>: ['us-west-2'], <AwsQpuArns.IONQ: 'arn:aws:aqx:::qpu:ionq'>: ['us-east-1'], <AwsQpuArns.RIGETTI: 'arn:aws:aqx:::qpu:rigetti'>: ['us-west-1']}¶
-
run
(task_specification: Union[braket.circuits.circuit.Circuit, braket.annealing.problem.Problem], s3_destination_folder: braket.aws.aws_session.S3DestinationFolder, shots: Optional[int] = None, *aws_quantum_task_args, **aws_quantum_task_kwargs) → braket.aws.aws_quantum_task.AwsQuantumTask[source]¶ Run a quantum task specification on this quantum device. A task can be a circuit or an annealing problem. Currently, only circuits are supported in the Private Beta.
- Parameters
task_specification (Union[Circuit, Problem]) – Specification of task (circuit or annealing problem) to run on device.
s3_destination_folder – The S3 location to save the task’s results
shots (Optional[int]) – The number of times to run the circuit or annealing problem
*aws_quantum_task_args – Variable length positional arguments for
braket.aws.aws_quantum_task.AwsQuantumTask.create()
.**aws_quantum_task_kwargs – Variable length keyword arguments for
braket.aws.aws_quantum_task.AwsQuantumTask.create()
.
- Returns
AwsQuantumTask – An AwsQuantumTask that tracks the execution on the device.
Examples
>>> circuit = Circuit().h(0).cnot(0, 1) >>> device = AwsQpu("arn:aws:aqx:::qpu:rigetti") >>> device.run(circuit, ("bucket-foo", "key-bar"))
>>> circuit = Circuit().h(0).cnot(0, 1) >>> device = AwsQpu("arn:aws:aqx:::qpu:rigetti") >>> device.run(task_specification=circuit, >>> s3_destination_folder=("bucket-foo", "key-bar"))
>>> problem = Problem( >>> ProblemType.ISING, >>> linear={1: 3.14}, >>> quadratic={(1, 2): 10.08}, >>> ) >>> device = AwsQpu("arn:aws:aqx:::qpu:d-wave") >>> device.run(problem, ("bucket-foo", "key-bar"), >>> backend_parameters = {"dWaveParameters": {"postprocessingType": "SAMPLING"}})
-
property
arn
¶ Return the ARN of the QPU
- Type
str
-
property
properties
¶ Return the QPU properties
- Type
Dict[str, Any]