Error is a warning in parfeval function
이전 댓글 표시
I have the following (pseudo) code and I'm getting the following warning in my command window (2017b Windows).
function parallel_worker(q)
try
my_function(missing_variable)
catch ME
q.send(ME);
end
end
function my_function(v)
v = v + 1;
end
The receiving q is supposed to rethrow the error message.
Here's the caller:
function runExample()
q_receive = parallel.pool.DataQueue;
L1 = afterEach(q_receive, @handleQ);
%Launch the parallel daq session
%------------------------------------------------
fh = @parallel_worker;
feval_future = parfeval(gcp,fh,0,q_receive);
pause(5)
end
function handleQ(data)
rethrow(data)
end
%For testing:
%runExample should throw the warning below
%parallel_worker(1) - throws an error in the catch (as expected when input is a number not a queue)
I'm seeing: "Warning: Undefined function or variable 'missing_variable'" instead of: ME =
MException with properties:
identifier: 'MATLAB:UndefinedFunction'
message: 'Undefined function or variable 'missing_variable'.'
cause: {}
stack: [1×1 struct]
I know that in some cases I've seen errors throw which cause the future to stop. Why are some errors being converted into warnings?
Update: It appears that my problem may be with throwing ... one second ...
답변 (1개)
Jim Hokanson
2018년 1월 6일
카테고리
도움말 센터 및 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!