Skip to content

Commit

Permalink
Docs preview for PR #816.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuda-quantum-bot committed Nov 6, 2023
1 parent 33957e3 commit 38284a9
Show file tree
Hide file tree
Showing 74 changed files with 991 additions and 110 deletions.
9 changes: 9 additions & 0 deletions pr-816/_sources/api/languages/python_api.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Kernel Execution
.. autofunction:: cudaq::sample_async
.. autofunction:: cudaq::observe
.. autofunction:: cudaq::observe_async
.. autofunction:: cudaq::get_state
.. autofunction:: cudaq::get_state_async
.. autofunction:: cudaq::vqe

Backend Configuration
Expand All @@ -73,9 +75,13 @@ Backend Configuration

Data Types
=============================

.. autoclass:: cudaq::Target
:members:

.. autoclass:: cudaq::State
:members:

.. autoclass:: cudaq::QuakeValue

.. automethod:: __add__
Expand Down Expand Up @@ -125,6 +131,9 @@ Data Types
.. autoclass:: cudaq::AsyncObserveResult
:members:

.. autoclass:: cudaq::AsyncStateResult
:members:

.. autoclass:: cudaq::OptimizationResult
:members:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,17 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 32,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<H> = 0.0\n"
]
}
],
"source": [
"import cudaq\n",
"from cudaq import spin\n",
Expand All @@ -96,7 +104,10 @@
"# Define a Hamiltonian in terms of Pauli Spin operators.\n",
"hamiltonian = spin.z(0) + spin.y(1) + spin.x(0) * spin.z(0)\n",
"\n",
"result = cudaq.observe(kernel, hamiltonian)"
"# Compute the expectation value given the state prepared by the kernel.\n",
"result = cudaq.observe(kernel, hamiltonian).expectation()\n",
"\n",
"print('<H> =', result)"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"source": [
"### Available Targets\n",
"\n",
"- **default**: The default qpp based CPU backend which is multithreaded to maximise the usage of available cores on your system.\n",
"- **qpp-cpu**: The qpp based CPU backend which is multithreaded to maximize the usage of available cores on your system.\n",
"\n",
"- **nvidia**: GPU based backend which accelerates quantum circuit simulation on NVIDIA GPUs powered by cuQuantum.\n",
"\n",
Expand Down Expand Up @@ -76,7 +76,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Default CPU Backend"
"### QPP-based CPU Backend"
]
},
{
Expand All @@ -93,7 +93,7 @@
}
],
"source": [
"cpu_result = ghz_state(n_qubits=2, target=\"default\")\n",
"cpu_result = ghz_state(n_qubits=2, target=\"qpp-cpu\")\n",
"\n",
"cpu_result.dump()"
]
Expand Down
31 changes: 31 additions & 0 deletions pr-816/_sources/using/cpp.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,37 @@ vector support, we pass the :code:`--target nvidia` flag at compile time:
nvq++ --target nvidia cuquantum_backends.cpp -o ghz.x
./ghz.x
Noisy Simulation
-----------------

CUDA Quantum makes it simple to model noise within the simulation of your quantum program.
Let's take a look at the various built-in noise models we support, before concluding with a brief example of a custom noise model constructed from user-defined Kraus Operators.

The following code illustrates how to run a simulation with depolarization noise.

.. literalinclude:: ../examples/cpp/basics/noise_depolarization.cpp
:language: cpp

The following code illustrates how to run a simulation with amplitude damping noise.

.. literalinclude:: ../examples/cpp/basics/noise_amplitude_damping.cpp
:language: cpp

The following code illustrates how to run a simulation with bit-flip noise.

.. literalinclude:: ../examples/cpp/basics/noise_bit_flip.cpp
:language: cpp

The following code illustrates how to run a simulation with phase-flip noise.

.. literalinclude:: ../examples/cpp/basics/noise_phase_flip.cpp
:language: cpp

The following code illustrates how to run a simulation with a custom noise model.

.. literalinclude:: ../examples/cpp/basics/noise_modeling.cpp
:language: cpp

.. _cpp-examples-for-hardware-providers:

Using Quantum Hardware Providers
Expand Down
9 changes: 8 additions & 1 deletion pr-816/_sources/using/hardware.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ To see a complete example for using IQM server backends, take a look at our :ref
OQC
==================================

OQC is currently providing cuda quantum integration for our 8 qubit ring topology Lucy device.
`Oxford Quantum Circuits <https://oxfordquantumcircuits.com/>`__ (OQC) is currently providing cuda quantum integration for our 8 qubit ring topology Lucy device.

Setting Credentials
`````````````````````````
Expand Down Expand Up @@ -346,6 +346,13 @@ To run the output, provide the runtime loaded variables and invoke the pre-built
OQC_PASSWORD=$password ./executable
To emulate the OQC device locally, without submitting through the OQC QCaaS services, you can pass the ``--emulate`` flag to ``nvq++``.
This will emit any target specific compiler warnings and diagnostics, before running a noise free emulation.

.. code:: bash
nvq++ --emulate --target oqc src.cpp -o executable
.. note::

Expand Down
7 changes: 6 additions & 1 deletion pr-816/api/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
<li class="toctree-l3"><a class="reference internal" href="../using/cpp.html#computing-expectation-values">Computing Expectation Values</a></li>
<li class="toctree-l3"><a class="reference internal" href="../using/cpp.html#multi-control-synthesis">Multi-control Synthesis</a></li>
<li class="toctree-l3"><a class="reference internal" href="../using/cpp.html#simulations-with-cuquantum">Simulations with cuQuantum</a></li>
<li class="toctree-l3"><a class="reference internal" href="../using/cpp.html#noisy-simulation">Noisy Simulation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../using/cpp.html#using-quantum-hardware-providers">Using Quantum Hardware Providers</a></li>
</ul>
</li>
Expand All @@ -175,7 +176,7 @@
<li class="toctree-l2"><a class="reference internal" href="../examples/python/tutorials/hybrid_qnns.html">Hybrid Quantum Neural Networks</a></li>
<li class="toctree-l2"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html">Multi-GPU Workflows</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html#Available-Targets">Available Targets</a></li>
<li class="toctree-l3"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html#Default-CPU-Backend">Default CPU Backend</a></li>
<li class="toctree-l3"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html#QPP-based-CPU-Backend">QPP-based CPU Backend</a></li>
<li class="toctree-l3"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html#Acceleration-via-NVIDIA-GPUs">Acceleration via NVIDIA GPUs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html#Multiple-NVIDIA-GPUs">Multiple NVIDIA GPUs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html#Multiple-QPU's">Multiple QPU’s</a></li>
Expand Down Expand Up @@ -300,6 +301,8 @@
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.sample_async"><code class="docutils literal notranslate"><span class="pre">sample_async()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.observe"><code class="docutils literal notranslate"><span class="pre">observe()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.observe_async"><code class="docutils literal notranslate"><span class="pre">observe_async()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.get_state"><code class="docutils literal notranslate"><span class="pre">get_state()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.get_state_async"><code class="docutils literal notranslate"><span class="pre">get_state_async()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.vqe"><code class="docutils literal notranslate"><span class="pre">vqe()</span></code></a></li>
</ul>
</li>
Expand All @@ -318,6 +321,7 @@
</li>
<li class="toctree-l3"><a class="reference internal" href="languages/python_api.html#data-types">Data Types</a><ul>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.Target"><code class="docutils literal notranslate"><span class="pre">Target</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.State"><code class="docutils literal notranslate"><span class="pre">State</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.QuakeValue"><code class="docutils literal notranslate"><span class="pre">QuakeValue</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.qubit"><code class="docutils literal notranslate"><span class="pre">qubit</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.qreg"><code class="docutils literal notranslate"><span class="pre">qreg</span></code></a></li>
Expand All @@ -331,6 +335,7 @@
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.AsyncSampleResult"><code class="docutils literal notranslate"><span class="pre">AsyncSampleResult</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.ObserveResult"><code class="docutils literal notranslate"><span class="pre">ObserveResult</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.AsyncObserveResult"><code class="docutils literal notranslate"><span class="pre">AsyncObserveResult</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.AsyncStateResult"><code class="docutils literal notranslate"><span class="pre">AsyncStateResult</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.OptimizationResult"><code class="docutils literal notranslate"><span class="pre">OptimizationResult</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#optimizers">Optimizers</a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#gradients">Gradients</a></li>
Expand Down
7 changes: 6 additions & 1 deletion pr-816/api/default_ops.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
<li class="toctree-l3"><a class="reference internal" href="../using/cpp.html#computing-expectation-values">Computing Expectation Values</a></li>
<li class="toctree-l3"><a class="reference internal" href="../using/cpp.html#multi-control-synthesis">Multi-control Synthesis</a></li>
<li class="toctree-l3"><a class="reference internal" href="../using/cpp.html#simulations-with-cuquantum">Simulations with cuQuantum</a></li>
<li class="toctree-l3"><a class="reference internal" href="../using/cpp.html#noisy-simulation">Noisy Simulation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../using/cpp.html#using-quantum-hardware-providers">Using Quantum Hardware Providers</a></li>
</ul>
</li>
Expand All @@ -175,7 +176,7 @@
<li class="toctree-l2"><a class="reference internal" href="../examples/python/tutorials/hybrid_qnns.html">Hybrid Quantum Neural Networks</a></li>
<li class="toctree-l2"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html">Multi-GPU Workflows</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html#Available-Targets">Available Targets</a></li>
<li class="toctree-l3"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html#Default-CPU-Backend">Default CPU Backend</a></li>
<li class="toctree-l3"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html#QPP-based-CPU-Backend">QPP-based CPU Backend</a></li>
<li class="toctree-l3"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html#Acceleration-via-NVIDIA-GPUs">Acceleration via NVIDIA GPUs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html#Multiple-NVIDIA-GPUs">Multiple NVIDIA GPUs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../examples/python/tutorials/multi_gpu_workflows.html#Multiple-QPU's">Multiple QPU’s</a></li>
Expand Down Expand Up @@ -300,6 +301,8 @@
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.sample_async"><code class="docutils literal notranslate"><span class="pre">sample_async()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.observe"><code class="docutils literal notranslate"><span class="pre">observe()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.observe_async"><code class="docutils literal notranslate"><span class="pre">observe_async()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.get_state"><code class="docutils literal notranslate"><span class="pre">get_state()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.get_state_async"><code class="docutils literal notranslate"><span class="pre">get_state_async()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.vqe"><code class="docutils literal notranslate"><span class="pre">vqe()</span></code></a></li>
</ul>
</li>
Expand All @@ -318,6 +321,7 @@
</li>
<li class="toctree-l3"><a class="reference internal" href="languages/python_api.html#data-types">Data Types</a><ul>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.Target"><code class="docutils literal notranslate"><span class="pre">Target</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.State"><code class="docutils literal notranslate"><span class="pre">State</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.QuakeValue"><code class="docutils literal notranslate"><span class="pre">QuakeValue</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.qubit"><code class="docutils literal notranslate"><span class="pre">qubit</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.qreg"><code class="docutils literal notranslate"><span class="pre">qreg</span></code></a></li>
Expand All @@ -331,6 +335,7 @@
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.AsyncSampleResult"><code class="docutils literal notranslate"><span class="pre">AsyncSampleResult</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.ObserveResult"><code class="docutils literal notranslate"><span class="pre">ObserveResult</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.AsyncObserveResult"><code class="docutils literal notranslate"><span class="pre">AsyncObserveResult</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.AsyncStateResult"><code class="docutils literal notranslate"><span class="pre">AsyncStateResult</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.OptimizationResult"><code class="docutils literal notranslate"><span class="pre">OptimizationResult</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#optimizers">Optimizers</a></li>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#gradients">Gradients</a></li>
Expand Down
Loading

0 comments on commit 38284a9

Please sign in to comment.