As I know about parallel programming in Matlab, We can exactly specify what worker does what; using :

if labindex == x

%some computations

end

Also we can run for loops in parallel; using :

parfor i1 = x:y

%some computations

end

I'm using a cluster with a few nodes and each node has 8 cores.

I want to run 2 functions which each one contains an parfor loop, and each function get executed by an worker, my code is something like this :

spmd

if labindex == 1

alpha = forward( some parameters );

end

if labindex == 2

beta = backward( some parameters );

end

end

I wanted these 2 functions get executed simultaneously by 2 different nodes. but Matlab throws back this error :

PARFOR or SPMD can not be used inside an SPMD block.

Why is that so? Any idea?

Similar questions and discussions