-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Azure Quantum plugin implementation (#573)
Signed-off-by: Daniel Claudino <[email protected]>
- Loading branch information
1 parent
29766e7
commit d1edaa7
Showing
6 changed files
with
552 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import xacc | ||
|
||
xacc.qasm('''.compiler xasm | ||
.circuit ansatz | ||
.qbit q | ||
H(q[0]); | ||
CX(q[0],q[1]); | ||
Measure(q[0]); | ||
Measure(q[1]); | ||
''') | ||
ansatz = xacc.getCompiled('ansatz') | ||
buffer = xacc.qalloc(2) | ||
|
||
# running the estimator with the pyqir visitor and printing the data | ||
qpu = xacc.getAccelerator('azure', {"shots": 1024, "backend": "microsoft.estimator", "visitor": "pyqir"}) | ||
qpu.execute(buffer, ansatz) | ||
print(buffer["estimate-data"]) | ||
|
||
# running the IonQ simulator | ||
buffer.resetBuffer() | ||
qpu = xacc.getAccelerator('azure', {"shots": 1024, "backend": "ionq.simulator", "visitor": "qiskit"}) | ||
qpu.execute(buffer, ansatz) | ||
print(buffer) | ||
|
||
# runnning the Quantinuum emulator to estimate credits | ||
buffer.resetBuffer() | ||
qpu = xacc.getAccelerator('azure', {"shots": 1024, "backend": "quantinuum.sim.h1-2e", "visitor": "qiskit", "get-cost": True}) | ||
qpu.execute(buffer, ansatz) | ||
print(buffer) |
Oops, something went wrong.