Running individual matlab scripts in parallel?

Hello everyone,
I am fairly new to matlab parallel functions and I would like some advice and help.
I have two individual matlab scripts (do not need any communication between them) and I would like to run both at the same time (in parallel).
At the moment I tried to run these scripts by calling the commands below:
j = batch('SimplifiedNet1', 'Profile', 'local','matlabpool', 2);
k = batch('SimplifiedNet2', 'Profile', 'local','matlabpool', 2);
When I check in the job monitor I can see that the first job is running while the second is queued until the first finishes.
How can I run both of the scripts at the same time?
Thank you!

 Akzeptierte Antwort

Edric Ellis
Edric Ellis am 12 Dez. 2014

1 Stimme

Do your scripts call PARFOR or other parallel language features? By specifying "...'matlabpool', 2" in your batch command, each job is taking up 3 workers - so you're probably running out of workers. If the scripts don't need to use PARFOR, then simply omit those arguments.
You can check how many workers your local cluster can support simply by displaying the object:
disp(parcluster('local'))

1 Kommentar

Many thanks for the reply! I was running out of workers. Now it works fine!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Sean de Wolski
Sean de Wolski am 12 Dez. 2014

1 Stimme

doc createJob
doc createTask
Create one job and then attach the two scripts to it as tasks (slightly lower-level api than batch but gives you this kind of control).

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by