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!