Skip to content

Commit d908952

Browse files
kris524mhucka
andauthored
Document NumPy 1 interaction with max simulation size (#1015)
Fixes #863. --------- Co-authored-by: Michael Hucka <mhucka@google.com>
1 parent b7e6627 commit d908952

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

docs/choose_hw.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,18 @@ depth beyond 20 qubits.
311311
* The total small circuits runtime overhead for an N qubit circuit
312312
depends on the circuit depth and on N. The overhead can be large enough to
313313
conceal the $2^N$ growth in runtime.
314+
* The NumPy version matters for large simulations:
315+
* NumPy 1.x defines a constant `NPY_MAXDIMS`, which is set to 32 in the
316+
NumPy source code. Many internal NumPy structures, such as those for
317+
iteration and coordinate tracking, use fixed-size buffers based on this
318+
value. Although the C++ core of qsim is not affected by this (since it
319+
does not use NumPy), this NumPy limit prevents state vectors from having
320+
more than 32 qubits when using Python. Attempting to use 33 or more
321+
qubits results in an error.
322+
* NumPy 2.x increased this limit to 64 dimensions, and qsim can work with
323+
more than 32 qubit when NumPy 2.x is used. If you encounter unexpected
324+
failures, memory errors, or hard limits on the number of qubits, ensure
325+
you are running a recent NumPy version before further debugging.
314326

315327
## Sample benchmarks
316328

0 commit comments

Comments
 (0)