Running a quantum task with the local simulator - Amazon Braket

Running a quantum task with the local simulator

You can send quantum tasks directly to a local simulator for rapid prototyping and testing. This simulator runs in your local environment, so you do not need to specify an Amazon S3 location. The results are computed directly in your session. To run a quantum task on the local simulator, you must only specify the shots parameter.

Note

The execution speed and maximum number of qubits the local simulator can process depends on the Amazon Braket notebook instance type, or on your local hardware specifications.

The following commands are all identical and instantiate the state vector (noise free) local simulator.

# import the LocalSimulator module from braket.devices import LocalSimulator # the following are identical commands device = LocalSimulator() device = LocalSimulator("default") device = LocalSimulator(backend="default") device = LocalSimulator(backend="braket_sv")

Then run a quantum task with the following.

my_task = device.run(circ, shots=1000)

To instantiate the local density matrix (noise) simulator customers change the backend as follows.

# import the LocalSimulator module from braket.devices import LocalSimulator device = LocalSimulator(backend="braket_dm")