Clear Filters
Clear Filters

Why does this code slow down?

1 view (last 30 days)
Rosi Marungu
Rosi Marungu on 1 Aug 2016
Commented: Stefan Reich on 1 Aug 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 Comment
Stefan Reich
Stefan Reich on 1 Aug 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.

Sign in to comment.

Answers (0)

Categories

Find more on Scan Parameter Ranges in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!