From 5b92eaead43bfeeee70f165b15c67bc702e1575e Mon Sep 17 00:00:00 2001 From: Kris Date: Thu, 5 Feb 2026 21:28:53 +0000 Subject: [PATCH 1/4] Document NumPy 1 interaction with max simulation size --- docs/choose_hw.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/choose_hw.md b/docs/choose_hw.md index 19094b042..2441dfb16 100644 --- a/docs/choose_hw.md +++ b/docs/choose_hw.md @@ -311,6 +311,13 @@ depth beyond 20 qubits. * The total small circuits runtime overhead for an N qubit circuit depends on the circuit depth and on N. The overhead can be large enough to conceal the $2^N$ growth in runtime. +* NumPy version matters for large simulations: + * Some users have reported being unable to simulate circuits with more than + ~32 qubits when using NumPy 1.26. + * Updating NumPy to version 2.x resolved the issue in these cases. + * If you encounter unexpected failures, memory errors, or hard limits on + the number of qubits, ensure you are running a recent NumPy version + before further debugging. ## Sample benchmarks From 9655206b006acb298af89b81675aced9312db634 Mon Sep 17 00:00:00 2001 From: Kristiyan Dilov Date: Sun, 5 Apr 2026 11:12:07 +0100 Subject: [PATCH 2/4] Update docs/choose_hw.md Co-authored-by: Michael Hucka --- docs/choose_hw.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/choose_hw.md b/docs/choose_hw.md index 2441dfb16..580481c5c 100644 --- a/docs/choose_hw.md +++ b/docs/choose_hw.md @@ -311,7 +311,7 @@ depth beyond 20 qubits. * The total small circuits runtime overhead for an N qubit circuit depends on the circuit depth and on N. The overhead can be large enough to conceal the $2^N$ growth in runtime. -* NumPy version matters for large simulations: +* The NumPy version matters for large simulations: * Some users have reported being unable to simulate circuits with more than ~32 qubits when using NumPy 1.26. * Updating NumPy to version 2.x resolved the issue in these cases. From a44c58257b3a3176099a81bae0230ebf87b2fb83 Mon Sep 17 00:00:00 2001 From: Kristiyan Dilov Date: Sun, 5 Apr 2026 11:13:11 +0100 Subject: [PATCH 3/4] Update docs/choose_hw.md Co-authored-by: Michael Hucka --- docs/choose_hw.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/choose_hw.md b/docs/choose_hw.md index 580481c5c..70ecd6c50 100644 --- a/docs/choose_hw.md +++ b/docs/choose_hw.md @@ -312,9 +312,8 @@ depth beyond 20 qubits. depends on the circuit depth and on N. The overhead can be large enough to conceal the $2^N$ growth in runtime. * The NumPy version matters for large simulations: - * Some users have reported being unable to simulate circuits with more than - ~32 qubits when using NumPy 1.26. - * Updating NumPy to version 2.x resolved the issue in these cases. + * NumPy 1.x defines a constant `NPY_MAXDIMS`, which is set to 32 in the NumPy source code. Many internal NumPy structures, such as those for iteration and coordinate tracking, use fixed-size buffers based on this value. Although the C++ core of qsim is not affected by this (since it does not use NumPy), this NumPy limit prevents state vectors from having more than 32 qubits when using Python. Attempting to use 33 or more qubits results in an error. + * NumPy 2.x increased this limit to 64 dimensions, and qsim can work with more than 32 qubit when NumPy 2.x is used. * If you encounter unexpected failures, memory errors, or hard limits on the number of qubits, ensure you are running a recent NumPy version before further debugging. From ca62bd0212862a628227d83dc0a97a601a3bb42b Mon Sep 17 00:00:00 2001 From: Michael Hucka Date: Sun, 5 Apr 2026 19:10:16 -0700 Subject: [PATCH 4/4] Reformat text to fit in 80 columns --- docs/choose_hw.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/choose_hw.md b/docs/choose_hw.md index 70ecd6c50..53d23e28c 100644 --- a/docs/choose_hw.md +++ b/docs/choose_hw.md @@ -312,11 +312,17 @@ depth beyond 20 qubits. depends on the circuit depth and on N. The overhead can be large enough to conceal the $2^N$ growth in runtime. * The NumPy version matters for large simulations: - * NumPy 1.x defines a constant `NPY_MAXDIMS`, which is set to 32 in the NumPy source code. Many internal NumPy structures, such as those for iteration and coordinate tracking, use fixed-size buffers based on this value. Although the C++ core of qsim is not affected by this (since it does not use NumPy), this NumPy limit prevents state vectors from having more than 32 qubits when using Python. Attempting to use 33 or more qubits results in an error. - * NumPy 2.x increased this limit to 64 dimensions, and qsim can work with more than 32 qubit when NumPy 2.x is used. - * If you encounter unexpected failures, memory errors, or hard limits on - the number of qubits, ensure you are running a recent NumPy version - before further debugging. + * NumPy 1.x defines a constant `NPY_MAXDIMS`, which is set to 32 in the + NumPy source code. Many internal NumPy structures, such as those for + iteration and coordinate tracking, use fixed-size buffers based on this + value. Although the C++ core of qsim is not affected by this (since it + does not use NumPy), this NumPy limit prevents state vectors from having + more than 32 qubits when using Python. Attempting to use 33 or more + qubits results in an error. + * NumPy 2.x increased this limit to 64 dimensions, and qsim can work with + more than 32 qubit when NumPy 2.x is used. If you encounter unexpected + failures, memory errors, or hard limits on the number of qubits, ensure + you are running a recent NumPy version before further debugging. ## Sample benchmarks