Optimizing Performance

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.

Gate Fusion

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

aac0f5895594456e95025e53f1f09ee3

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.

a3b1d2da2b3a4f31bdb5349d7a21ac78