Skip to content

Commit b3945f1

Browse files
fix(docs): clarify what printing a compiled program's output looks like for different targets (#1833)
* fix: clarify what printing a compiled program's output looks like for different targets * fix: grammar
1 parent 919236b commit b3945f1

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

docs/source/compiler.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ as in the following:
3737

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

40-
ep = qc.compile(Program(H(0), CNOT(0,1), CNOT(1,2)))
40+
executable = qc.compile(Program(H(0), CNOT(0,1), CNOT(1,2)))
4141

42-
print(ep)
42+
print(executable)
4343

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

5050
...
5151

52-
with output
52+
with output (see note below)
5353

5454
.. code:: text
5555
@@ -67,6 +67,8 @@ with output
6767
RX(-pi/2) 2
6868
RZ(pi/2) 2
6969
70+
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.
71+
7072
The compiler connection is also available directly via the property ``qc.compiler``. The
7173
precise class of this object changes based on context (e.g., :py:class:`~pyquil.api.QPUCompiler`,
7274
:py:class:`~pyquil.api.QVMCompiler`), but it always conforms to the interface laid out by :py:class:`~pyquil.api.AbstractCompiler`:
@@ -100,8 +102,8 @@ the previous example snippet is identical to the following:
100102
np = qc.compiler.quil_to_native_quil(p, protoquil=True)
101103
print(np)
102104

103-
ep = qc.compiler.native_quil_to_executable(np)
104-
print(ep)
105+
exe = qc.compiler.native_quil_to_executable(np)
106+
print(exe)
105107

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

152+
.. _compilation_metadata:
153+
150154
Compilation metadata
151155
====================
152156

0 commit comments

Comments
 (0)