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

edc972b9d5ed4a52b73cc5c082e8a935

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.

56413a13dbcb446a978e17b13b32643a