ammar
ammar

Reputation: 33

How can we create a distributed array for specific number of workers (cores) in MATLAB?

I have a question: How can we create a distributed array for specific number of workers in MATLAB? In other words, if we have 4 workers(cores) in our computer and we would like to designate just 3 workers to process a distributed array, how can we do that. I used the existing commands in this way:

a=[1 2 3 4 5 6]; b=codistributed(a);

Unfortunately, this instruction use all four workers!

Please, any idea how to solve this problem?

Kind regards Ammar

Upvotes: 0

Views: 62

Answers (1)

Marouen
Marouen

Reputation: 945

parfor uses n available workers called by parpool(n)

you can set instead parpool(3)

Matlab doesn't have parallel constructs like OpenMP or MPI, in which case you can set one worker to do a job and three others to do another job.

Upvotes: 0

Related Questions