Skip to content

Commit

Permalink
Docs preview for PR #2423.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuda-quantum-bot committed Dec 10, 2024
1 parent d9f1e6a commit 8f7b4d8
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions pr-2423/api/languages/cpp_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,12 @@ <h2>Common<a class="headerlink" href="#common" title="Permalink to this heading"
<dd><p>A buffer containing the return value of a kernel invocation. Note: this is only needed for invocation not able to return a <code class="docutils literal notranslate"><a class="reference internal" href="#classcudaq_1_1sample__result"><span class="std std-ref"><span class="pre">sample_result</span></span></a></code>. </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N5cudaq16ExecutionContext18numberTrajectoriesE">
<span class="target" id="classcudaq_1_1ExecutionContext_1a1d8a8a13f8765a8fce850e1a124a5fbb"></span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">optional</span></span><span class="p"><span class="pre">&lt;</span></span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">size_t</span></span><span class="p"><span class="pre">&gt;</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">numberTrajectories</span></span></span><a class="headerlink" href="#_CPPv4N5cudaq16ExecutionContext18numberTrajectoriesE" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>The number of trajectories to be used for an expectation calculation on simulation backends that support trajectory simulation. </p>
</dd></dl>

</div>
</dd></dl>

Expand Down
4 changes: 2 additions & 2 deletions pr-2423/applications/python/deutschs_algorithm.html
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ <h2>XOR <span class="math notranslate nohighlight">\(\oplus\)</span><a class="he
</section>
<section id="Quantum-oracles">
<h2>Quantum oracles<a class="headerlink" href="#Quantum-oracles" title="Permalink to this heading"></a></h2>
<p><img alt="475b2af68ed04dbe9c677802d00b1115" class="no-scaled-link" src="../../_images/oracle.png" style="width: 300px; height: 150px;" /></p>
<p><img alt="5965f0695b2e487a85d2bdce71e9d1fc" class="no-scaled-link" src="../../_images/oracle.png" style="width: 300px; height: 150px;" /></p>
<p>Suppose we have <span class="math notranslate nohighlight">\(f(x): \{0,1\} \longrightarrow \{0,1\}\)</span>. We can compute this function on a quantum computer using oracles which we treat as black box functions that yield the output with an appropriate sequence of logic gates.</p>
<p>Above you see an oracle represented as <span class="math notranslate nohighlight">\(U_f\)</span> which allows us to transform the state <span class="math notranslate nohighlight">\(\ket{x}\ket{y}\)</span> into:</p>
<div class="math notranslate nohighlight">
Expand Down Expand Up @@ -837,7 +837,7 @@ <h2>Quantum parallelism<a class="headerlink" href="#Quantum-parallelism" title="
<h2>Deutschs’ Algorithm:<a class="headerlink" href="#Deutschs'-Algorithm:" title="Permalink to this heading"></a></h2>
<p>Our aim is to find out if <span class="math notranslate nohighlight">\(f: \{0,1\} \longrightarrow \{0,1\}\)</span> is a constant or a balanced function? If constant, <span class="math notranslate nohighlight">\(f(0) = f(1)\)</span>, and if balanced, <span class="math notranslate nohighlight">\(f(0) \neq f(1)\)</span>.</p>
<p>We step through the circuit diagram below and follow the math after the application of each gate.</p>
<p><img alt="83e12cd0a55b415bbd0806d8d0b37de7" class="no-scaled-link" src="../../_images/deutsch.png" style="width: 500px; height: 210px;" /></p>
<p><img alt="2fdb4a4593584eff9665b0d58ac944ce" class="no-scaled-link" src="../../_images/deutsch.png" style="width: 500px; height: 210px;" /></p>
<div class="math notranslate nohighlight">
\[\ket{\psi_0} = \ket{01}
\tag{1}\]</div>
Expand Down
4 changes: 2 additions & 2 deletions pr-2423/examples/python/performance_optimizations.html
Original file line number Diff line number Diff line change
Expand Up @@ -716,9 +716,9 @@ <h1>Optimizing Performance<a class="headerlink" href="#Optimizing-Performance" t
<section id="Gate-Fusion">
<h2>Gate Fusion<a class="headerlink" href="#Gate-Fusion" title="Permalink to this heading"></a></h2>
<p>Gate fusion is an optimization technique where consecutive gates are combined into a single gate operation to improve the efficiency of the simulation (See figure below). By targeting the <code class="docutils literal notranslate"><span class="pre">nvidia-mgpu</span></code> backend and setting the <code class="docutils literal notranslate"><span class="pre">CUDAQ_MGPU_FUSE</span></code> environment variable, you can select the degree of fusion that takes place. A full command line example would look like <code class="docutils literal notranslate"><span class="pre">CUDAQ_MGPU_FUSE=4</span> <span class="pre">python</span> <span class="pre">c2h2VQE.py</span> <span class="pre">--target</span> <span class="pre">nvidia</span> <span class="pre">--target-option</span> <span class="pre">fp64,mgpu</span></code></p>
<p><img alt="1189d20206a6437b8d124bf004ad5feb" src="../../_images/gate-fuse1.png" /></p>
<p><img alt="a15271f5418a4a36bf7e86211674b08e" src="../../_images/gate-fuse1.png" /></p>
<p>The importance of gate fusion is system dependent, but can have a large influence on the performance of the simulation. See the example below for a 24 qubit VQE experiment where changing the fusion level resulted in significant performance boosts.</p>
<p><img alt="1ab345c3ca4e46c3bb90503e67d71c49" src="../../_images/gatefusion.png" /></p>
<p><img alt="70e2e3ad9a3e4115abc21d974deb7a38" src="../../_images/gatefusion.png" /></p>
</section>
</section>

Expand Down
2 changes: 2 additions & 0 deletions pr-2423/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,8 @@ <h2 id="C">C</h2>
<li><a href="api/languages/cpp_api.html#_CPPv4N5cudaq16ExecutionContext4nameE">cudaq::ExecutionContext::name (C++ member)</a>
</li>
<li><a href="api/languages/cpp_api.html#_CPPv4N5cudaq16ExecutionContext10noiseModelE">cudaq::ExecutionContext::noiseModel (C++ member)</a>
</li>
<li><a href="api/languages/cpp_api.html#_CPPv4N5cudaq16ExecutionContext18numberTrajectoriesE">cudaq::ExecutionContext::numberTrajectories (C++ member)</a>
</li>
<li><a href="api/languages/cpp_api.html#_CPPv4N5cudaq16ExecutionContext9optResultE">cudaq::ExecutionContext::optResult (C++ member)</a>
</li>
Expand Down
Binary file modified pr-2423/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion pr-2423/searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pr-2423/sphinx/applications/cpp/bernstein_vazirani.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ std::vector<bool> random_bits(int seed) {

template <int nrOfBits>
struct oracle {
auto operator()(std::vector<bool> bitvector, cudaq::qview<> qs,
auto operator()(std::vector<bool> &bitvector, cudaq::qview<> qs,
cudaq::qubit &aux) __qpu__ {

for (size_t i = 0; i < nrOfBits; i++) {
Expand Down

0 comments on commit 8f7b4d8

Please sign in to comment.