Skip to content

Commit

Permalink
Register entry point for LocalSimulator
Browse files Browse the repository at this point in the history
  • Loading branch information
rmshaffer committed May 14, 2024
1 parent fd04643 commit 0dc6f6e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ AutoQASM can support subroutines and complex control flow. You can use the Pytho
and quantum runtime side-by-side. There are rough edges at the moment, but we're actively smoothing
them out!

The Amazon Braket local simulator supports AutoQASM programs as input.
AutoQASM includes a simulator which can be accessed using the Amazon Braket local simulator interface.
Let's simulate the `conditional_multi_bell_states` program:

```
from braket.devices.local_simulator import LocalSimulator
device = LocalSimulator()
device = LocalSimulator("autoqasm")
task = device.run(conditional_multi_bell_states, shots=100)
result = task.result()
```
Expand Down
2 changes: 1 addition & 1 deletion examples/1_Getting_started_with_AutoQASM.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
}
],
"source": [
"device = LocalSimulator()\n",
"device = LocalSimulator(\"autoqasm\")\n",
"result = device.run(bell_state, shots=100).result()\n",
"counts = Counter(result.measurements[\"return_value\"])\n",
"print(\"measurement counts: \", counts)"
Expand Down
2 changes: 1 addition & 1 deletion examples/2_Expressing_classical_control_flow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
}
],
"source": [
"device = LocalSimulator()\n",
"device = LocalSimulator(\"autoqasm\")\n",
"result = device.run(conditioned_bell, shots=500).result()\n",
"counts = Counter(result.measurements[\"return_value\"])\n",
"print(\"measurement counts: \", counts)\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/3_1_Iterative_phase_estimation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
}
],
"source": [
"device = LocalSimulator()\n",
"device = LocalSimulator(\"autoqasm\")\n",
"result = device.run(ipe, shots=100).result()\n",
"counts = Counter(result.measurements[\"b0\"])\n",
"print(\"measurement counts: \", counts)\n",
Expand Down
6 changes: 3 additions & 3 deletions examples/3_2_magic_state_distillation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
],
"source": [
"# Get measurement result\n",
"result = LocalSimulator().run(gate_teleportation, shots=100).result()\n",
"result = LocalSimulator(\"autoqasm\").run(gate_teleportation, shots=100).result()\n",
"counts = Counter(result.measurements[\"return_value\"])\n",
"print(\"measurement counts: \", counts)\n",
"\n",
Expand Down Expand Up @@ -315,7 +315,7 @@
],
"source": [
"n_shots = 1000\n",
"result = LocalSimulator().run(distillation, shots=n_shots).result()\n",
"result = LocalSimulator(\"autoqasm\").run(distillation, shots=n_shots).result()\n",
"counts = Counter(result.measurements[\"c\"])\n",
"print(\"measurement counts: \", counts)"
]
Expand Down Expand Up @@ -435,7 +435,7 @@
}
],
"source": [
"result = LocalSimulator().run(distillation_rus, shots=20).result()\n",
"result = LocalSimulator(\"autoqasm\").run(distillation_rus, shots=20).result()\n",
"counts = Counter(result.measurements[\"c2\"])\n",
"probs = {str(k): v / sum(counts.values()) for k, v in counts.items()}\n",
"\n",
Expand Down
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
"tox",
],
},
entry_points={
"braket.simulators": [
"autoqasm = autoqasm.simulator.simulator:McmSimulator",
]
},
include_package_data=True,
url="https://github.com/amazon-braket/autoqasm",
author="Amazon Web Services",
Expand Down
2 changes: 1 addition & 1 deletion src/autoqasm/simulator/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


class McmSimulator(StateVectorSimulator):
DEVICE_ID = "autoqasm_mcm"
DEVICE_ID = "autoqasm"

def initialize_simulation(self, **kwargs) -> Simulation:
"""
Expand Down

0 comments on commit 0dc6f6e

Please sign in to comment.