Parfor fails but for doesn't?
1 view (last 30 days)
Show older comments
hi all,
If I use the code:
scalar_matrix=sptensor([nPoints-kernel_length nInput_kernels nNodes]);
for j=1:(nPoints-kernel_length),
a=input_kernel_matrix*(output(:,j:kernel_length+j-1).');
if nnz(a)==0
scalar_matrix(j,:,:)=sptensor([nInput_kernels nNodes]);
else
scalar_matrix(j,:,:)=sptensor(a);
end;
if mod(j,10000)==0
display(j);
end;
end;
Then everything works fine. However, if I replace the for with parfor it crashes. The code seems fine for parellization to me. Any idea why? I use the tensor toolbox (external toolbox).
4 Comments
Walter Roberson
on 15 Oct 2011
Odd odd.
Ummm, try
which -all parfor
just in case you have a parfor.m on your path that isn't the right one.
Also, try removing the comma at the end of the "for" line: it is not needed and might be causing problems perhaps.
Konrad Malkowski
on 27 Oct 2011
Can you post a more complete example of your code? It would be especially helpful if you could post a snipped of code that initializes all the input variables to values representative of your application.
Answers (0)
See Also
Categories
Find more on Parallel for-Loops (parfor) in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!