Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples l4 submission #6

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
133 changes: 133 additions & 0 deletions examples/Quantinuum_compiler_options.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div style=\"text-align: center;\"><br>\n",
"<img src=\"https://assets-global.website-files.com/62b9d45fb3f64842a96c9686/62d84db4aeb2f6552f3a2f78_Quantinuum%20Logo__horizontal%20blue.svg\" width=\"200\" height=\"200\" /></div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# TKET Compilation in H-Series Stack"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Circuits submitted to Quantinuum H-Series systems, except for integrated hybrid submissions, are automatically run through TKET compilation passes for H-Series hardware. This enables circuits to be automatically optimized for H-Series systems and run more efficiently.\n",
"\n",
"More information on the specific compilation passes applied can be found in the [pytket-quantinuum documentation](https://tket.quantinuum.com/extensions/pytket-quantinuum/#default-compilation).\n",
"\n",
"In the H-Series software stack, the optimization level applied is set with the `tket-opt-level` parameter. The default compilation setting for all circuits submitted to H-Series systems is optimization level 2.\n",
"\n",
"Users who would like to experiment with the TKET compilation passes and see what optimizations would apply to their circuits before submitting any jobs can see [Quantinuum_compile_without_api.ipynb](https://github.com/CQCL/pytket-quantinuum/blob/main/examples/Quantinuum_compile_without_api.ipynb).\n",
"\n",
"To turn TKET compilation in the stack off, a different option, `no-opt`, can be set to `True` inside `option_params`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from pytket.circuit import Circuit\n",
"\n",
"circuit = Circuit(2)\n",
"circuit.H(0).CX(0, 1)\n",
"circuit.measure_all();"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from pytket.extensions.azure import AzureBackend\n",
"\n",
"backend = AzureBackend(name=\"quantinuum.sim.h1-1e\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"option_params = {\n",
" \"tket-opt-level\": 1\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"compiled_circuit = backend.get_compiled_circuit(circuit)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"handle = backend.process_circuit(compiled_circuit, n_shots=100, option_params=option_params)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"backend.circuit_status(handle)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"result = backend.get_result(handle)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div align=\"center\"> &copy; 2024 by Quantinuum. All Rights Reserved. </div>"
]
}
],
"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.10.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
128 changes: 128 additions & 0 deletions examples/Quantinuum_emulator_noise_api_options.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div style=\"text-align: center;\"><br>\n",
"<img src=\"https://assets-global.website-files.com/62b9d45fb3f64842a96c9686/62d84db4aeb2f6552f3a2f78_Quantinuum%20Logo__horizontal%20blue.svg\" width=\"200\" height=\"200\" /></div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Emulator Noise Parameters"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Users have the option of experimenting with the noise parameters of the Quantinuum emulators. Only a few of the available noise parameters are highlighted here demonstrating how to pass tQuantinuum API options to `AzureBackend` at job submission time.\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Users have the option of experimenting with the noise parameters of the Quantinuum emulators. Only a few of the available noise parameters are highlighted here demonstrating how to pass tQuantinuum API options to `AzureBackend` at job submission time.\n",
"Users have the option of experimenting with the noise parameters of the Quantinuum emulators. Only a few of the available noise parameters are highlighted here demonstrating how to pass Quantinuum API options to `AzureBackend` at job submission time.\n",

"\n",
"For more information on the full set of noise parameters available, see the H-series emulator product data sheets on the [System Model H1](https://www.quantinuum.com/hardware/h1) and [System Model H2](https://www.quantinuum.com/hardware/h2) pages."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from pytket.circuit import Circuit\n",
"\n",
"circuit = Circuit(2)\n",
"circuit.H(0).CX(0, 1)\n",
"circuit.measure_all();"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from pytket.extensions.azure import AzureBackend\n",
"\n",
"backend = AzureBackend(name=\"quantinuum.sim.h1-1e\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"option_params = {\n",
" \"error-params\": {\n",
" \"p1\": 4e-5,\n",
" \"p2\": 3e-3,\n",
" \"p_meas\": [3e-3, 3e-3],\n",
" \"p_init\": 4e-5,\n",
" \"p_crosstalk_meas\": 1e-5,\n",
" \"p_crosstalk_init\": 3e-5,\n",
" \"p1_emission_ratio\": 6e-6,\n",
" \"p2_emission_ratio\": 2e-4\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"compiled_circuit = backend.get_compiled_circuit(circuit)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"handle = backend.process_circuit(compiled_circuit, n_shots=100, option_params=option_params)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"backend.circuit_status(handle)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"result = backend.get_result(handle)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div align=\"center\"> &copy; 2024 by Quantinuum. All Rights Reserved. </div>"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.10.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading