From: Tarik on
I am having difficulty implementing a Sedumi function using the Yalmip interface inside a parfor loop with the parallel computing toolbox.

For instance, I can't even define a Yalmip variable inside a parfor loop. The code works fine with a for loop and the parfor loop cannot understand "sdpvar". I get: "Undefined function or method 'sdpvar' for input arguments of type 'double'."

parfor ii=1:3
b = sdpvar(M, 1);
end

Anyone have any idea how to get around this?
From: Edric M Ellis on
"Tarik " <ytarik(a)hotmail.com> writes:

> I am having difficulty implementing a Sedumi function using the Yalmip
> interface inside a parfor loop with the parallel computing toolbox.
>
> For instance, I can't even define a Yalmip variable inside a parfor
> loop. The code works fine with a for loop and the parfor loop cannot
> understand "sdpvar". I get: "Undefined function or method 'sdpvar' for
> input arguments of type 'double'."
>
> parfor ii=1:3
> b = sdpvar(M, 1);
> end
>
> Anyone have any idea how to get around this?

The MATLAB workers in your MATLABPOOL need access to the MATLAB code for
sdpvar. We try to keep the MATLABPATH in sync between the client and the
workers, but there are a couple of things that can get in the way.

If you're using "local" workers, then they *ought* to be able to find
the same MATLAB code as the client. In any case, you can run something
like

pctRunOnAll addpath /path/to/yalmip

to get all the workers to find things. (All the workers need to be able
to see the code for yalmip).

Cheers,

Edric.
From: Tarik on
Edric, thanks a lot! I assumed since I was using a single computer with multiple processors, the paths would be synchronized. But, apparently this isn't always the case as you pointed out. Adding the following two lines as you suggested seems to have solved the problem.

pctRunOnAll addpath(genpath('C:\Program Files\MATLAB\R2009a/Yalmip'));
pctRunOnAll addpath(genpath('C:\Program Files\MATLAB\R2009a/SeDuMi_1_21'));

Best,
Tarik.