-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Getting Started page #1780
Merged
Merged
Add Getting Started page #1780
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1c04423
Add Get Started page
hitomitak 53495f1
Merge branch 'main' into get_started
hitomitak 5f14ba6
Merge branch 'main' into get_started
hhorii 7ddc1b4
Merge branch 'main' into get_started
hhorii 4ab7739
Resolve confilict
hitomitak 8ae3da6
Remove unused class
hitomitak bafb0b3
Merge branch 'main' into get_started
hhorii 99a424a
Merge branch 'main' into get_started
hitomitak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,4 @@ Qiskit Aer API Reference | |
aer_pulse | ||
aer_utils | ||
aer_quantum_info | ||
circuit | ||
parallel | ||
circuit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from docutils.parsers.rst import Directive, directives | ||
from docutils.statemachine import StringList | ||
from docutils import nodes | ||
|
||
try: | ||
FileNotFoundError | ||
except NameError: | ||
FileNotFoundError = IOError | ||
|
||
|
||
class CustomCalloutItemDirective(Directive): | ||
option_spec = { | ||
"header": directives.unchanged, | ||
"description": directives.unchanged, | ||
"button_link": directives.unchanged, | ||
"button_text": directives.unchanged, | ||
} | ||
|
||
def run(self): | ||
try: | ||
if "description" in self.options: | ||
description = self.options["description"] | ||
else: | ||
description = "" | ||
|
||
if "header" in self.options: | ||
header = self.options["header"] | ||
else: | ||
raise ValueError("header not doc found") | ||
|
||
if "button_link" in self.options: | ||
button_link = self.options["button_link"] | ||
else: | ||
button_link = "" | ||
|
||
if "button_text" in self.options: | ||
button_text = self.options["button_text"] | ||
else: | ||
button_text = "" | ||
|
||
except FileNotFoundError as e: | ||
print(e) | ||
return [] | ||
except ValueError as e: | ||
print(e) | ||
raise | ||
return [] | ||
|
||
callout_rst = CALLOUT_TEMPLATE.format( | ||
description=description, header=header, button_link=button_link, button_text=button_text | ||
) | ||
callout_list = StringList(callout_rst.split("\n")) | ||
callout = nodes.paragraph() | ||
self.state.nested_parse(callout_list, self.content_offset, callout) | ||
return [callout] | ||
|
||
|
||
CALLOUT_TEMPLATE = """ | ||
.. raw:: html | ||
|
||
<div class="col-md-6"> | ||
<div class="text-container"> | ||
<h3>{header}</h3> | ||
<p class="body-paragraph">{description}</p> | ||
<a class="btn with-right-arrow callout-button" href="{button_link}">{button_text}</a> | ||
</div> | ||
</div> | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
:orphan: | ||
|
||
############### | ||
Getting started | ||
############### | ||
|
||
Installation | ||
============ | ||
Qiskit Aer depends on the main Qiskit package which has its own | ||
`Qiskit Getting Started <https://qiskit.org/documentation/getting_started.html>`__ detailing the | ||
installation options for Qiskit and its supported environments/platforms. You should refer to | ||
that first. Then the information here can be followed which focuses on the additional installation | ||
specific to Qiskit Aer. | ||
|
||
|
||
.. tab-set:: | ||
|
||
.. tab-item:: Start locally | ||
|
||
The simplest way to get started is to follow the getting started 'Start locally' for Qiskit | ||
here `Qiskit Getting Started <https://qiskit.org/documentation/getting_started.html>`__ | ||
|
||
In your virtual environment where you installed Qiskit simply add ``aer`` to the | ||
extra list in a similar manner to how the extra ``visualization`` support is installed for | ||
Qiskit, i.e: | ||
|
||
.. code:: sh | ||
|
||
pip install qiskit-aer | ||
|
||
**Installing GPU support** | ||
|
||
In order to install and run the GPU supported simulators on Linux, you need CUDA® 10.1 or newer | ||
previously installed. CUDA® itself would require a set of specific GPU drivers. | ||
Please follow CUDA® installation procedure in the NVIDIA® `web <https://www.nvidia.com/drivers>`_. | ||
|
||
If you want to install our GPU supported simulators, you have to install this other package: | ||
|
||
.. code:: sh | ||
|
||
pip install qiskit-aer-gpu | ||
|
||
This will overwrite your current qiskit-aer package installation giving you the same functionality found | ||
in the canonical qiskit-aer package, plus the ability to run the GPU supported | ||
simulators: statevector, density matrix, and unitary. | ||
|
||
*Note: This package is only available on x86_64 Linux. | ||
For other platforms that have CUDA support you will have to build from source.* | ||
|
||
|
||
.. tab-item:: Install from source | ||
|
||
|
||
Installing Qiskit Aer from source allows you to access the most recently | ||
updated version under development instead of using the version in the Python Package | ||
Index (PyPI) repository. This will give you the ability to inspect and extend | ||
the latest version of the Qiskit Aer code more efficiently. | ||
|
||
Since Qiskit Aer depends on Qiskit, and its latest changes may require new or changed | ||
features of Qiskit, you should first follow Qiskit's `"Install from source"` instructions | ||
here `Qiskit Getting Started <https://qiskit.org/documentation/getting_started.html>`__ | ||
|
||
.. raw:: html | ||
|
||
<h2>Installing Qiskit Aer from Source</h2> | ||
|
||
|
||
Clone the ``Qiskit Aer`` repo via *git*. | ||
|
||
.. code:: sh | ||
|
||
git clone https://github.com/Qiskit/qiskit-aer | ||
|
||
The common dependencies can then be installed via *pip*, using the ``requirements-dev.txt`` file, e.g.: | ||
|
||
.. code:: sh | ||
|
||
cd qiskit-aer | ||
pip install -r requirements-dev.txt | ||
|
||
As any other Python package, we can install from source code by just running: | ||
|
||
.. code:: sh | ||
|
||
qiskit-aer$ pip install . | ||
|
||
This will build and install ``Aer`` with the default options which is | ||
probably suitable for most of the users. There’s another Pythonic | ||
approach to build and install software: build the wheels distributable | ||
file. | ||
|
||
.. code:: sh | ||
|
||
qiskit-aer$ pip install build | ||
qiskit-aer$ python -I -m build --wheel | ||
|
||
|
||
See `here <https://github.com/Qiskit/qiskit-aer/blob/main/CONTRIBUTING.md#install-from-source>`__ | ||
for detailed installation information. | ||
|
||
.. raw:: html | ||
|
||
<h2>Building with GPU support</h2> | ||
|
||
Qiskit Aer can exploit GPU’s horsepower to accelerate some simulations, | ||
specially the larger ones. GPU access is supported via CUDA® (NVIDIA® | ||
chipset), so to build with GPU support, you need to have CUDA® >= 10.1 | ||
preinstalled. See install instructions | ||
`here <https://developer.nvidia.com/cuda-toolkit-archive>`__ Please note | ||
that we only support GPU acceleration on Linux platforms at the moment. | ||
|
||
Once CUDA® is properly installed, you only need to set a flag so the | ||
build system knows what to do: | ||
|
||
.. code:: sh | ||
|
||
AER_THRUST_BACKEND=CUDA | ||
|
||
For example, | ||
|
||
.. code:: sh | ||
|
||
qiskit-aer$ python ./setup.py bdist_wheel -- -DAER_THRUST_BACKEND=CUDA | ||
|
||
See `here <https://github.com/Qiskit/qiskit-aer/blob/main/CONTRIBUTING.md>`__ | ||
for detailed GPU support information. | ||
|
||
.. raw:: html | ||
|
||
<h3>Building with MPI support</h3> | ||
|
||
Qiskit Aer can parallelize its simulation on the cluster systems by | ||
using MPI. This can extend available memory space to simulate quantum | ||
circuits with larger number of qubits and also can accelerate the | ||
simulation by parallel computing. To use MPI support, any MPI library | ||
(i.e. OpenMPI) should be installed and configured on the system. | ||
|
||
Qiskit Aer supports MPI both with and without GPU support. Currently | ||
following simulation methods are supported to be parallelized by MPI. | ||
|
||
- statevector | ||
- density_matrix | ||
- unitary | ||
|
||
To enable MPI support, the following flag is needed for build system | ||
based on CMake. | ||
|
||
.. code:: sh | ||
|
||
AER_MPI=True | ||
|
||
For example, | ||
|
||
.. code:: sh | ||
|
||
qiskit-aer$ python ./setup.py bdist_wheel -- -DAER_MPI=True | ||
|
||
See `here <https://github.com/Qiskit/qiskit-aer/blob/main/CONTRIBUTING.md>`__ | ||
for detailed MPI support information. | ||
|
||
|
||
Simulating your first quantum program with Qiskit Aer | ||
===================================================== | ||
Now that you have Qiskit Aer installed, you can start simulating a quantum circuit. | ||
Here is a basic example: | ||
|
||
.. code:: python | ||
|
||
import qiskit | ||
from qiskit_aer import AerSimulator | ||
|
||
# Generate 3-qubit GHZ state | ||
circ = qiskit.QuantumCircuit(3) | ||
circ.h(0) | ||
circ.cx(0, 1) | ||
circ.cx(1, 2) | ||
circ.measure_all() | ||
|
||
# Construct an ideal simulator | ||
aersim = AerSimulator() | ||
|
||
# Perform an ideal simulation | ||
result_ideal = qiskit.execute(circ, aersim).result() | ||
counts_ideal = result_ideal.get_counts(0) | ||
print('Counts(ideal):', counts_ideal) | ||
# Counts(ideal): {'000': 493, '111': 531} | ||
|
||
Ready to get going?... | ||
====================== | ||
|
||
.. raw:: html | ||
|
||
<div class="tutorials-callout-container"> | ||
<div class="row"> | ||
|
||
.. customcalloutitem:: | ||
:description: Find out about Qiskit Aer | ||
:header: Dive into the tutorials | ||
:button_link: ./tutorials/index.html | ||
:button_text: Qiskit Aer tutorials | ||
|
||
.. raw:: html | ||
|
||
</div> | ||
</div> | ||
|
||
|
||
.. Hiding - Indices and tables | ||
:ref:`genindex` | ||
:ref:`modindex` | ||
:ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
########################### | ||
Qiskit Aer How-To Guides | ||
########################### | ||
|
||
This section of the documentation provides concrete step-by-step instructions for how to | ||
do specific useful actions in Qiskit Aer. | ||
|
||
.. toctree:: | ||
:caption: How to... | ||
:maxdepth: 1 | ||
:glob: | ||
|
||
* | ||
|
||
.. Hiding - Indices and tables | ||
:ref:`genindex` | ||
:ref:`modindex` | ||
:ref:`search` |
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think only
CustomCalloutItemDirective
is used inconf.py
. Do we need all classes in this file?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused classes.