0% found this document useful (0 votes)
15 views

Distributed Tool2

distributed tool

Uploaded by

richskitm
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Distributed Tool2

distributed tool

Uploaded by

richskitm
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

Assignment

MATLAB DISTRIBUTED COMPUTING TOOL

Name of Tool: MATLAB DISTRIBUTED COMPUTING


Brief Abstract:
My Research area is on multicore computers. With help of this tool a task is
divided into sub tasks. These subtask could be seen as a threads. Multiple threads
can be executed simultaneously. This helps to create a simulation environment of
parallel processing. The effect of parallel execution of subtasks can be realized in
distributed environment. The effect of executing parallel cores in a hardware
(multi-core environment) can be realized with help of multiple threads.

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.

Using the Tool


Program Development Guideline
 Run code normally on your local machine. First verify all your functions so
that as you progress, you are not trying to debug the functions and the
distribution at the same time. Run your functions in a single instance of
MATLAB on your local computer.
 Decide whether you need a distributed or parallel job. If your application
involves large data sets on which you need simultaneous calculations
performed, you might benefit from a parallel job with distributed arrays. If
your application involves looped or repetitive calculations that can be
performed independently of each other, a distributed job might be
appropriate.
 Modify your code for division. Decide how you want your code divided. For
a distributed job, determine how best to divide it into tasks; for example,
each iteration of a for-loop might define one task. For a parallel job,
determine how best to take advantage of parallel processing; for example,
a large array can be distributed across all your labs.
 Use interactive parallel mode (pmode) to develop parallel functionality.
Use pmode with the local scheduler to develop your functions on several
workers (labs) in parallel. As you progress and use pmode on the remote
cluster that might be all you need to complete your work.
 Run the distributed or paralleljob with a local scheduler. Create a parallel
or distributed job, and run the job using the local scheduler with several
local workers. This verifies that your code is correctly set up for batch
execution, and in the case of a distributed job, that its computations are
properly divided into tasks.
 Run the distributed job on only one cluster node. Run your distributed job
with one task to verify that remote distribution is working between your
client and the cluster, and to verify file and path dependencies.
 Run the distributed or parallel job on multiple cluster nodes. Scale up your
job to include as many tasks as you need for a distributed job, or as many
workers (labs) as you need for a parallel job.

A typical Distributed Computing Toolbox client session includes the following


steps:
Find a Job Manager (or scheduler) — Your network may have one or more job
managers available (but usually only one scheduler). The function you use to find
a job manager or scheduler creates an object in your current MATLAB session to
represent the job manager or scheduler that will run your job.
Create a Job — You create a job to hold a collection of tasks. The job exists on the
job manager (or scheduler's data location), but a job object in the local MATLAB
session represents that job.
Create Tasks — You create tasks to add to the job. Each task of a job can be
represented by a task object in your local MATLAB session.
Submit a Job to the Job Queue for Execution — When your job has all its tasks
defined, you submit it to the queue in the job manager or scheduler. The job
manager or scheduler distributes your job's tasks to the worker sessions for
evaluation. When all of the workers are completed with the job's tasks, the job
moves to the finished state.
Retrieve the Job's Results — The resulting data from the evaluation of the job is
available as a property value of each task object.
Destroy the Job — When the job is complete and all its results are gathered, you
can destroy the job to free memory resources.
Input type& corresponding output: Parallel computing can be done with help of
following ways
 Job creation using local scheduler
 Parfor
 pmode
Input type and output in above ways is discussed below one by one with example.
Evaluation of basic function:
When the job can be divided in similar subtasks
The following code uses a local scheduler on your client computer for dfeval.
results = dfeval(@sum, {[1 1] [2 2] [3 3]}, 'Configuration', 'local')
results =
[2]
[4]
[6]
 Programming basic job using local scheduler
1. Identify a scheduler.
sched = findResource('scheduler', 'type', 'local')
2. Create a job. Create job j on the scheduler
j = createJob(sched)
3. Create three tasks within the job j. Each task evaluates the sum of the array
that is passed as an input argument.
createTask(j, @sum, 1, {[1 1]})
createTask(j, @sum, 1, {[2 2]})
createTask(j, @sum, 1, {[3 3]})
4. Submit the job to the scheduler queue for evaluation. The scheduler then
distributes the job's tasks to MATLAB workers that are available for
evaluating.
submit(j);
5. Wait for the job to complete,
waitForState(j)
results = getAllOutputArguments(j)
results =
[2]
[4]
[6]
6. Destroy the job
destroy(j)

 Parfor:A parfor-loop is useful in situations where you need many loop


iterations of a simple calculation.You cannot use a parfor-loop when an
iteration in your loop depends on the results of other iterations. Each
iteration must be independent of all others.You use the function
matlabpool to reserve a number of MATLAB workers for executing a
subsequent parfor-loop.
Example:
clear A clear A
d = 0; i = 0; d = 0; i = 0;
for i = 1:4 parfor (i = 1:4)
d = i*2; d = i*2;
A(i) = d; A(i) = d;
end end
A A
d d
i i

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.

Used by other researchers


1. MATLAB: A Language for Parallel Computing
Gaurav Sharma · Jos Martin
Requirement: Advances in computer processing power have enabled easy
access to multiprocessor computers, whether through multicore
processors, clusters built from commercial, off-the shelf components, or a
combination of the two. This created demand for desktop applications such
as MATLAB to find mechanisms to exploit such architectures.
Objectives: highlight some of the salient features and provide insight into
the motivations, rationale, and eventual design decisions that went into the
feature implementation.
Parallel MATLAB constructs starting from the lowest-level constructs,
message passing functions, then present distributed arrays and parallel for
loops.
Which stage: Researchers working the area of parallel processors can use
this tool to simulate their work. The MathWorks toolset aims to provide
users with a set of constructs that can be applied to exploit various types of
parallelism with minimal effort. Thus, parfor is a way to exploit task
parallelism, while distributed arrays and parallel functions target data
parallel problems. The toolset aims to provide adequate levels of control to
end users, who can choose to use a specific subset to exploit parallelism in
their applications, from low-level message passing functions to high-level
distributed arrays and parallel loops.

2. Parallel MATLAB: Doing It Right


RON CHOY AND ALAN EDELMAN
Requirement: Elaborated about various projects who are using or have
used parallel or distributive matlab. Authors have done a survey [16] and
found through extensive Web searching 27 parallel MATLAB projects. These
projects vary in their scope: some are one-man projects that provide basic
embarrassingly parallel capabilities to MATLAB ;some are university or
government lab research projects; while some are commercial projects that
enables the use of MATLAB in product development. Also, their approaches
to making MATLAB parallel are different: some compile MATLAB scripts
into parallel native code; some provide a parallel back end to MATLAB,
using MATLAB as a graphical front end; and some others coordinate
multiple MATLAB processes to work in parallel. These projects also vary
widely in their status. Some are now defunct and exist only in the Google
Web cache, while some are entering their second or third revision.
Objectives: MATLAB is one of the most widely used tools in scientific and
technical computing. It started in the 1970s as an interactive interface to
EISPACK and LINPACK, a set of eigen value and linear system solution
routines. I MATLAB gained popularity because of its user-friendliness. It has
seen widespread use in classrooms as a teaching tool. The major features
due to which demand of distributive or parallel tool has rised are memory
model, granularity and Business Situations

You might also like