Error using Parallel Computing Toolbox with INTLAB
이전 댓글 표시
Hi,
I am unable to convert code that uses interval arithmetic (based on the INTLAB toolbox) to be executed in parallel using the Parallel Computing toolbox. Here is a snippet of (otherwise useless) code which will lead to the error:
x=infsup(1,2);
pool=parpool(2);
parfor i=1:1
2*x
end
Here is the error message that is received:
Starting parallel pool (parpool) using the 'local' profile ... connected to 2 workers.
Error using * (line 35)
Struct contents reference from a non-struct array object.
Error in spmd_test (line 8)
parfor i=1:1
Please note that the same code would work without issue if a standard "for" loop was used instead of "parfor". Any advice would be appreciated on why this doesn't work as expected.
Thank you,
Marc
답변 (3개)
Marc Arsenault
2016년 10월 21일
편집: Marc Arsenault
2016년 10월 21일
There are some restrictions on variables you can use within parfor. Example: Use Objects and Handles in parfor-Loops
I am guessing that the following code would work without a problem.
x=1;
pool=parpool(2);
parfor i=1:1
2*x
end
If so, getting to know what x=infsup(1,2) is should help. What kind of datatype does infsup returns? Could you try
x = infsup(1,2);
whos x
to see the datatype of x? Or could you simply get output without displaying the result?
x=infsup(1,2);
pool=parpool(2);
parfor i=1:1
result(i) = 2*x;
end
Edric Ellis
2016년 10월 21일
I suspect this is related to the transfer of an object of type infsup. You could check this as follows:
x = infsup(1,2);
save tmp x
clear
load tmp
x * 2;
If that fails in the same way, then the problem lies with the class infsup. If that succeeds, then I'm not sure where the problem lies...
카테고리
도움말 센터 및 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!