QuantumComputer.compile(program, to_native_gates=True, optimize=True)[source]

A high-level interface to program compilation.

Compilation currently consists of two stages. Please see the AbstractCompiler docs for more information. This function does all stages of compilation.

Right now both to_native_gates and optimize must be either both set or both unset. More modular compilation passes may be available in the future.

  • program (Program) – A Program
  • to_native_gates (bool) – Whether to compile non-native gates to native gates.
  • optimize (bool) – Whether to optimize programs to reduce the number of operations.
Return type:

Union[BinaryExecutableResponse, PyQuilExecutableResponse]


An executable binary suitable for passing to QuantumComputer.run().