parfor calculations take longer time than for
Mostra commenti meno recenti
I am starting to work with the Parallel Computing Toolbox, and just constructed simple example to compare for and parfor:
tic
a=rand(4000,4000);
k=size(a,1);
(par)for i=1:k
for j=1:k
a(i,j)=2/(2+a(i,j));
end
end
toc
I computed this with parfor and for (I wrote par in brackets so first time there is no "par", and second there is "par"). Computational time is several seconds, but parfor calculates it two or three times slower. I also used matlabpool (4 workers) before.
What is the problem?
Thanks in advance
3 Commenti
Zoltán Csáti
il 25 Ott 2014
It is much slower on my dual-core machine too. I am also curious why it is.
Mikhail
il 25 Ott 2014
Mikhail
il 25 Ott 2014
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Parallel for-Loops (parfor) in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!