Skip to content
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

StackOverflowError Issue #14

Closed
ccoffrin opened this issue Feb 14, 2022 · 3 comments
Closed

StackOverflowError Issue #14

ccoffrin opened this issue Feb 14, 2022 · 3 comments

Comments

@ccoffrin
Copy link
Member

I am getting a ERROR: StackOverflowError: when building a system with 9 or more qubits. Tested on Julia v1.7.0.

MWE:

using QuantumAnnealing
n = 9
@time ρ = simulate(Dict((i,) => 1.0 for i in 1:n), 1.0, AS_CIRCULAR)
@zmorrell
Copy link
Collaborator

@ccoffrin That is a surprisingly low number of qubits. I just tried to replicate on my own machine and was able to get up to 12 qubits successfully, with the process being killed (likely due to lack of memory) at 13 qubits. The following is my output. I am running Julia 1.7.1 on a system with 8 GB of RAM. I do agree that we should ideally improve the scalability, I am just surprised that we are having such a large difference in number of qubits and error modes.

n = 12

iter |  steps  |    max(Δ)    |    mean(Δ)   |
   1 |       4 | 5.372611e-03 | 3.621762e-05 |
   2 |       8 | 4.046612e-05 | 4.065840e-07 |

converged
   iterations........: 2
   simulation steps..: 8
   maximum difference: 4.046612e-05 <= 1.000000e-04
   mean difference...: 4.065840e-07 <= 1.000000e-06
   runtime (seconds).: 531.093272

534.307696 seconds (22.98 M allocations: 42.642 GiB, 4.51% gc time, 2.05% compilation time)
n = 13

iter |  steps  |    max(Δ)    |    mean(Δ)   |
Killed

@ccoffrin
Copy link
Member Author

ccoffrin commented Feb 14, 2022

Thanks for double checking this. I confirmed the issue was in Julia, I updated to 1.7.2 on OS X and it resolved the issue. The code easily scaled to 12 qubits on a MacBook Pro with 32GB of memory. At 13 qubits CPU time is currently the primary bottle neck.

I started using this for testing to see how far I can go,

for n in 1:20
    println("qubits: $(n)")
    @time ρ = simulate(Dict((i,) => 1.0 for i in 1:n), 1.0, AS_CIRCULAR, 2);
end

@ccoffrin
Copy link
Member Author

ccoffrin commented Feb 15, 2022

As the stack overflow issue is resolved I am closing this in favor of #5.

For reference, here are the basic runtime and memory requirements,

qubits: 2
  0.000100 seconds (484 allocations: 38.062 KiB)
...
qubits: 4
  0.000162 seconds (806 allocations: 169.359 KiB)
...
qubits: 8
  0.044671 seconds (1.95 k allocations: 20.817 MiB, 52.92% gc time)
qubits: 9
  0.134527 seconds (2.37 k allocations: 84.108 MiB, 29.86% gc time)
qubits: 10
  0.583697 seconds (2.80 k allocations: 328.743 MiB, 21.82% gc time)
qubits: 11
  2.883114 seconds (3.43 k allocations: 1.269 GiB, 8.99% gc time)
qubits: 12
 21.319456 seconds (4.07 k allocations: 5.041 GiB, 4.27% gc time)
qubits: 13
172.125511 seconds (4.69 k allocations: 20.092 GiB, 1.27% gc time)
qubits: 14
1497.746993 seconds (5.36 k allocations: 80.195 GiB, 0.30% gc time)
...

Basic memory requirements (without matrix exponentiation),

qubits: 9
  0.006588 seconds (2.31 k allocations: 15.519 MiB)
qubits: 10
  0.031300 seconds (2.74 k allocations: 55.468 MiB, 22.60% gc time)
qubits: 11
  0.104134 seconds (3.37 k allocations: 208.946 MiB, 6.35% gc time)
qubits: 12
  0.598221 seconds (4.00 k allocations: 804.009 MiB, 31.72% gc time)
qubits: 13
  1.642825 seconds (4.62 k allocations: 3.079 GiB, 10.64% gc time)
qubits: 14
  6.358479 seconds (5.29 k allocations: 12.167 GiB, 8.27% gc time)
qubits: 15
126.56007 seconds (6.01 k allocations: 48.373 GiB, 0.62% gc time)
qubits: 16
... killed (OOM)

@ccoffrin ccoffrin changed the title Scalability Improvement StackOverflowError Issue Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants