Is it possible to use pctRunOnAll as a batch?

2 visualizaciones (últimos 30 días)
Bobby Brown
Bobby Brown el 18 de Jul. de 2016
Respondida: Edric Ellis el 18 de Jul. de 2016
Hi,
I have a script that will only allow me to parallel it if i use pctRunOnAll because it uses a simulation plugin that only likes one instantiation and does not like parfor. As a pctRunONAll, it works fine.
I want to get this parallel work to operate in a batch in the background. Is it possible to combine pctRunOnAll with a batch?
Am i able to do this?
j = batch(pctRunOnAll 'script1', 'matlabpool', 10, 'CaptureDiary', true);
Thanks Bobby

Respuestas (1)

Edric Ellis
Edric Ellis el 18 de Jul. de 2016
While you can use pctRunOnAll with batch, it's a little awkward. Here's what you need to do:
j = batch(@pctRunOnAll, 0, {'script1'}, 'Pool', 10, 'CaptureDiary', true)
Here we're using the form of batch which takes a function handle - in this case @pctRunOnAll. Then, we must specify the number of output arguments from that function - which is 0, and then the input arguments as a cell array, {'script1'}.
One other option you might wish to explore is wrapping up your task inside a function, and then you can use parfeval to run multiple iterations. This is also compatible with batch.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by