Program Communicating Jobs
Communicating jobs are those in which the workers can communicate with each other during the evaluation of their tasks. A communicating job consists of only a single task that runs simultaneously on several workers, usually with different data. More specifically, the task is duplicated on each worker, so each worker can perform the task on a different set of data, or on a particular segment of a large data set. The workers can communicate with each other as each executes its task. The function that the task runs can take advantage of a worker’s awareness of how many workers are running the job, which worker this is among those running the job, and the features that allow workers to communicate with each other.
In principle, you create and run communicating jobs similarly to the way you Program Independent Jobs:
Define and select a cluster profile.
Find a cluster.
Create a communicating job.
Create a task.
Submit the job for running. For details about what each worker performs for evaluating a task, see Submit a Job to the Job Queue.
Retrieve the results.
The differences between independent jobs and communicating jobs are summarized in the following table.
MATLAB® workers perform the tasks but do not communicate with each other.
MATLAB workers can communicate with each other during the running of their tasks.
You define any number of tasks in a job.
You define only one task in a job. Duplicates of that task run on all workers running the communicating job.
Tasks need not run simultaneously. Tasks are distributed to workers as the workers become available, so a worker can perform several of the tasks in a job.
Tasks run simultaneously, so you can run the job only on as many workers as are available at run time. The start of the job might be delayed until the required number of workers is available.
Some of the details of a communicating job and its tasks might depend on the type of scheduler you are using. The following sections discuss different schedulers and explain programming considerations: