From: landon donovan on
I got the next code:
for i = 1:L
a_ext = [an an(1:lf)]
if labindex == 1
lpf = conv(a_ext,h0)
lpfd = lpf(lf:2:lf+lx-1)
elseif labindex == 2
hpf = conv(a_ext,h1)
hpfd = hpf(lf:2:lf+lx-1)
end
an(1:lx) = [lpfd hpfd]
lx = lx/2
end
That i run in a matlabpool with 2 labs. that is to run in parallel this function but it appears that it doesn't work. Can somebody explain me how can I run the function conv and work with the two arrays lpf and hpf , each in a different lab?? Please Help
Ive tried creating a parallel job with two tasks, and in each task doing te function conv with diferent inputs, but an error occurs that says I can not run more than one task:
j=createParallelJob()
createTask(j,@conv,1,{{[1 2 3 4 3 4 2 3],[1 2 3]} {[1 2 3 4 3 4 2 3],[4 5 6]}})
then i got the next error:
??? Error using ==> distcomp.simpleparalleljob.pCreateTask at 12
When setting up a parallel job, only 1 task is allowed

Error in ==> distcomp.abstractjob.createTask at 15
tasks = job.pCreateTask(taskFcns, numArgsOut, argsIn);
How can I do this using parallel jobs please help
From: Juliette Salexa on
I'm not exactly sure, but have you tried SPMD 'Single Program Multiple Data' ?

http://www.mathworks.com/access/helpdesk/help/toolbox/distcomp/brukbno-1.html
From: landon donovan on
It would be unnecesary to use spmd because spmd is for single program multiple data, and I got to make a diferent function in each lab, that is:
conv([x],h0) in lab 1
conv([x],h1) in lab 2
I think it could be achieved with a parallel job but when I try to set two tasks to a parallel job, matlab says that I can only use one task in a parallel job; im not sure if Im using this correctly, or if someone has a better idea to parallelize this code, Ill give you very much thanks.
From: Edric M Ellis on
"landon donovan" <lutobu(a)gmail.com> writes:

> It would be unnecesary to use spmd because spmd is for single program
> multiple data, and I got to make a diferent function in each lab, that
> is: conv([x],h0) in lab 1 conv([x],h1) in lab 2

You can use SPMD to achieve that, like so (assuming you have already
opened a MATLABPOOL):

x = 1:10;
h0 = 1:3;
h1 = 1:4;
spmd(2)
if labindex == 1
c = conv(x, h0);
elseif labindex == 2
c = conv(x, h1);
end
end
c{1} % == conv(x, h0)
c{2} % == conv(x, h1)

> I think it could be achieved with a parallel job but when I try to set
> two tasks to a parallel job, matlab says that I can only use one task
> in a parallel job;

You can think of the task function of a parallel job as being roughly
equivalent to the body of an SPMD block. There's only one definition of
this, but you can once again switch on labindex if you wish.

Cheers,

Edric.
 | 
Pages: 1
Prev: save a large 900*1 cell
Next: TeX in xlabel()