필터 지우기
필터 지우기

Need help to classify a variable for parallel computing

조회 수: 1 (최근 30일)
Mario Trevino
Mario Trevino 2012년 11월 14일
I have something like:
parfor
....
[blobCentroid(i-chunk,1:2),blobOrientation(i-chunk,1)]=blob_analysis(vidFrame_bn);
....
end
but get this msg:
Error: File: core_ZBtracker.m Line: 154 Column: 2
The variable blobCentroid in a parfor cannot be classified.
See Parallel for Loops in MATLAB, "Overview".

답변 (1개)

Walter Roberson
Walter Roberson 2012년 11월 14일
Indexing of (non-temporary) arrays within parfor is restricted to using the parfor index in combination with constant offsets. If one of "i" or "chunk" is being computed inside the parfor, then the i-chunk indexing will be disallowed.
It is more or less the case that if parfor cannot prove, by quick static analysis, that the different iterations of the parfor loop will definitely write to parts of the array that cannot overlap what is written in any other iteration, then the indexing will be refused.
It is sometimes the case that there are theoretical proofs, or your knowledge of the data values, that allow you to know that the indexing in the different loops cannot overlap, but if parfor cannot prove it easy inspection, then parfor will balk.
  댓글 수: 1
Mario Trevino
Mario Trevino 2012년 11월 15일
hi Sir Walt(er) Im still quite confused with the right move to make. my loop looks as follows (chunk and delta are constants, blob_centroid is preallocated).
while ini<nFrames
if fin>nFrames;fin=nFrames;end
mov=read(vidObj, [ini fin]);
% getting ready for parallel computing chunk=start_vidFrame-1; nF=nFrames;
% matlabpool open for i=ini:fin waitbar(i/nF);
[blobCentroid(i-chunk,1:2),blobOrientation(i-chunk,1)]=blob_analysis(vidFrame_bn);
end ini=fin+1; fin=ini+delta; end

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by