Missing function outputs in some iterations inside parfor
Show older comments
I have a function which is invoked in a parfor loop. The function in turn calls a couple more functions and outputs structure fields. However, I do not get all my results, although my simulation runs correctly.
parfor i = 1:900
for j = 1:3600
[x(i,j),y(i,j).y,y(i,j).z] = func(a,b,c,d);
end
end
Here, x,y,z,a,b,c,d are a mix of structures and matrices. So lets assume x is an array. I get correct results in x which tells me that my function runs fine. But a few entries in y (which is a structure) are missing. The missing entries are different at different execution of the same program. Eg: all the columns from row 29 to 41 in y have no entries, but x has the corresponding entries.
What could be the cause? This is my first experience with parallel programming. So any help is appreciated!
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!