Converting this big for-loop into a PARFOR-loop
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I am struggling converting this loop into a PARFOR loop:
NARRtroughid=nan(277,349,93,30,3,'single');
for yr=1:30 fprintf('**********NOW ON yr %d**********\n',yr);
for dy=1:92 fprintf('NOW ON day %d\n',dy);
for la=100+2:135-2
for lo=80+7:170-7
NARRtroughid(la,lo,dy,yr,:)=trofid(lat(la,1),lon(1,lo),lat,lon,squeeze(h(:,:,dy,yr)));
end
end
end
end
I am getting slicing errors and I dont really understand how to slice this up. Here is the error:
variable indexed but not sliced,in a PARFOR loop. this might result in unnecessary communication overhead.
I read online but no help for large nested-forloops like this one. Any help you be great!
1 comentario
Yoav Livneh
el 4 de Ag. de 2011
Can you show how you implemented the PARFOR loop? It will be easier to help you slice your variables.
BTW not slicing your variables doesn't cause an error. The warning means that it might take longer to run the loop because in each iteration MATLAB sends the entire array to the worker, instead of just the relevant slice, which takes more time.
Respuestas (1)
Titus Edelhofer
el 4 de Ag. de 2011
Hi,
first of all you got a warning, not an error. The warning indicates that it might be, that the parfor loop does not perform as one expects. Nevertheless it should run, does it?
Titus
0 comentarios
Ver también
Categorías
Más información sobre Parallel for-Loops (parfor) en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!