Why does my long simulation slow down over time?
Mostra commenti meno recenti
I am running long simulations involving a double for-loop with each approx. 20 intervals, and each internal process taking anywhere between an hour and a day. When initiating this simulation it will start off at a rapid pace, and will slow down at a rate which appears to be correlated to the decreasing availability of RAM on the computer. This, however, puzzles me as I have set it up so that nothing, apart from a handful of matrices, is stored in between the individual processes and all matrices are assigned before use so nothing grows without being pre-assigned.
Does anyone know of any tricks I can use? Is this just to be expected for long matlab runs in general? using tic/toc or profile only emphasizes that the whole thing slows down.
Thanks in advance
8 Commenti
Star Strider
il 31 Ott 2012
Are you running any solvers in your loops (ode, optimization, etc.)?
Jakob Sievers
il 31 Ott 2012
Star Strider
il 31 Ott 2012
If you're taking matrix inverses (please do not use inv) or doing matrix division, how are you doing it? I suggest mldivide.
Jakob Sievers
il 31 Ott 2012
Walter Roberson
il 31 Ott 2012
Which MATLAB version are you using, and which operating system? 32 or 64 bit ?
Star Strider
il 31 Ott 2012
The only other thing I can suggest is that you clear the matrices you no longer need at the end of an iteration or alternatively assign them to the empty matrix ( [] ), and re-allocate them at the beginning of the next iteration.
Jakob Sievers
il 31 Ott 2012
Jakob Sievers
il 31 Ott 2012
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su App Building in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!