parfor loop stalls where a for loop does fine, no error
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi all,
I have a parfor loop that calls a function. Parameters are passed to the function. Two of the parameters are omega and delta, if either one of these is close to zero, the parfor loop stalls out and freezes. But, if it is for loop it works fine.
Doesn't make any sense to me. There is clearly more code to it....but is there any red flag that would make sense when parameters are close to zero, it works fine in a for, but stalls in a parfor?
Here is the code
parfor j = 1:numberOfICs
str = sprintf('trial: %d/%d',j,numberOfICs); disp(str)
IC = ICmatrix(j,:); % Choose initial position
% Pass to RK4
[all_Y_pos(:,:,j),all_aveLE(:,j),savedLETimeTemp] = ODE_approx_RK4(j,epsilon,eta,delta,omega,A,xi...
,IC(1),IC(2),t0,dt,tf,pert,threshold,exposh,orbitSaved,save_aveV...
,save_aveLE, orbitSaveStart);
if j == 1
savedLETime(j,:) = savedLETimeTemp;
end
end
Will
댓글 수: 0
답변 (1개)
Edric Ellis
2012년 3월 29일
The main difference when running PARFOR are that different iterations of the loop are executed by different processes. So, if your function has persistent state for example, that is not shared across all the workers. Other than that, there are no expected differences in the way functions are evaluated on the workers.
댓글 수: 0
참고 항목
카테고리
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!