parallel efficiency problem in the loop
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Walter Roberson
2015년 5월 18일
댓글 수: 3
Walter Roberson
2015년 5월 19일
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?
참고 항목
카테고리
Help Center 및 File Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!