Distributed Tool2
Distributed Tool2
Introduction:
MATLAB Distributed Computing tool enable you to coordinate and execute
independent MATLAB operations simultaneously on a cluster of computers,
speeding up execution of large MATLAB jobs. A job is some large operation that is
needed to perform in MATLAB session. A job is broken down into segments called
tasks. User decides how best to divide the job into tasks. Job can be divided into
identical tasks, but it’s not necessary to have identical tasks. The MATLAB session
in which the job and its tasks are defined is called the client session. Often, this is
on the machine where you program MATLAB. The client uses Distributed
Computing Toolbox to perform the definition of jobs and tasks. MATLAB
Distributed Computing Engine is the product that performs the execution of the
job by evaluating each of its tasks and returning the result to the client session.
The job manager is the part of the engine that coordinates the execution of jobs
and the evaluation of their tasks. The job manager distributes the tasks for
evaluation to the engine's individual MATLAB sessions called workers. Use of the
MathWorks job manager is optional; the distribution of tasks to workers can also
be performed by a third-party scheduler, such as Windows CCS or Platform LSF.
Distributed Tool box in Matlab has 3 components
1. Job Managers: The job manager runs jobs in the order in which they are
submitted, unless any jobs in its queue are promoted, demoted, canceled, or
destroyed.
2. Workers: Each worker receives a task of the running job from the job manager,
executes the task, returns the result to the job manager, and then receives
another task. When all tasks for a running job have been assigned to workers, the
job manager starts running the next job with the next available worker. A
MATLAB Distributed Computing Engine setup usually includes many workers that
can all execute tasks simultaneously, speeding up execution of large MATLAB
jobs. It is generally not important which worker executes a specific task. Each
worker evaluates tasks one at a time, returning the results to the job manager.
3. Clients: The job manager then returns the results of all the tasks in the job to
the client session.
Although the elements of A come out the same in both of these examples,
the value of d does not. In the for-loop above on the left, the iterations execute in
sequence, so afterward d has the value it held in the last iteration of the loop. In
the parfor-loop on the right, the iterations execute in parallel, not in sequence, so
it would be impossible to assign d a definitive value at the end of the loop.
Pmode: The interactive parallel mode (pmode) of MATLAB lets you work
interactively with a parallel job running simultaneously on several labs.
Commands you type at the pmode prompt in the Parallel Command
Window are executed on all labs at the same time. Each lab executes the
commands in its own workspace on its own variables.
When you start pmode on your local client machine with the command
pmode start local 4
Four labs start on your local machine and a parallel job is created to run on them.
The first time you run pmode with this configuration, you get a tiled display of the
four labs.The Parallel Command Window offers much of the same functionality as
the MATLAB desktop, including command line, output, and command history.
Few commands useful to handle pmode:
The labindex function returns the ID particular to each lab working on this
parallel job.
Thenumlabs function return the total number of labs working on the
current parallel job.
the darray function aggregate the array segments into a coherent array,
distributed among the labs.
Although the distributed array allows for operations on its entirety, you can
use the local function to access the portion of a distributed array on a
particular lab.
If you need the entire array in one workspace, use the gather function.
If you require distribution along a different dimension, you can use the
redistribute function.
Pmode exit for returning to normal MATLAB.