Error using Parallel Computing Toolbox with INTLAB
Mostra commenti meno recenti
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
Risposte (3)
Marc Arsenault
il 21 Ott 2016
Modificato: Marc Arsenault
il 21 Ott 2016
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
il 21 Ott 2016
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...
Categorie
Scopri di più su Parallel for-Loops (parfor) in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!