{
"cells": [
{
"cell_type": "markdown",
"id": "bf94a9f4-6be0-4eda-b441-ecc85f89e0c7",
"metadata": {},
"source": [
"# Optimizing Performance\n",
"\n",
"Performance is a key focus for the CUDA-Q design. This section highlights some features that advanced users can take advantage of to increase performance in certain situations."
]
},
{
"cell_type": "markdown",
"id": "1dcc9c85-780b-495e-aebe-8cd9c0012792",
"metadata": {},
"source": [
"### Gate Fusion\n",
"\n",
"Gate fusion is an optimization technique where consecutive gates are combined into a single gate operation to improve the efficiency of the simulation (See figure below). By targeting the `nvidia-mgpu` backend and setting the `CUDAQ_MGPU_FUSE` environment variable, you can select the degree of fusion that takes place. A full command line example would look like `CUDAQ_MGPU_FUSE=4 python c2h2VQE.py --target nvidia --target-option fp64,mgpu`\n",
"\n",
"
\n",
"\n",
"The importance of gate fusion is system dependent, but can have a large influence on the performance of the simulation. See the example below for a 24 qubit VQE experiment where changing the fusion level resulted in significant performance boosts.\n",
"\n",
"
\n",
"\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}