MatLab maxes out exactly one of my cores.

1 vue (au cours des 30 derniers jours)
Lennart
Lennart le 26 Sep 2013
Commenté : Lennart le 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 commentaires
Lennart
Lennart le 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 le 27 Sep 2013
Modifié(e) : Lennart le 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.

Connectez-vous pour commenter.

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by