Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions docs/source/compiler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ as in the following:

qc = get_qc("9q-square-qvm")

ep = qc.compile(Program(H(0), CNOT(0,1), CNOT(1,2)))
executable = qc.compile(Program(H(0), CNOT(0,1), CNOT(1,2)))

print(ep)
print(executable)

..
Cannot actually check the output because quilc is non-deterministic, but still need to
Expand All @@ -49,7 +49,7 @@ as in the following:

...

with output
with output (see note below)

.. code:: text

Expand All @@ -67,6 +67,8 @@ with output
RX(-pi/2) 2
RZ(pi/2) 2

Note that printing ``executable`` here — the result of a ``qc.compile`` call — only results in a readable native Quil program like the above if the Quantum Computer is a QVM. When compiling for live QPU targets, this printed output will be encrypted and opaque because of program translation. See :ref:`Compilation metadata <compilation_metadata>` for instructions on how to convert a program to native gates independent of program translation.

The compiler connection is also available directly via the property ``qc.compiler``. The
precise class of this object changes based on context (e.g., :py:class:`~pyquil.api.QPUCompiler`,
:py:class:`~pyquil.api.QVMCompiler`), but it always conforms to the interface laid out by :py:class:`~pyquil.api.AbstractCompiler`:
Expand Down Expand Up @@ -100,8 +102,8 @@ the previous example snippet is identical to the following:
np = qc.compiler.quil_to_native_quil(p, protoquil=True)
print(np)

ep = qc.compiler.native_quil_to_executable(np)
print(ep)
exe = qc.compiler.native_quil_to_executable(np)
print(exe)

.. testoutput:: quilc
:hide:
Expand Down Expand Up @@ -147,6 +149,8 @@ To instruct the compiler to produce Quil code that can be executed on a QPU, you
JupyterLab notebook's compiler) then specifying ``protoquil=False`` will override the server
and forcefully disable protoquil. Specifying ``protoquil=None`` defers to the server's choice.

.. _compilation_metadata:

Compilation metadata
====================

Expand Down
Loading