You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the case of bit-string measurement sampling as in the above example, each measurement 'shot' is executed as a trajectory,
48
+
whereby Kraus operators specified in the noise model are sampled.
49
+
50
+
51
+
Unitary Mixture vs. General Noise Channel
52
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39
53
54
+
Quantum noise channels can be classified into two categories:
40
55
41
-
In the case of bit-string measurement sampling as in the above example, each measurement 'shot' is executed as a trajectory, whereby Kraus operators specified in the noise model are sampled.
56
+
(1) Unitary mixture
42
57
43
-
For observable expectation value estimation, the statistical error scales asymptotically as :math:`1/\sqrt{N_{trajectories}}`, where :math:`N_{trajectories}` is the number of trajectories.
58
+
The noise channel can be defined by a set of unitary matrices along with list of probabilities associated with those matrices.
59
+
The depolarizing channel is an example of unitary mixture, whereby `I` (no noise), `X`, `Y`, or `Z` unitaries may occur to the
60
+
quantum state at pre-defined probabilities.
61
+
62
+
(2) General noise channel
63
+
64
+
The channel is defined as a set of non-unitary Kraus matrices, satisfying the completely positive and trace preserving (CPTP) condition.
65
+
An example of this type of channels is the amplitude damping noise channel.
66
+
67
+
In trajectory simulation method, simulating unitary mixture noise channels is more efficient than
68
+
general noise channels since the trajectory sampling of the latter requires probability calculation based
69
+
on the immediate quantum state.
70
+
71
+
.. note::
72
+
CUDA-Q noise channel utility automatically detects whether a list of Kraus matrices can be converted to
73
+
the unitary mixture representation for more efficient simulation.
74
+
75
+
.. list-table:: **Noise Channel Support**
76
+
:widths: 20 30 50
77
+
78
+
* - Backend
79
+
- Unitary Mixture
80
+
- General Channel
81
+
* - :code:`nvidia`
82
+
- YES
83
+
- YES
84
+
* - :code:`tensornet`
85
+
- YES
86
+
- NO
87
+
* - :code:`tensornet-mps`
88
+
- YES
89
+
- YES (number of qubits > 1)
90
+
91
+
92
+
Trajectory Expectation Value Calculation
93
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
94
+
95
+
In trajectory simulation method, the statistical error of observable expectation value estimation scales asymptotically
96
+
as :math:`1/\sqrt{N_{trajectories}}`, where :math:`N_{trajectories}` is the number of trajectories.
44
97
Hence, depending on the required level of accuracy, the number of trajectories can be specified accordingly.
45
98
46
99
.. tab:: Python
@@ -63,24 +116,54 @@ Hence, depending on the required level of accuracy, the number of trajectories c
In the above example, as we increase the number of trajectories,
138
+
the result of CUDA-Q `observe` approaches the true value.
139
+
140
+
.. note::
141
+
With trajectory noisy simulation, the result of CUDA-Q `observe` is inherently stochastic.
142
+
For a small number of qubits, the true expectation value can be simulated by the :ref:`density matrix <density-matrix-cpu-backend>` simulator.
143
+
144
+
Batched Trajectory Simulation
145
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146
+
147
+
On the :code:`nvidia` target, when simulating many trajectories with small
148
+
state vectors, the simulation is batched for optimal performance.
71
149
72
-
The following environment variable options are applicable to the :code:`nvidia` target for trajectory noisy simulation. Any environment variables must be set
73
-
prior to setting the target.
150
+
.. note::
151
+
152
+
Batched trajectory simulation is only available on the single-GPU execution mode of the :code:`nvidia` target.
153
+
154
+
If batched trajectory simulation is not activated, e.g., due to problem size, number of trajectories,
155
+
or the nature of the circuit (dynamic circuits with mid-circuit measurements and conditional branching),
156
+
the required number of trajectories will be executed sequentially.
157
+
158
+
The following environment variable options are applicable to the :code:`nvidia` target for batched trajectory noisy simulation.
159
+
Any environment variables must be set prior to setting the target or running "`import cudaq`".
74
160
75
161
.. list-table:: **Additional environment variable options for trajectory simulation**
76
162
:widths: 20 30 50
77
163
78
164
* - Option
79
165
- Value
80
166
- Description
81
-
* - ``CUDAQ_OBSERVE_NUM_TRAJECTORIES``
82
-
- positive integer
83
-
- The default number of trajectories for observe simulation if none was provided in the `observe` call. The default value is 1000.
84
167
* - ``CUDAQ_BATCH_SIZE``
85
168
- positive integer or `NONE`
86
169
- The number of state vectors in the batched mode. If `NONE`, the batch size will be calculated based on the available device memory. Default is `NONE`.
@@ -95,11 +178,45 @@ prior to setting the target.
95
178
- The minimum number of trajectories for batching. If the number of trajectories is less than this value, batched trajectory simulation will be disabled. Default value is 4.
96
179
97
180
.. note::
98
-
99
-
Batched trajectory simulation is only available on the single-GPU execution mode of the :code:`nvidia` target.
100
-
101
-
If batched trajectory simulation is not activated, e.g., due to problem size, number of trajectories, or the nature of the circuit (dynamic circuits with mid-circuit measurements and conditional branching), the required number of trajectories will be executed sequentially.
181
+
The default batched trajectory simulation parameters have been chosen for optimal performance.
182
+
183
+
In the below example, we demonstrate the use of these parameters to control trajectory batching.
Copy file name to clipboardexpand all lines: docs/sphinx/using/backends/sims/svsims.rst
+10-4
Original file line number
Diff line number
Diff line change
@@ -96,8 +96,8 @@ To execute a program on the :code:`nvidia` backend, use the following commands:
96
96
97
97
98
98
In the single-GPU mode, the :code:`nvidia` backend provides the following
99
-
environment variable options. Any environment variables must be set prior to
100
-
setting the target. It is worth drawing attention to gate fusion, a powerful tool for improving simulation performance which is discussed in greater detail `here <https://nvidia.github.io/cuda-quantum/latest/examples/python/performance_optimizations.html>`__.
99
+
environment variable options. Any environment variables must be set prior to setting the target or running "`import cudaq`".
100
+
It is worth drawing attention to gate fusion, a powerful tool for improving simulation performance which is discussed in greater detail `here <https://nvidia.github.io/cuda-quantum/latest/examples/python/performance_optimizations.html>`__.
101
101
102
102
.. list-table:: **Environment variable options supported in single-GPU mode**
103
103
:widths: 20 30 50
@@ -121,6 +121,7 @@ setting the target. It is worth drawing attention to gate fusion, a powerful too
121
121
- positive integer, or `NONE`
122
122
- GPU memory (in GB) allowed for on-device state-vector allocation. As the state-vector size exceeds this limit, host memory will be utilized for migration. `NONE` means unlimited (up to physical memory constraints). This is the default.
123
123
124
+
124
125
.. deprecated:: 0.8
125
126
The :code:`nvidia-fp64` targets, which is equivalent setting the `fp64` option on the :code:`nvidia` target,
126
127
is deprecated and will be removed in a future release.
@@ -212,8 +213,8 @@ See the `Divisive Clustering <https://nvidia.github.io/cuda-quantum/latest/appli
212
213
213
214
In addition to those environment variable options supported in the single-GPU mode,
214
215
the :code:`nvidia` backend provides the following environment variable options particularly for
215
-
the multi-node multi-GPU configuration. Any environment variables must be set
216
-
prior to setting the target.
216
+
the multi-node multi-GPU configuration. Any environment variables must be set prior to setting the target or running "`import cudaq`".
217
+
217
218
218
219
.. list-table:: **Additional environment variable options for multi-node multi-GPU mode**
219
220
:widths: 20 30 50
@@ -276,3 +277,8 @@ environment variable to another integer value as shown below.
0 commit comments