Azzera filtri
Azzera filtri

Why does this code slow down?

1 visualizzazione (ultimi 30 giorni)
Rosi Marungu
Rosi Marungu il 1 Ago 2016
Commentato: Stefan Reich il 1 Ago 2016
I am trying to run a huge simulation experiment. parameters is a cell with a 5200x1 parameter matrix in each entry. estimatedParameters has the same format. SimData is created as a 100x100x10000 matrix. estimation employs a lot of matrix inversions on 100x100 matrices.
In the first parfor iteration each iteration is done in about 300 secs. After that computational time increases gradually for each iteration and stabilizes at around 1200 secs.
Why could that be? I am not a sophisticated programmer, but in my view it seems like each iteration should take the same time.
for combo=1:4
parfor rep=1:500
tic
SimData = simulation(parameters{combo,rep});
estimatedParameters{combo,rep} = estimation(SimData);
toc
end
end
  1 Commento
Stefan Reich
Stefan Reich il 1 Ago 2016
My guess: After the first iterations your Working Memory(RAM) fills up and Matlab starts having to shift stuff to your hard drive and back, thus slowing down and increasing calculation time. Try monitoring your RAM with the task manager during calculation. But dont take my word for it.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Scan Parameter Ranges in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by