parallel efficiency problem in the loop
1 view (last 30 days)
Show older comments
I have a question while using the parallel in Matlab.
parfor ii=1:100
[a]=function(x1, x2, x3,....)
end
Each loop takes approximately 1.75s. I open 4 workers. I am not satisfied with the speed.
Besides, the input of 'function' has a cell whose dimension is 62*1, and the it has totally 8187292256 bytes. I guess that maybe this large input cause a lot of time when I use the parallel! So, I make this input equal to 1(8 bytes) and replace the part with a pause function(pause(1.25)), I find that in this case the parallel efficiency is good.
So I am confused with the variables in the parallel, will each worker has one copy of the variable or all the workers have one, and they will access the same one at the same time? If so, is there any method to help to solve the problem!!!!!
0 Comments
Answers (1)
Walter Roberson
on 18 May 2015
3 Comments
Walter Roberson
on 19 May 2015
What error are you receiving?
To confirm, you are attempting to pass a cell array into a mex file?
As you are already using C code, have you considered the possibility of having your C code be the place that runs the parallel code, perhaps using standard threading libraries?
See Also
Categories
Find more on Parallel for-Loops (parfor) 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!