Run scripts in parallel on multiple workers (distributed job)
Mostra commenti meno recenti
Hello, I have 12 workers available in my local matlabpool. I'd like to run 3 scripts (doing different simulink simulations) in parallel on those workers. There is no need for those tasks to communicate to each other. What is the best way to go about this (programmatically)?
matlabpool;
pctRunOnAll('cd C:\Users\Controls\prj\sunapee');
pctRunOnAll('startup');
pctRunOnAll('sys = ''sunapee'';')
pctRunOnAll('load_system( sys)');
low_j = batch('low_pressure_tsts');
med_j = batch('mid_pressure_tsts');
hi_j = batch('high_pressure_tsts');
Doesn't seem to be doing the trick. Thank you, Igor
Risposte (2)
Ryan G
il 31 Ott 2012
It sounds like there are multiple simulations in each script. So the number of simulations would be the sum of the three and you want to distribute this task.
j = batch('script1', 'matlabpool', 8, 'CaptureDiary', true);
wait(j); % Wait for the job to finish
diary(j) % Display the diary
load(j) % Load job workspace data into client workspace
Where you would replace script1 with your script name and replace 8 with your 12 workers.
2 Commenti
Igor Braverman
il 31 Ott 2012
Ryan G
il 1 Nov 2012
The names of the script implied they might each loop within the script, in which case running each one in this method would save time. If each script is more linear and can you want to run them each on a worker at the same time you could try something like this:
j = batch('script1', 'Profile', 'local','matlabpool', 3);
k = batch('script2', 'Profile', 'local','matlabpool', 3);
m = batch('script3', 'Profile', 'local','matlabpool', 3);
This would potentially use 4 workers for each job here. If this still doesn't work, I would suggest looking into the createJob function.
Danilo Teran
il 28 Set 2016
0 voti
Hello, How can I stop when I start both scripts.
My scripts is too long and I need to stop them.
Best Regards
1 Commento
Dingqiao Zhu
il 7 Mar 2017
delete(job)
Categorie
Scopri di più su Job and Task Creation in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!