  We address the problem of distributing approximation errors in large-scale
quantum programs. It has been known for some time that when compiling quantum
algorithms for a fault-tolerant architecture, some operations must be
approximated as they cannot be implemented with arbitrary accuracy by the
underlying gate set. This leads to approximation errors which often can be
grouped along subroutines that the given quantum algorithm is composed of.
Typically, choices can be made as to how to distribute approximation errors so
that the overall error is kept beneath a user- or application-defined
threshold. These choices impact the resource footprint of the fault-tolerant
implementation. We develop an automatic approximation error management module
to tackle the resulting optimization problems. The module is based on annealing
and can be integrated into any quantum software framework. Using the benchmark
of simulating an Ising model with transverse field, we provide numerical
results to quantify the benefits and trade-offs involved in our approach.
