Choose Batch Processing Function
Batch processing workflows allow you to offload work to a compute cluster and free up your MATLAB® client to carry out other tasks, or submit long running code for later execution. In a batch workflow, you can close the MATLAB client session while the job is processing and retrieve information from a batch job later or in a new client session.
Batch Parallel Job Types
Parallel Computing Toolbox™ packages the MATLAB code you want to execute offline into jobs and tasks. To find out more about how Parallel Computing Toolbox runs a job, see How Parallel Computing Software Runs a Job.
There are two types of jobs you can run in a batch workflow:
Independent Jobs – execute a task in isolation on a worker, with no communication between workers.
Typically, if your code does not require a parallel pool, then you can use an independent job.
Communicating Jobs – one worker acts as the client and the other workers run the noninteractive pool. The workers can communicate with each other during the execution of their tasks.
Parallel Computing Toolbox provides the following functions to run your MATLAB code in a batch process:
For a simpler function to run communicating jobs, use the
batch function instead of the
The following diagram shows when to use the
Select Batch Function
To decide which batch processing function is right for you, consult this table.
|Functions and Approach
You want to execute a MATLAB script in the background on a cluster.
You want to use a noninteractive pool on an onsite or cloud cluster to run code including one or more of:
You have multiple independent MATLAB function calls to run in the background on a cluster. Each function does not require a parallel pool of workers.
You can create an independent task for each function call. When a task is complete, the worker moves on to the next task on the list without waiting for the other tasks to finish. You can also access intermediate results from the completed tasks.