-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from CQCL/release/1.14
Release/1.14
- Loading branch information
Showing
11 changed files
with
248 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
__extension_version__ = "0.15.0" | ||
__extension_version__ = "0.16.0" | ||
__extension_name__ = "pytket-quantinuum" |
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,136 @@ | ||
# pip install pytket~=1.13 | ||
|
||
# # WASM function calls with pytket | ||
# The WASM module in python allows you to add external classical functions from a compiled web assembly (WASM) to the circuit. | ||
|
||
# In the first step you need to read in the wasm file. You can do this when creating the wasm file handler by giving the path to the file. The wasmfilehandler now knows all available functions and the corresponding signatures. If you are not sure about the signatures of the functions of your file you can get a list of them from the wasmfilehandler like shown below. The parameters and result types of the supported functions must be i32. All functions that contain other types will be listed when printing the wasmfilehandler as well, but you can't add them to a circuit. | ||
|
||
from pytket import wasm, Circuit, Bit | ||
|
||
wfh = wasm.WasmFileHandler("testfile.wasm") | ||
print("wasm file uid:") | ||
print(wfh) | ||
|
||
print("\n\nwasm file repr:") | ||
print(repr(wfh)) | ||
|
||
# In the next step we want to add some of the classical function calls to a circuit. We will start with adding the function "add_one" to read in for the first parameter from Bit(0) and write the result to Bit(1). The length of the two list giving the number of bits needs to be the number of parameters and the number of results. | ||
|
||
c = Circuit(0, 8) | ||
|
||
c.add_wasm( | ||
"add_one", # name of the function | ||
wfh, # wasm file handler | ||
[1], # number of bits in each of the parameter i32 | ||
[1], # number of bits in each of the result i32 | ||
[Bit(0), Bit(1)], | ||
) # list of bits where the wasm op will be added to | ||
|
||
# If you want to have more than one bit per parameter, you can add that in the following way. This will add the function "add_one" to read in for the first parameter from Bit(0) and Bit(1) and write the result to Bit(2), Bit(3) and Bit(4). | ||
|
||
c.add_wasm( | ||
"add_one", # name of the function | ||
wfh, # wasm file handler | ||
[2], # number of bits in each of the parameter i32 | ||
[3], # number of bits in each of the result i32 | ||
[Bit(0), Bit(1), Bit(2), Bit(3), Bit(4)], | ||
) # list of bits where the wasm op will be added to | ||
|
||
# When adding functions with multiple parameters this can be done in the same way: | ||
|
||
c.add_wasm( | ||
"multi", # name of the function | ||
wfh, # wasm file handler | ||
[2, 1], # number of bits in each of the parameter i32 | ||
[3], # number of bits in each of the result i32 | ||
[Bit(0), Bit(1), Bit(5), Bit(2), Bit(3), Bit(4)], | ||
) # list of bits where the wasm op will be added to | ||
|
||
# If you want to add two parameters with the same bits, that is fine, too. | ||
|
||
c.add_wasm( | ||
"multi", # name of the function | ||
wfh, # wasm file handler | ||
[2, 2], # number of bits in each of the parameter i32 | ||
[3], # number of bits in each of the result i32 | ||
[Bit(0), Bit(1), Bit(0), Bit(1), Bit(2), Bit(3), Bit(4)], | ||
) # list of bits where the wasm op will be added to | ||
|
||
# If you are working with registers in your circuit to organise the classical bits you can add wasm to your circuit using given registers for each parameter and the return value. | ||
|
||
# add registers to circuit | ||
|
||
c0 = c.add_c_register("c0", 3) | ||
c1 = c.add_c_register("c1", 4) | ||
c2 = c.add_c_register("c2", 5) | ||
|
||
c.add_wasm_to_reg( | ||
"multi", # function name | ||
wfh, # wasm file handler | ||
[c0, c1], # register for each input parameter | ||
[c2], | ||
) # register for the result | ||
c.add_wasm_to_reg( | ||
"add_one", # function name | ||
wfh, # wasm file handler | ||
[c2], # register for each input parameter | ||
[c2], | ||
) # register for the result | ||
|
||
# The WASM might have some global data stored. To make sure this data is not messed up by function calls in the wrong order pytket will make sure that the order of the wasm calls within a circuit is not restructured. For this purpose pytket will add all wasm operation to a wasm_wire by default. If you are not worried about a possible restructure of the wasm calls in your circuit you have the option to not add the wasm_wire to your wasm operations. If you only want to stop some special reordering for some of your wasm operations you can add some the wasm operations to multiple wasm_wire to allow the restructuring in the intended way. Even if there are not wasm_wire given, pytket will only restructure the the wasm operations if there are no dependencies to in parameters or the results. | ||
|
||
# Here you can see that all operations we have created above are conected to the default wasm_wire: | ||
|
||
for g in c: | ||
print(g) | ||
|
||
# We will now create a new circuit and add four operations. The two add_one operations should be allowed to commute, but we want to make sure that "multi" is executed after the two other functions. The last add_two operation can commute with all others. | ||
|
||
c = Circuit(0, 5) | ||
|
||
c.add_wasm("add_one", wfh, [1], [1], [Bit(0), Bit(0)], [0]) | ||
c.add_wasm("add_one", wfh, [1], [1], [Bit(1), Bit(1)], [1]) | ||
c.add_wasm("multi", wfh, [1, 1], [1], [Bit(2), Bit(3), Bit(2)], [0, 1]) | ||
c.add_wasm("add_two", wfh, [1], [1], [Bit(4), Bit(4)], []) | ||
|
||
for g in c: | ||
print(g) | ||
|
||
# One helpful feature might be to plot the DAG of the circuit to get an overview of the different components of the circuit | ||
|
||
from pytket.utils import Graph | ||
|
||
g = Graph(c) | ||
g.view_DAG() | ||
|
||
# ## Send WASM to the Backend | ||
# In the last step we want to send the circuit with the wasm to a backend. First we create the backend. For this step you will need Quantinuum credentials. | ||
|
||
from pytket.extensions.quantinuum import QuantinuumBackend | ||
|
||
machine = "H1-1E" | ||
b = QuantinuumBackend(device_name=machine) | ||
b.login() | ||
|
||
# When processing the circuit you need to add the wasmfilehandler you created as parameter to the `process_circuits` in the shown way | ||
|
||
from pytket.extensions.quantinuum import QuantinuumBackend | ||
|
||
c = Circuit(1) | ||
c.name = "test_wasm" | ||
a = c.add_c_register("a", 8) | ||
c.add_wasm_to_reg("add_one", wfh, [a], [a]) | ||
c = b.get_compiled_circuit(c) | ||
h = b.process_circuits([c], n_shots=10, wasm_file_handler=wfh)[0] | ||
|
||
status = b.circuit_status(h) | ||
print(status) | ||
|
||
status = b.circuit_status(h) | ||
print(status) | ||
|
||
result = b.get_result(h) | ||
print(result) | ||
|
||
for shot in result.get_shots(): | ||
print(shot) |
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 @@ | ||
{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["![Quantinuum_logo](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAABLCAMAAACLOq%2BzAAACx1BMVEUAAAAAAP%2BAgIBVqqqAgIBmmZmAgKptkpKAgJ9xjo6AgJl0i6JqgJV2iZ1tgJJ3iJlwgJ94h5ZxgJx5hpRzgJl5hp50gJdvhZt1gJVwhZl2gJ12gJtyhJV3gJlzhJx4gJd0g5txgJZ1g5lxgJx1g5hygJp2g5ZzgJl2g5tzgJh3gpp0gJdxgpl0gJtygph1gJpygpd1gJlzgpt2gJhzgpp2gJd0gplygJt0gphygJp1gpdzgJl1gptzgJh1gpp2gZl0gJtygZh0gJpzgZh1gJlzgZp1gJhzgZp1gJh0gZl0gZhygJp0gZhzgJl0gZpzgJh1gZpzgJh1gZl0gJp1gZh0gJp0gJlzgZp0gJhzgZp1gJhzgZl1gJp0gZh1gJp0gZhzgJl0gZpzgJlzgJh1gZlzgJp1gZl1gZh0gJl0gJlzgZl0gJhzgZl1gJp0gZl1gJl0gZh1gJl0gZpzgJl0gZlzgJh0gZlzgJp0gZl0gJl1gJh1gJpzgJl0gJhzgJl0gJpzgJl0gJl1gJl0gJp1gJl0gJl1gJhzgJp0gJlzgJl0gJh0gJl1gJp0gJl1gJl0gJh1gJl0gJpzgJl0gJlzgJh0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S3lOPYvwHm6EgyjZtx7TqCq69%2Bj3FkNTyp6iSP1gLpugvHMiUCp9bjSFEesPILRqkM7tFrlLbS8Bqu6%2FVHCP36n6EYmxv7QK9jenxKVu6J1sEYB8qAuTpxq68C18fVuOI0FePzYqBANalaDyRrHUbvmuO9gA%2FPxGE8rVFA0VHY4rsr7EBDAkUtHNiJK10ZwHy9lUD0cnmBmWq3FeNQGUaBarUV1%2FYqXP01DeNoMcYi1aoMY5MKI0neoRyMe31%2Fv5FeeS0fhQAlR2Fg8755WgirmnlWo%2FCLHRgKeFZIdY16Ixyu%2BrJy%2BDBHqW8IUF2G4xnpLVzvfYIrXtMxaopxPC%2BVY8T8ReePy1eI38xmX81%2FtedqjNVHgZfV9mUUrGok%2FvjpsXQ0svj90jSMG7zD8Yt%2BZiwwLwu%2FXG82rqzHcMV4R2AU%2FAa%2FGd7JOEImvv7e8mG0u3nJuxuzw3Fk5AP9vd7RwMQCGPQfHayoKClZ6R3FlRJV8MnJ2trG2trZXBH%2FA2RBOeTINIkQAAAAAElFTkSuQmCC)<br>\n", "pip install pytket~=1.13"]}, {"cell_type": "markdown", "metadata": {}, "source": ["# WASM function calls with pytket<br>\n", "The WASM module in python allows you to add external classical functions from a compiled web assembly (WASM) to the circuit."]}, {"cell_type": "markdown", "metadata": {}, "source": ["In the first step you need to read in the wasm file. You can do this when creating the wasm file handler by giving the path to the file. The wasmfilehandler now knows all available functions and the corresponding signatures. If you are not sure about the signatures of the functions of your file you can get a list of them from the wasmfilehandler like shown below. The parameters and result types of the supported functions must be i32. All functions that contain other types will be listed when printing the wasmfilehandler as well, but you can't add them to a circuit."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from pytket import wasm, Circuit, Bit"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["wfh = wasm.WasmFileHandler(\"testfile.wasm\")\n", "print(\"wasm file uid:\")\n", "print(wfh)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["print(\"\\n\\nwasm file repr:\")\n", "print(repr(wfh))"]}, {"cell_type": "markdown", "metadata": {}, "source": ["In the next step we want to add some of the classical function calls to a circuit. We will start with adding the function \"add_one\" to read in for the first parameter from Bit(0) and write the result to Bit(1). The length of the two list giving the number of bits needs to be the number of parameters and the number of results."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["c = Circuit(0, 8)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["c.add_wasm(\n", " \"add_one\", # name of the function\n", " wfh, # wasm file handler\n", " [1], # number of bits in each of the parameter i32\n", " [1], # number of bits in each of the result i32\n", " [Bit(0), Bit(1)],\n", ") # list of bits where the wasm op will be added to"]}, {"cell_type": "markdown", "metadata": {}, "source": ["If you want to have more than one bit per parameter, you can add that in the following way. This will add the function \"add_one\" to read in for the first parameter from Bit(0) and Bit(1) and write the result to Bit(2), Bit(3) and Bit(4)."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["c.add_wasm(\n", " \"add_one\", # name of the function\n", " wfh, # wasm file handler\n", " [2], # number of bits in each of the parameter i32\n", " [3], # number of bits in each of the result i32\n", " [Bit(0), Bit(1), Bit(2), Bit(3), Bit(4)],\n", ") # list of bits where the wasm op will be added to"]}, {"cell_type": "markdown", "metadata": {}, "source": ["When adding functions with multiple parameters this can be done in the same way:"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["c.add_wasm(\n", " \"multi\", # name of the function\n", " wfh, # wasm file handler\n", " [2, 1], # number of bits in each of the parameter i32\n", " [3], # number of bits in each of the result i32\n", " [Bit(0), Bit(1), Bit(5), Bit(2), Bit(3), Bit(4)],\n", ") # list of bits where the wasm op will be added to"]}, {"cell_type": "markdown", "metadata": {}, "source": ["If you want to add two parameters with the same bits, that is fine, too."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["c.add_wasm(\n", " \"multi\", # name of the function\n", " wfh, # wasm file handler\n", " [2, 2], # number of bits in each of the parameter i32\n", " [3], # number of bits in each of the result i32\n", " [Bit(0), Bit(1), Bit(0), Bit(1), Bit(2), Bit(3), Bit(4)],\n", ") # list of bits where the wasm op will be added to"]}, {"cell_type": "markdown", "metadata": {}, "source": ["If you are working with registers in your circuit to organise the classical bits you can add wasm to your circuit using given registers for each parameter and the return value."]}, {"cell_type": "markdown", "metadata": {}, "source": ["add registers to circuit"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["c0 = c.add_c_register(\"c0\", 3)\n", "c1 = c.add_c_register(\"c1\", 4)\n", "c2 = c.add_c_register(\"c2\", 5)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["c.add_wasm_to_reg(\n", " \"multi\", # function name\n", " wfh, # wasm file handler\n", " [c0, c1], # register for each input parameter\n", " [c2],\n", ") # register for the result\n", "c.add_wasm_to_reg(\n", " \"add_one\", # function name\n", " wfh, # wasm file handler\n", " [c2], # register for each input parameter\n", " [c2],\n", ") # register for the result"]}, {"cell_type": "markdown", "metadata": {}, "source": ["The WASM might have some global data stored. To make sure this data is not messed up by function calls in the wrong order pytket will make sure that the order of the wasm calls within a circuit is not restructured. For this purpose pytket will add all wasm operation to a wasm_wire by default. If you are not worried about a possible restructure of the wasm calls in your circuit you have the option to not add the wasm_wire to your wasm operations. If you only want to stop some special reordering for some of your wasm operations you can add some the wasm operations to multiple wasm_wire to allow the restructuring in the intended way. Even if there are not wasm_wire given, pytket will only restructure the the wasm operations if there are no dependencies to in parameters or the results."]}, {"cell_type": "markdown", "metadata": {}, "source": ["Here you can see that all operations we have created above are conected to the default wasm_wire:"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["for g in c:\n", " print(g)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["We will now create a new circuit and add four operations. The two add_one operations should be allowed to commute, but we want to make sure that \"multi\" is executed after the two other functions. The last add_two operation can commute with all others."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["c = Circuit(0, 5)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["c.add_wasm(\"add_one\", wfh, [1], [1], [Bit(0), Bit(0)], [0])\n", "c.add_wasm(\"add_one\", wfh, [1], [1], [Bit(1), Bit(1)], [1])\n", "c.add_wasm(\"multi\", wfh, [1, 1], [1], [Bit(2), Bit(3), Bit(2)], [0, 1])\n", "c.add_wasm(\"add_two\", wfh, [1], [1], [Bit(4), Bit(4)], [])"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["for g in c:\n", " print(g)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["One helpful feature might be to plot the DAG of the circuit to get an overview of the different components of the circuit"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from pytket.utils import Graph"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["g = Graph(c)\n", "g.view_DAG()"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## Send WASM to the Backend<br>\n", "In the last step we want to send the circuit with the wasm to a backend. First we create the backend. For this step you will need Quantinuum credentials."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from pytket.extensions.quantinuum import QuantinuumBackend"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["machine = \"H1-1E\"\n", "b = QuantinuumBackend(device_name=machine)\n", "b.login()"]}, {"cell_type": "markdown", "metadata": {}, "source": ["When processing the circuit you need to add the wasmfilehandler you created as parameter to the `process_circuits` in the shown way"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from pytket.extensions.quantinuum import QuantinuumBackend"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["c = Circuit(1)\n", "c.name = \"test_wasm\"\n", "a = c.add_c_register(\"a\", 8)\n", "c.add_wasm_to_reg(\"add_one\", wfh, [a], [a])\n", "c = b.get_compiled_circuit(c)\n", "h = b.process_circuits([c], n_shots=10, wasm_file_handler=wfh)[0]"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["status = b.circuit_status(h)\n", "print(status)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["status = b.circuit_status(h)\n", "print(status)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["result = b.get_result(h)\n", "print(result)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["for shot in result.get_shots():\n", " print(shot)"]}], "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.4"}}, "nbformat": 4, "nbformat_minor": 2} |
Oops, something went wrong.