It seems that resetting recursion limit is ignored inside parfor. I have a recursive program that will exceed the default 500 limit. I can run it without problem using usual for loop. However, if I change it to parfor, I got the error
Caused by:
Maximum recursion limit of 500 reached. Use
set(0,'RecursionLimit',N) to change the limit. Be aware
that exceeding your available stack space can crash MATLAB
and/or your computer.
And no matter where I put the reset limit command set(0,'RecursionLimit',2000) (inside or outside parfor). I still got the same error message

 채택된 답변

Edric Ellis
Edric Ellis 2014년 3월 10일

0 개 추천

I would try calling
spmd
set(0, 'RecursionLimit', N);
end
as this will ensure it executes on all workers.

댓글 수: 2

Samuel
Samuel 2014년 3월 10일
Thanks. It works!
I came across another problem though. I keep getting random errors like "The client lost connection to Lab..." I am running matlab through an NX server. I wonder if that can be an issue.
Edric Ellis
Edric Ellis 2014년 3월 11일
Unexpected loss of connection can sometimes occur if the worker machines crash.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

질문:

2014년 3월 10일

댓글:

2014년 3월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by