braket.simulator.braket_simulator module

class braket.simulator.braket_simulator.BraketSimulator[source]

Bases: ABC

An abstract simulator that locally runs a quantum task.

The task can be either a quantum circuit defined in an OpenQASM or JAQCD program, or an analog Hamiltonian simulation (AHS) program.

For users creating their own simulator: to register a simulator so the Braket SDK recognizes its name, the name and class must be added as an entry point for “braket.simulators”. This is done by adding an entry to entry_points in the simulator package’s setup.py:

>>> entry_points = {
>>>     "braket.simulators": [
>>>         "backend_name = <backend_class>"
>>>     ]
>>> }
DEVICE_ID = None
abstractmethod run(ir: Program | Program | Program | ProgramSet, *args, **kwargs) GateModelTaskResult | ProgramSetTaskResult | AnalogHamiltonianSimulationTaskResult[source]

Run the task specified by the given IR.

Extra arguments will contain any additional information necessary to run the task, such as the extra parameters for AHS simulations.

Parameters:

ir (OQ3Program | AHSProgram | JaqcdProgram | ProgramSet) – The IR representation of the program

Returns:

GateModelTaskResult | ProgramSetTaskResult | AnalogHamiltonianSimulationTaskResult – An object representing the results of the simulation.

run_multiple(programs: Sequence[Program | Program | Program], max_parallel: int | None = None, *args, **kwargs) list[GateModelTaskResult | AnalogHamiltonianSimulationTaskResult][source]

Run the tasks specified by the given IR programs.

Extra arguments will contain any additional information necessary to run the tasks, such as the extra parameters for AHS simulations.

Parameters:
  • programs (Sequence[OQ3Program | AHSProgram | JaqcdProgram]) – The IR representations of the programs

  • max_parallel (int | None) – The maximum number of programs to run in parallel. Default is the number of logical CPUs.

Returns:

list[GateModelTaskResult | AnalogHamiltonianSimulationTaskResult] – A list of result objects, with the ith object being the result of the ith program.

abstract property properties: DeviceCapabilities

Properties of the device.

Type:

DeviceCapabilities