Need help to classify a variable for parallel computing
1 次查看(过去 30 天)
显示 更早的评论
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".
0 个评论
回答(1 个)
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!