Skip to content

Commit

Permalink
Added python/c++ tabs and Efrat's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mawolf2023 committed Dec 17, 2024
1 parent a6efc5d commit 818e8ea
Show file tree
Hide file tree
Showing 12 changed files with 459 additions and 473 deletions.
Binary file modified docs/sphinx/using/backends/circuitsimulators.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions docs/sphinx/using/backends/cloud.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CUDA-Q Cloud Backends
***************************************
CUDA-Q provides a number of options to access hardware resources (GPUs and QPUs) through the cloud. Such options provide users with more flexible access to simulation and hardware resources. See the links below for more information on running CUDA-Q with cloud resources.


.. toctree::
:maxdepth: 1

Amazon Braket (braket) <cloud/braket.rst>
NVIDIA Quantum Cloud (nvqc) <cloud/nvqc.rst>







204 changes: 97 additions & 107 deletions docs/sphinx/using/backends/hardware/iontrap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,95 +18,83 @@ it as an environment variable:
export IONQ_API_KEY="ionq_generated_api_key"
Submission from C++
Submitting
`````````````````````````
.. tab:: Python

To target quantum kernel code for execution in the IonQ Cloud,
pass the flag ``--target ionq`` to the ``nvq++`` compiler.
First, set the :code:`ionq` backend.

.. code:: bash
.. code:: python
nvq++ --target ionq src.cpp
cudaq.set_target('ionq')
This will take the API key and handle all authentication with, and submission to,
the IonQ QPU(s). By default, quantum kernel code will be submitted to the IonQ
simulator.
By default, quantum kernel code will be submitted to the IonQ simulator.

.. note::
.. note::

A "target" in :code:`cudaq` refers to a quantum compute provider, such as :code:`ionq`.
However, IonQ's documentation uses the term "target" to refer to specific QPU's themselves.
A "target" in :code:`cudaq` refers to a quantum compute provider, such as :code:`ionq`.
However, IonQ's documentation uses the term "target" to refer to specific QPU's themselves.

To execute your kernels on a QPU, pass the ``--ionq-machine`` flag to the ``nvq++`` compiler
to specify which machine to submit quantum kernels to:
To specify which IonQ QPU to use, set the :code:`qpu` parameter.

.. code:: bash
.. code:: python
nvq++ --target ionq --ionq-machine qpu.aria-1 src.cpp ...
cudaq.set_target("ionq", qpu="qpu.aria-1")
where ``qpu.aria-1`` is an example of a physical QPU.
where ``qpu.aria-1`` is an example of a physical QPU.

A list of available QPUs can be found `in the API documentation
<https://docs.ionq.com/#tag/jobs>`__. To see which backends are available
with your subscription login to your `IonQ account <https://cloud.ionq.com/jobs>`__.
A list of available QPUs can be found `in the API documentation <https://docs.ionq.com/#tag/jobs>`__. To see which backends are available with your subscription login to your `IonQ account <https://cloud.ionq.com/jobs>`__.

To emulate the IonQ machine locally, without submitting through the cloud,
you can also pass the ``--emulate`` flag to ``nvq++``. This will emit any target
specific compiler diagnostics, before running a noise free emulation.
To emulate the IonQ machine locally, without submitting through the cloud, you can also set the ``emulate`` flag to ``True``. This will emit any target specific compiler diagnostics, before running a noise free emulation.

.. code:: bash
.. code:: python
nvq++ --emulate --target ionq src.cpp
cudaq.set_target('ionq', emulate=True)
To see a complete example for using IonQ's backends, take a look at our :doc:`C++ examples <../examples/examples>`.
The number of shots for a kernel execution can be set through the ``shots_count`` argument to ``cudaq.sample`` or ``cudaq.observe``. By default, the ``shots_count`` is set to 1000.

Submission from Python
`````````````````````````
.. code:: python
cudaq.sample(kernel, shots_count=10000)
The target to which quantum kernels are submitted
can be controlled with the ``cudaq::set_target()`` function.
To see a complete example for using IonQ's backends, take a look at our :doc:`Python examples <../../examples/examples>`.

.. code:: python

cudaq.set_target('ionq')
.. tab:: C++

By default, quantum kernel code will be submitted to the IonQ
simulator.
To target quantum kernel code for execution in the IonQ Cloud,
pass the flag ``--target ionq`` to the ``nvq++`` compiler.

.. note::
.. code:: bash
A "target" in :code:`cudaq` refers to a quantum compute provider, such as :code:`ionq`.
However, IonQ's documentation uses the term "target" to refer to specific QPU's themselves.
nvq++ --target ionq src.cpp

To specify which IonQ QPU to use, set the :code:`qpu` parameter.
This will take the API key and handle all authentication with, and submission to, the IonQ QPU(s). By default, quantum kernel code will be submitted to the IonQsimulator.

.. code:: python
.. note::

cudaq.set_target("ionq", qpu="qpu.aria-1")
A "target" in :code:`cudaq` refers to a quantum compute provider, such as :code:`ionq`.
However, IonQ's documentation uses the term "target" to refer to specific QPU's themselves.

where ``qpu.aria-1`` is an example of a physical QPU.
To execute your kernels on a QPU, pass the ``--ionq-machine`` flag to the ``nvq++`` compiler to specify which machine to submit quantum kernels to:

A list of available QPUs can be found `in the API documentation
<https://docs.ionq.com/#tag/jobs>`__. To see which backends are available
with your subscription login to your `IonQ account <https://cloud.ionq.com/jobs>`__.
.. code:: bash
To emulate the IonQ machine locally, without submitting through the cloud,
you can also set the ``emulate`` flag to ``True``. This will emit any target
specific compiler diagnostics, before running a noise free emulation.
nvq++ --target ionq --ionq-machine qpu.aria-1 src.cpp ...
.. code:: python
where ``qpu.aria-1`` is an example of a physical QPU.

cudaq.set_target('ionq', emulate=True)
A list of available QPUs can be found `in the API documentation <https://docs.ionq.com/#tag/jobs>`__. To see which backends are available with your subscription login to your `IonQ account <https://cloud.ionq.com/jobs>`__.

The number of shots for a kernel execution can be set through
the ``shots_count`` argument to ``cudaq.sample`` or ``cudaq.observe``. By default,
the ``shots_count`` is set to 1000.
To emulate the IonQ machine locally, without submitting through the cloud, you can also pass the ``--emulate`` flag to ``nvq++``. This will emit any target specific compiler diagnostics, before running a noise free emulation.

.. code:: python
.. code:: bash
cudaq.sample(kernel, shots_count=10000)
nvq++ --emulate --target ionq src.cpp
To see a complete example for using IonQ's backends, take a look at our :doc:`Python examples <../examples/examples>`.
To see a complete example for using IonQ's backends, take a look at our :doc:`C++ examples <../../examples/examples>`.


Quantinuum
+++++++++++
Expand Down Expand Up @@ -140,87 +128,89 @@ The path to the configuration can be specified as an environment variable:
export CUDAQ_QUANTINUUM_CREDENTIALS=$HOME/.quantinuum_config
Submission from C++
Submitting
`````````````````````````
.. tab:: Python

To target quantum kernel code for execution in the Quantinuum backends,
pass the flag ``--target quantinuum`` to the ``nvq++`` compiler. CUDA-Q will
authenticate via the Quantinuum REST API using the credential in your configuration file.
By default, quantum kernel code will be submitted to the Quantinuum syntax checker.
Submission to the syntax checker merely validates the program; the kernels are not executed.

The backend to which quantum kernels are submitted
can be controlled with the ``cudaq::set_target()`` function.

.. code:: bash
.. code:: python
nvq++ --target quantinuum src.cpp ...
cudaq.set_target('quantinuum')
To execute your kernels, pass the ``--quantinuum-machine`` flag to the ``nvq++`` compiler
to specify which machine to submit quantum kernels to:
By default, quantum kernel code will be submitted to the Quantinuum syntax checker.
Submission to the syntax checker merely validates the program; the kernels are not executed.

.. code:: bash
To execute your kernels, specify which machine to submit quantum kernels to
by setting the :code:`machine` parameter of the target.

nvq++ --target quantinuum --quantinuum-machine H1-2 src.cpp ...
.. code:: python
where ``H1-2`` is an example of a physical QPU. Hardware specific
emulators may be accessed by appending an ``E`` to the end (e.g, ``H1-2E``). For
access to the syntax checker for the provided machine, you may append an ``SC``
to the end (e.g, ``H1-1SC``).
cudaq.set_target('quantinuum', machine='H1-2')
For a comprehensive list of available machines, login to your `Quantinuum user account <https://um.qapi.quantinuum.com/user>`__
and navigate to the "Account" tab, where you should find a table titled "Machines".
where ``H1-2`` is an example of a physical QPU. Hardware specific
emulators may be accessed by appending an ``E`` to the end (e.g, ``H1-2E``). For
access to the syntax checker for the provided machine, you may append an ``SC``
to the end (e.g, ``H1-1SC``).

To emulate the Quantinuum machine locally, without submitting through the cloud,
you can also pass the ``--emulate`` flag to ``nvq++``. This will emit any target
specific compiler warnings and diagnostics, before running a noise free emulation.
For a comprehensive list of available machines, login to your `Quantinuum user account <https://um.qapi.quantinuum.com/user>`__
and navigate to the "Account" tab, where you should find a table titled "Machines".

.. code:: bash
To emulate the Quantinuum machine locally, without submitting through the cloud,
you can also set the ``emulate`` flag to ``True``. This will emit any target
specific compiler warnings and diagnostics, before running a noise free emulation.

nvq++ --emulate --target quantinuum src.cpp
.. code:: python
To see a complete example for using Quantinuum's backends, take a look at our :doc:`C++ examples <../examples/examples>`.
cudaq.set_target('quantinuum', emulate=True)
The number of shots for a kernel execution can be set through
the ``shots_count`` argument to ``cudaq.sample`` or ``cudaq.observe``. By default,
the ``shots_count`` is set to 1000.

Submission from Python
`````````````````````````
.. code:: python
cudaq.sample(kernel, shots_count=10000)
The target to which quantum kernels are submitted
can be controlled with the ``cudaq::set_target()`` function.
To see a complete example for using Quantinuum's backends, take a look at our :doc:`Python examples <../../examples/examples>`.

.. code:: python

cudaq.set_target('quantinuum')
.. tab:: C++

By default, quantum kernel code will be submitted to the Quantinuum syntax checker.
Submission to the syntax checker merely validates the program; the kernels are not executed.
To target quantum kernel code for execution in the Quantinuum backends,
pass the flag ``--target quantinuum`` to the ``nvq++`` compiler. CUDA-Q will
authenticate via the Quantinuum REST API using the credential in your configuration file.
By default, quantum kernel code will be submitted to the Quantinuum syntax checker.
Submission to the syntax checker merely validates the program; the kernels are not executed.

To execute your kernels, specify which machine to submit quantum kernels to
by setting the :code:`machine` parameter of the target.
.. code:: bash
.. code:: python
nvq++ --target quantinuum src.cpp ...
cudaq.set_target('quantinuum', machine='H1-2')
To execute your kernels, pass the ``--quantinuum-machine`` flag to the ``nvq++`` compiler
to specify which machine to submit quantum kernels to:

where ``H1-2`` is an example of a physical QPU. Hardware specific
emulators may be accessed by appending an ``E`` to the end (e.g, ``H1-2E``). For
access to the syntax checker for the provided machine, you may append an ``SC``
to the end (e.g, ``H1-1SC``).
.. code:: bash
For a comprehensive list of available machines, login to your `Quantinuum user account <https://um.qapi.quantinuum.com/user>`__
and navigate to the "Account" tab, where you should find a table titled "Machines".
nvq++ --target quantinuum --quantinuum-machine H1-2 src.cpp ...
To emulate the Quantinuum machine locally, without submitting through the cloud,
you can also set the ``emulate`` flag to ``True``. This will emit any target
specific compiler warnings and diagnostics, before running a noise free emulation.
where ``H1-2`` is an example of a physical QPU. Hardware specific
emulators may be accessed by appending an ``E`` to the end (e.g, ``H1-2E``). For
access to the syntax checker for the provided machine, you may append an ``SC``
to the end (e.g, ``H1-1SC``).

.. code:: python
For a comprehensive list of available machines, login to your `Quantinuum user account <https://um.qapi.quantinuum.com/user>`__
and navigate to the "Account" tab, where you should find a table titled "Machines".

cudaq.set_target('quantinuum', emulate=True)
To emulate the Quantinuum machine locally, without submitting through the cloud,
you can also pass the ``--emulate`` flag to ``nvq++``. This will emit any target
specific compiler warnings and diagnostics, before running a noise free emulation.

The number of shots for a kernel execution can be set through
the ``shots_count`` argument to ``cudaq.sample`` or ``cudaq.observe``. By default,
the ``shots_count`` is set to 1000.
.. code:: bash
.. code:: python
nvq++ --emulate --target quantinuum src.cpp
cudaq.sample(kernel, shots_count=10000)
To see a complete example for using Quantinuum's backends, take a look at our :doc:`C++ examples <../../examples/examples>`.

To see a complete example for using Quantinuum's backends, take a look at our :doc:`Python examples <../examples/examples>`.
Loading

0 comments on commit 818e8ea

Please sign in to comment.