MatLab maxes out exactly one of my cores.

1 次查看(过去 30 天)
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 个评论
Lennart
Lennart 2013-9-26
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 2013-9-27
编辑:Lennart 2013-9-27
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.

请先登录,再进行评论。

采纳的回答

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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by