Skip to content

Commit

Permalink
Docs preview for PR #1435.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuda-quantum-bot committed Mar 27, 2024
1 parent 2a9fd45 commit ac9210c
Show file tree
Hide file tree
Showing 72 changed files with 151 additions and 9 deletions.
2 changes: 2 additions & 0 deletions pr-1435/_sources/api/languages/cpp_api.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ Platform

.. doxygenclass:: cudaq::BaseRemoteSimulatorQPU

.. doxygenclass:: cudaq::BaseNvcfSimulatorQPU

.. doxygenclass:: cudaq::quantum_platform
:members:

Expand Down
4 changes: 4 additions & 0 deletions pr-1435/_sources/api/languages/python_api.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ Program Construction
.. automethod:: apply_call

.. autoclass:: cudaq::PyKernelDecorator
:members:
:special-members: __str__, __call__

.. autofunction:: kernel

Kernel Execution
=============================
Expand Down
1 change: 1 addition & 0 deletions pr-1435/api/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.PyKernel"><code class="docutils literal notranslate"><span class="pre">PyKernel</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.Kernel"><code class="docutils literal notranslate"><span class="pre">Kernel</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.PyKernelDecorator"><code class="docutils literal notranslate"><span class="pre">PyKernelDecorator</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.kernel"><code class="docutils literal notranslate"><span class="pre">kernel()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="languages/python_api.html#kernel-execution">Kernel Execution</a><ul>
Expand Down
1 change: 1 addition & 0 deletions pr-1435/api/default_ops.html
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.PyKernel"><code class="docutils literal notranslate"><span class="pre">PyKernel</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.Kernel"><code class="docutils literal notranslate"><span class="pre">Kernel</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.PyKernelDecorator"><code class="docutils literal notranslate"><span class="pre">PyKernelDecorator</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.kernel"><code class="docutils literal notranslate"><span class="pre">kernel()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="languages/python_api.html#kernel-execution">Kernel Execution</a><ul>
Expand Down
10 changes: 9 additions & 1 deletion pr-1435/api/languages/cpp_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
<li class="toctree-l4"><a class="reference internal" href="python_api.html#cudaq.PyKernel"><code class="docutils literal notranslate"><span class="pre">PyKernel</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="python_api.html#cudaq.Kernel"><code class="docutils literal notranslate"><span class="pre">Kernel</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="python_api.html#cudaq.PyKernelDecorator"><code class="docutils literal notranslate"><span class="pre">PyKernelDecorator</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="python_api.html#cudaq.kernel"><code class="docutils literal notranslate"><span class="pre">kernel()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="python_api.html#kernel-execution">Kernel Execution</a><ul>
Expand Down Expand Up @@ -2907,7 +2908,14 @@ <h2>Platform<a class="headerlink" href="#platform" title="Permalink to this head
<dl class="cpp class">
<dt class="sig sig-object cpp" id="_CPPv4N5cudaq22BaseRemoteSimulatorQPUE">
<span class="target" id="classcudaq_1_1BaseRemoteSimulatorQPU"></span><span class="k"><span class="pre">class</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">BaseRemoteSimulatorQPU</span></span></span><span class="w"> </span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="k"><span class="pre">public</span></span><span class="w"> </span><a class="reference internal" href="#_CPPv45cudaq" title="cudaq"><span class="n"><span class="pre">cudaq</span></span></a><span class="p"><span class="pre">::</span></span><a class="reference internal" href="#_CPPv4N5cudaq3QPUE" title="cudaq::QPU"><span class="n"><span class="pre">QPU</span></span></a><a class="headerlink" href="#_CPPv4N5cudaq22BaseRemoteSimulatorQPUE" title="Permalink to this definition">¶</a><br /></dt>
<dd></dd></dl>
<dd><p>Subclassed by <a class="reference internal" href="#classcudaq_1_1BaseNvcfSimulatorQPU"><span class="std std-ref">cudaq::BaseNvcfSimulatorQPU</span></a></p>
</dd></dl>

<dl class="cpp class">
<dt class="sig sig-object cpp" id="_CPPv4N5cudaq20BaseNvcfSimulatorQPUE">
<span class="target" id="classcudaq_1_1BaseNvcfSimulatorQPU"></span><span class="k"><span class="pre">class</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">BaseNvcfSimulatorQPU</span></span></span><span class="w"> </span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="k"><span class="pre">public</span></span><span class="w"> </span><a class="reference internal" href="#_CPPv45cudaq" title="cudaq"><span class="n"><span class="pre">cudaq</span></span></a><span class="p"><span class="pre">::</span></span><a class="reference internal" href="#_CPPv4N5cudaq22BaseRemoteSimulatorQPUE" title="cudaq::BaseRemoteSimulatorQPU"><span class="n"><span class="pre">BaseRemoteSimulatorQPU</span></span></a><a class="headerlink" href="#_CPPv4N5cudaq20BaseNvcfSimulatorQPUE" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Implementation of base <a class="reference internal" href="#classcudaq_1_1QPU"><span class="std std-ref">QPU</span></a> subtype that submits simulation request to NVCF. </p>
</dd></dl>

<dl class="cpp class">
<dt class="sig sig-object cpp" id="_CPPv4N5cudaq16quantum_platformE">
Expand Down
52 changes: 49 additions & 3 deletions pr-1435/api/languages/python_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
<li class="toctree-l4"><a class="reference internal" href="#cudaq.PyKernel"><code class="docutils literal notranslate"><span class="pre">PyKernel</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cudaq.Kernel"><code class="docutils literal notranslate"><span class="pre">Kernel</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cudaq.PyKernelDecorator"><code class="docutils literal notranslate"><span class="pre">PyKernelDecorator</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#cudaq.kernel"><code class="docutils literal notranslate"><span class="pre">kernel()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#kernel-execution">Kernel Execution</a><ul>
Expand Down Expand Up @@ -516,15 +517,30 @@ <h2>Program Construction<a class="headerlink" href="#program-construction" title
<dl class="py function">
<dt class="sig sig-object py" id="cudaq.make_kernel">
<span class="sig-prename descclassname"><span class="pre">cudaq.</span></span><span class="sig-name descname"><span class="pre">make_kernel</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cudaq.make_kernel" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dd><blockquote>
<div><p>Create a <a class="reference internal" href="#cudaq.Kernel" title="cudaq.Kernel"><code class="xref py py-class docutils literal notranslate"><span class="pre">Kernel</span></code></a>: An empty kernel function to be used for quantum
program construction. This kernel is non-parameterized if it accepts no
arguments, else takes the provided types as arguments.</p>
<p>Returns a kernel if it is non-parameterized, else a tuple containing the
kernel and a <a class="reference internal" href="#cudaq.QuakeValue" title="cudaq.QuakeValue"><code class="xref py py-class docutils literal notranslate"><span class="pre">QuakeValue</span></code></a> for each kernel argument.</p>
</div></blockquote>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># Example:</span>
<span class="c1"># Non-parameterized kernel.</span>
<span class="n">kernel</span> <span class="o">=</span> <span class="n">cudaq</span><span class="o">.</span><span class="n">make_kernel</span><span class="p">()</span>

<span class="c1"># Example:</span>
<span class="c1"># Parameterized kernel that accepts an `int` and `float` as arguments.</span>
<span class="n">kernel</span><span class="p">,</span> <span class="n">int_value</span><span class="p">,</span> <span class="n">float_value</span> <span class="o">=</span> <span class="n">cudaq</span><span class="o">.</span><span class="n">make_kernel</span><span class="p">(</span><span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="cudaq.PyKernel">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cudaq.</span></span><span class="sig-name descname"><span class="pre">PyKernel</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argTypeList</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cudaq.PyKernel" title="Permalink to this definition"></a></dt>
<dd><p>The <a class="reference internal" href="#cudaq.Kernel" title="cudaq.Kernel"><code class="xref py py-class docutils literal notranslate"><span class="pre">Kernel</span></code></a> provides an API for dynamically constructing quantum
circuits. The <a class="reference internal" href="#cudaq.Kernel" title="cudaq.Kernel"><code class="xref py py-class docutils literal notranslate"><span class="pre">Kernel</span></code></a> programmatically represents the circuit as an MLIR
function using the Quake dialect.</p>
<p>See <a class="reference internal" href="#cudaq.make_kernel" title="cudaq.make_kernel"><code class="xref py py-func docutils literal notranslate"><span class="pre">make_kernel()</span></code></a> for the <a class="reference internal" href="#cudaq.Kernel" title="cudaq.Kernel"><code class="xref py py-class docutils literal notranslate"><span class="pre">Kernel</span></code></a> constructor.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="cudaq.PyKernel.name">
<span class="sig-name descname"><span class="pre">name</span></span><a class="headerlink" href="#cudaq.PyKernel.name" title="Permalink to this definition"></a></dt>
Expand Down Expand Up @@ -577,6 +593,36 @@ <h2>Program Construction<a class="headerlink" href="#program-construction" title
compilation mode, where the function is lowered to an MLIR representation.</p>
<p>This decorator exposes a call overload that executes the code via the
MLIR <code class="code docutils literal notranslate"><span class="pre">ExecutionEngine</span></code> for the MLIR mode.</p>
<dl class="py method">
<dt class="sig sig-object py" id="cudaq.PyKernelDecorator.__call__">
<span class="sig-name descname"><span class="pre">__call__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cudaq.PyKernelDecorator.__call__" title="Permalink to this definition"></a></dt>
<dd><p>Invoke the CUDA Quantum kernel. JIT compilation of the
kernel AST to MLIR will occur here if it has not already occurred.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cudaq.PyKernelDecorator.__str__">
<span class="sig-name descname"><span class="pre">__str__</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cudaq.PyKernelDecorator.__str__" title="Permalink to this definition"></a></dt>
<dd><p>Return the MLIR Module string representation for this kernel.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="cudaq.PyKernelDecorator.compile">
<span class="sig-name descname"><span class="pre">compile</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cudaq.PyKernelDecorator.compile" title="Permalink to this definition"></a></dt>
<dd><p>Compile the Python function AST to MLIR. This is a no-op
if the kernel is already compiled.</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cudaq.kernel">
<span class="sig-prename descclassname"><span class="pre">cudaq.</span></span><span class="sig-name descname"><span class="pre">kernel</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">function</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cudaq.kernel" title="Permalink to this definition"></a></dt>
<dd><p>The <code class="code docutils literal notranslate"><span class="pre">cudaq.kernel</span></code> represents the CUDA Quantum language function
attribute that programmers leverage to indicate the following function
is a CUDA Quantum kernel and should be compile and executed on
an available quantum coprocessor.</p>
<p>Verbose logging can be enabled via <code class="code docutils literal notranslate"><span class="pre">verbose=True</span></code>.</p>
</dd></dl>

</section>
Expand Down Expand Up @@ -1650,7 +1696,7 @@ <h2>Data Types<a class="headerlink" href="#data-types" title="Permalink to this
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">random</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cudaq.SpinOperator.random" title="Permalink to this definition"></a></dt>
<dd><dl class="py function">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">random</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">qubit_count</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><span class="pre">int</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">term_count</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><span class="pre">int</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">seed</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><span class="pre">int</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">2665109092</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#cudaq.SpinOperator" title="cudaq.mlir._mlir_libs._quakeDialects.cudaq_runtime.SpinOperator"><span class="pre">cudaq.mlir._mlir_libs._quakeDialects.cudaq_runtime.SpinOperator</span></a></span></span></dt>
<span class="sig-name descname"><span class="pre">random</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">qubit_count</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><span class="pre">int</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">term_count</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><span class="pre">int</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">seed</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><span class="pre">int</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">1564474929</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#cudaq.SpinOperator" title="cudaq.mlir._mlir_libs._quakeDialects.cudaq_runtime.SpinOperator"><span class="pre">cudaq.mlir._mlir_libs._quakeDialects.cudaq_runtime.SpinOperator</span></a></span></span></dt>
<dd></dd></dl>

<p>Return a random <a class="reference internal" href="#cudaq.SpinOperator" title="cudaq.SpinOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">SpinOperator</span></code></a> on the given number of qubits (<code class="code docutils literal notranslate"><span class="pre">qubit_count</span></code>) and composed of the given number of terms (<code class="code docutils literal notranslate"><span class="pre">term_count</span></code>). An optional seed value may also be provided.</p>
Expand Down
1 change: 1 addition & 0 deletions pr-1435/examples/python/tutorials/cost_minimization.html
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@
<li class="toctree-l4"><a class="reference internal" href="../../../api/languages/python_api.html#cudaq.PyKernel"><code class="docutils literal notranslate"><span class="pre">PyKernel</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../api/languages/python_api.html#cudaq.Kernel"><code class="docutils literal notranslate"><span class="pre">Kernel</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../api/languages/python_api.html#cudaq.PyKernelDecorator"><code class="docutils literal notranslate"><span class="pre">PyKernelDecorator</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../api/languages/python_api.html#cudaq.kernel"><code class="docutils literal notranslate"><span class="pre">kernel()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../api/languages/python_api.html#kernel-execution">Kernel Execution</a><ul>
Expand Down
Loading

0 comments on commit ac9210c

Please sign in to comment.