diff --git a/examples/Quantinuum_compiler_options.ipynb b/examples/Quantinuum_compiler_options.ipynb new file mode 100644 index 0000000..0e6fc0e --- /dev/null +++ b/examples/Quantinuum_compiler_options.ipynb @@ -0,0 +1,133 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

\n", + "
" + ] + }, + { + "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": [ + "
© 2024 by Quantinuum. All Rights Reserved.
" + ] + } + ], + "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 +} diff --git a/examples/Quantinuum_emulator_noise_api_options.ipynb b/examples/Quantinuum_emulator_noise_api_options.ipynb new file mode 100644 index 0000000..f5054b0 --- /dev/null +++ b/examples/Quantinuum_emulator_noise_api_options.ipynb @@ -0,0 +1,128 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

\n", + "
" + ] + }, + { + "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", + "\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": [ + "
© 2024 by Quantinuum. All Rights Reserved.
" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python", + "version": "3.10.14" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}