braket.aws.aws_quantum_simulator module

class braket.aws.aws_quantum_simulator.AwsQuantumSimulator(arn: str, aws_session=None)[source]

Bases: braket.devices.device.Device

Amazon Braket implementation of a quantum simulator. Use this class to retrieve the latest metadata about the simulator, and to run a task on the simulator.

Parameters
  • arn (str) – The ARN of the simulator, for example, “arn:aws:aqx:::quantum-simulator:aqx:qs1”.

  • aws_session (AwsSession, optional) – An AWS session object. Default = None.

run(task_specification: Union[braket.circuits.circuit.Circuit, braket.annealing.problem.Problem], s3_destination_folder: braket.aws.aws_session.S3DestinationFolder, shots: int = 0, *aws_quantum_task_args, **aws_quantum_task_kwargs)braket.aws.aws_quantum_task.AwsQuantumTask[source]

Run a task on the simulator device.

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 (int, optional) – The number of times to run the circuit or annealing problem. Default is 0. For circuits, when shots=0, the simulator will support simulator-only result types, compute the exact results based on the task specification, and sampling is not supported. shots>0 means that the simulator will be treated like a QPU and only support result types available for a QPU.

  • *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 task execution on the device.

Examples

>>> circuit = Circuit().h(0).cnot(0, 1)
>>> device = AwsQuantumSimulator("arn:aws:aqx:::quantum-simulator:aqx:qs1")
>>> device.run(circuit, ("bucket", "key"), shots=1000)
>>> circuit = Circuit().h(0).cnot(0, 1)
>>> device = AwsQuantumSimulator("arn:aws:aqx:::quantum-simulator:aqx:qs1")
>>> device.run(circuit=circuit, s3_destination_folder=("bucket", "key"), shots=1000)
refresh_metadata() → None[source]

Refresh the AwsQuantumSimulator object with the most recent simulator metadata.

property arn

Returns the ARN of the simulator.

Type

str

property properties

Return the simulator properties

Type

Dict[str, Any]