Converting this big for-loop into a PARFOR-loop
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Yoav Livneh
2011년 8월 4일
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.
답변 (1개)
Titus Edelhofer
2011년 8월 4일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!