MatLab maxes out exactly one of my cores.

3 Ansichten (letzte 30 Tage)
Lennart
Lennart am 26 Sep. 2013
Kommentiert: Lennart am 27 Sep. 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 Kommentare
Lennart
Lennart am 26 Sep. 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 am 27 Sep. 2013
Bearbeitet: Lennart am 27 Sep. 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jan
Jan am 26 Sep. 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 Kommentare
Lennart
Lennart am 26 Sep. 2013
I created an example and added it to my question
Lennart
Lennart am 27 Sep. 2013
This question is answered in the comments so I accepted this one to not leave it open.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by