Azzera filtri
Azzera filtri

MatLab maxes out exactly one of my cores.

3 visualizzazioni (ultimi 30 giorni)
Lennart
Lennart il 26 Set 2013
Commentato: Lennart il 27 Set 2013
I am doing a lot of lsqcurvefits (order of 10^9 datapoints about 20 per fit so thats 10^8 fits) and all data is loaded in memory. Matlab maxes out exactly one of my cores on every system I try this on (dual core at work, quadcore at home). Even if I use parfor in my loops. Everywhere on this forum people tell eachother that there must be some other bottleneck, but I just dont buy it. Especially after trying it out at home with really fast RAM. Why does MatLab exactly max out one core if CPU is not the bottleneck?
My code goes something like this:
%size(data)==[15000 20];
times = [1:20];
startvals = [1,1];
pre_al = zeros(15000, 1);
amps = pre_al;
exps = pre_al;
expdecayfun = @([amplitude, exponent], time) amplitude*exp(-time/exponent)
parfor i=1:15000
x = lsqcurvefit(expdecayfun, startvals, times, data(i,:));
amps(i) = x(1);
exps(i) = x(2);
end
  4 Commenti
Lennart
Lennart il 26 Set 2013
I was very hopefull that that would be it, however at work this did not help. Ill try it at home too, where I can make sure there are no other bottlenecks. Still the one core thats used is maxed at the office, so I do think thats the bottleneck.
Lennart
Lennart il 27 Set 2013
Modificato: Lennart il 27 Set 2013
Yes this did it at home!One core took 440 seconds, four cores took 150 seconds. I think my memory is the bottleneck at work then. Thanks! Still getting used to the strange habits of Matlab... sorry if this question was too basic.

Accedi per commentare.

Risposta accettata

Jan
Jan il 26 Set 2013
Without seeing any line of the code, guessing the reason cannot be reliable. Perhaps you start Matlab with a flag to run on one core only? Or your PARFOR loops run one instance only? Could you provide more details?
  2 Commenti
Lennart
Lennart il 26 Set 2013
I created an example and added it to my question
Lennart
Lennart il 27 Set 2013
This question is answered in the comments so I accepted this one to not leave it open.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by