Products & Services Solutions Academia Support User Community Company

Learn more about Parallel Computing Toolbox   

batch - Run MATLAB script as batch job

Syntax

j = batch('aScript')
j = batch(..., 'p1', v1, 'p2', v2, ...)

Arguments

j

The MATLAB pool job object.

'aScript'

The script of M-code to be evaluated by the MATLAB pool job.

p1, p2

Object properties or other arguments to control job behavior.

v1, v2

Initial values for corresponding object properties or arguments.

Description

j = batch('aScript') runs the script aScript.m on a worker according to the scheduler defined in the default parallel configuration. The function returns j, a handle to the job object that runs the script. The script file aScript.m is added to the FileDependencies and copied to the worker.

j = batch(..., 'p1', v1, 'p2', v2, ...) allows additional parameter-value pairs that modify the behavior of the job. The accepted parameters are:

Remarks

As a matter of good programming practice, when you no longer need it, you should destroy the job created by the batch function so that it does not continue to consume cluster storage resources.

Examples

Run a batch script on a worker without using a MATLAB pool:

 j = batch('script1', 'matlabpool', 0);

Run a batch MATLAB pool job on a remote cluster, using eight workers for the MATLAB pool in addition to the worker running the batch script. This job requires a total of nine workers:

 j = batch('script1', 'matlabpool', 8);

Run a batch MATLAB pool job on a local worker, which employs two other local workers:

 j = batch('script1', 'configuration', 'local', ...
     'matlabpool', 2);

Clean up a batch job's data after you are finished with it:

destroy(j)

See Also

diary, load, wait

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS