parfor loop stalls where a for loop does fine, no error
5 ビュー (過去 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!