SlideShare a Scribd company logo
Dhammpal Ramtake
SoS in Computer sciences & IT
Pt. R.S.U. Raipur, (C.G)
Guided by
Dr. Sanjay Kumar
Dr. Vinod Kumar Patle
Contents
INTRODUCTION OF MATLAB
 INTRODUCTION OF PARALLEL COMPUTING
 PARALLEL COMPUTING WITH MATLAB
 MATLAB FOR MULTI CORE SYSTEM
 MATLAB FOR DISTRIBUTED COMPUTING SERVER
PARALLEL COMANDS IN MATLAB
TEST THE EFFICINCY OF PARALLEL CODE
CONCLUSION
Introduction
• MATLAB is a high-level technical computing language and interactive
environment for algorithm development, data visualization, data analysis, and
numeric computation. Using the MATLAB we can solve computing problems
faster than with traditional programming languages, such as C, C++, and
Fortran.
• We can use MATLAB in a wide range of applications, including signal and
image processing, communications, control design, test and
measurement, financial modeling and analysis ,computational biology and
parallel computing.
MATLAB Environment
 Generally, computer code is written in serial
 One task completed after another until the script is finished with
only one task completing at each time
 Because computer only has single processing unit .
What is Parallel Computing?
What is Parallel Computing? (cont.)
 Parallel Computing:
Using multiple computer processing units (CPUs) to solve a problem at the same
time.
computer with multiple processors or networked computers(Distributed
computing )
PARALLEL MATLAB
Single Multi Core
CPU
Distributed Computing
Server
Number of core on
single machine as a
worker to execute
a task parallel like
OpenMP
Client machine having
there core which is take as
workers in network with
central control of server .
PARALLEL COMPUTING WITH MATLAB
MATLAB provide Parallel computing tool for Distributed Computing Server as
well as Single desktop .
MATLAB FOR MULTI CORE SYSTEM
 MATLAB Provides workers (MATLAB computational engines) to
execute applications on a multi core system.
 We can write a commands that will be executed in parallel or call
an MATLAB script file that will run in parallel
Fig:- MATLAB workers for multi core processor
MATLAB FOR DISTRIBUTED COMPUTING SERVER
The Distributed Computing Server controls parallel execution of MATLAB on a
cluster with tens or hundreds of cores
With a cluster running parallel MATLAB, we can submit an Matlab file from a client, to
run on the cluster or we can submit an Matlab file to be executed in “batch"
Fig:- MATLAB Distributed Computing Server
PARALLEL COMMANDS IN MATLAB
 findResource
 Code performaces commands
tic & toc , cputime,profile viewer etc.
 Matlabpool
 parfor (for loop)
 pmode
 spmd (distributed computing for datasets)
 batch jobs (run job in background)
1. FIND RESOURCE
This command give available parallel computing resources
Syntax
out = findResource()
out =findResource('scheduler','configuration','ConfigurationName')
Code Performance Commands
Use MATLAB’s tic & toc functions tic starts a timer toc tells you the number of
seconds since the tic function was called.
1. TIC & TOC
Syntax
tic
ticID = tic
toc
toc(ticID)
elapsedTime = toc
Example :-
2. CPU TIME
This command returns the total CPU time (in seconds) used by MATLAB
application from the time it was started
Syntax
cputime
Out= cputime
Example
1. PROFILE VIEWER
This command gives profile records information about execution time, number of
calls, parent functions, child functions, code line hit count, and code line
execution time.
Syntax: -
profile on;
profile off;
profile resume;
profile clear;
profile viewer;
Example:-
PROFILE VIEWER WINDOW
MATLABPOOL
This command open or close pool of MATLAB sessions for parallel computation .It
starts a worker pool using the default parallel configuration, with the pool size
specified by configuration.
Syntax
matlabpool
matlabpool open
matlabpool open poolsize
matlabpool open configname
matlabpool close
matlabpool close force
matlabpool close force configname
Example:-
 Request for too many workers, get an error
only request 2 workers on this machine!
Matlabpool Close
 Use matlabpool close to end parallel session
 Options
 matlabpool close force
 deletes all pool jobs for current user in the cluster specified by default
profile (including running jobs)
 matlabpool close force <profilename>
 deletes all pool jobs run in the specified profile
Parallel for Loops (parfor)
 parfor loops can execute for loop like code in parallel to significantly improve
performance
 Must consist of code broken into discrete parts that can be solved simultaneously (i.e. it
can’t be serial)
 Matlab workers evaluate iterations in no particular order and independently
of each other.
Syntax
parfor loopvar = initval:endval; statements; end
parfor (loopvar = initval:endval, M); statements; end
Parfor example
work in parallel loop increments are not dependent on each
other:
Makes the loop run in
parallel
Test the efficiency of parallel code
Observed speedup of a code which has been parallelized
defined as :-
Execution time of Serial code
Execution time of parallel code
Speedup =
One of the simplest and widely used speedup formula for parallel programs
performances.
For the testing the efficiency of parfor loop we considered prime number
finding program .which limits is increasing ordered like 10 ,100,1000,10000
and 100000 iteration
Simple for loop program :-
function [ total ] = simpleprime( n )
%SIMPLEPRIME Summary of this
function goes here
% Detailed explanation goes here
total = 0 ;
tic
for i = 2 : n
prime = 1 ;
for j = 2 : i-1
if( mod ( i , j ) == 0 )
prime = 0 ;
end
end
total = total + prime ;
end
toc
return
end
n=10;
while ( n <= 10000)
primes = newprime( n ) ;
fprintf( 1 , ' %8d %8d n ' , n
, primes ) ;
n = n * 10 ;
Function call
Program Output :-
parallel for (parfor)loop program :-
matlabpool open local 2
n=10;
while ( n <= 100000)
primes = newprime( n ) ;
fprintf( 1 , ' %8d %8d n ' , n
, primes ) ;
n = n * 10 ;
end
matlabpool close
function [ total ] = newprime( n )
%NEWPRIME Summary of this
function goes here
% Detailed explanation goes here
total = 0 ;
tic
parfor i = 2 : n
prime = 1 ;
for j = 2 : i-1
if( mod ( i , j ) == 0 )
prime = 0 ;
end
end
total = total + prime ;
end
toc
return
end
Function call
Program Output :-
Problem size Serial
execution
time
Parallel
execution
time
speedup
10 0.529376 0.320184 1.6533
100 0.009848 0.063059 0.1561
1000 0.023988 0.067858 0.3535
10000 2.009835 1.168925 1.7193
100000 200.9593 109.9775 1.8272
Result Table :-
Pmode
pmode allows the interactive parallel execution of MATLAB commands. pmode
achieves this by defining and submitting a parallel job, and opening a Parallel
Command Window connected to the labs running the job.
Syntax:-
pmode start
pmode start numlabs
pmode start conf numlabs
pmode quit
pmode exit
Example:-
Pmode with labindex
while ( n <= 10000)
primes = newprime( n ) ;
fprintf( 1 , ' %8d %8d n ' , n
, primes ) ;
if labindex==1
n = n * 10 ;
else
n =n*20;
end
end
function [ total ] = newprime( n )
%NEWPRIME Summary of this function
goes here
% Detailed explanation goes here
total = 0 ;
tic
Parfor i = 2 : n
prime = 1 ;
for j = 2 : i-1
if( mod ( i , j ) == 0 )
prime = 0 ;
end
end
total = total + prime ;
end
toc
return
end
Function call
Pmode output window : -
Spmd command
Spmd “Single program multiple data” execute code in parallel on MATLAB pool
The "single program" aspect of spmd means that the identical code runs on
multiple labs.
The "multiple data" aspect means that even though the spmd statement runs
identical code on all labs, each lab can have different, unique data for that code.
Syntax
spmd, statements, end
spmd(n), statements, end
spmd(m, n), statements, end
For example, create a random matrix on three labs:
matlabpool open
spmd (2)
R = rand(4,4);
end
matlabpool close
Simple example of spmd with 2 lab
Conclusion
MATLAB Parallel computing toolbox has the large number of
functionality .Which is essay to understand and solve the complex
parallel computing problems .
Thank You

More Related Content

What's hot

Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4
Randa Elanwar
 
Matlab Workshop Presentation
Matlab Workshop PresentationMatlab Workshop Presentation
Matlab Workshop Presentation
Jairo Maldonado-Contreras
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Mohan Raj
 
Basics of matlab
Basics of matlabBasics of matlab
Basics of matlabAnil Maurya
 
MATLAB INTRODUCTION
MATLAB INTRODUCTIONMATLAB INTRODUCTION
MATLAB INTRODUCTION
Dr. Krishna Mohbey
 
Matlab Introduction
Matlab IntroductionMatlab Introduction
Matlab Introduction
Daniel Moore
 
Matlab Functions
Matlab FunctionsMatlab Functions
Matlab Functions
Umer Azeem
 
Matlab basic and image
Matlab basic and imageMatlab basic and image
Matlab basic and image
Divyanshu Rasauria
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Ravikiran A
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Damian T. Gordon
 
Brief Introduction to Matlab
Brief  Introduction to MatlabBrief  Introduction to Matlab
Brief Introduction to Matlab
Tariq kanher
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
Murshida ck
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
BilawalBaloch1
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Bhavesh Shah
 
Fundamentals of matlab
Fundamentals of matlabFundamentals of matlab
Fundamentals of matlab
Narendra Kumar Jangid
 
Introduction to-matlab
Introduction to-matlabIntroduction to-matlab
Intro automata theory
Intro automata theory Intro automata theory
Intro automata theory
Rajendran
 
How to work on Matlab.......
How to work on Matlab.......How to work on Matlab.......
How to work on Matlab.......biinoida
 
Matlab m files and scripts
Matlab m files and scriptsMatlab m files and scripts
Matlab m files and scripts
Ameen San
 
Introduction to Latex
Introduction to LatexIntroduction to Latex
Introduction to Latex
Mohamed Alrshah
 

What's hot (20)

Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4
 
Matlab Workshop Presentation
Matlab Workshop PresentationMatlab Workshop Presentation
Matlab Workshop Presentation
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Basics of matlab
Basics of matlabBasics of matlab
Basics of matlab
 
MATLAB INTRODUCTION
MATLAB INTRODUCTIONMATLAB INTRODUCTION
MATLAB INTRODUCTION
 
Matlab Introduction
Matlab IntroductionMatlab Introduction
Matlab Introduction
 
Matlab Functions
Matlab FunctionsMatlab Functions
Matlab Functions
 
Matlab basic and image
Matlab basic and imageMatlab basic and image
Matlab basic and image
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Brief Introduction to Matlab
Brief  Introduction to MatlabBrief  Introduction to Matlab
Brief Introduction to Matlab
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Fundamentals of matlab
Fundamentals of matlabFundamentals of matlab
Fundamentals of matlab
 
Introduction to-matlab
Introduction to-matlabIntroduction to-matlab
Introduction to-matlab
 
Intro automata theory
Intro automata theory Intro automata theory
Intro automata theory
 
How to work on Matlab.......
How to work on Matlab.......How to work on Matlab.......
How to work on Matlab.......
 
Matlab m files and scripts
Matlab m files and scriptsMatlab m files and scripts
Matlab m files and scripts
 
Introduction to Latex
Introduction to LatexIntroduction to Latex
Introduction to Latex
 

Similar to Matlab ppt

Matlab for diploma students(1)
Matlab for diploma students(1)Matlab for diploma students(1)
Matlab for diploma students(1)
Retheesh Raj
 
Matlab-3.pptx
Matlab-3.pptxMatlab-3.pptx
Matlab-3.pptx
aboma2hawi
 
Migration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming ModelsMigration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming Models
Zvi Avraham
 
Basic concept of MATLAB.ppt
Basic concept of MATLAB.pptBasic concept of MATLAB.ppt
Basic concept of MATLAB.ppt
aliraza2732
 
Parallel Programming on the ANDC cluster
Parallel Programming on the ANDC clusterParallel Programming on the ANDC cluster
Parallel Programming on the ANDC cluster
Sudhang Shankar
 
Parallel Programming
Parallel ProgrammingParallel Programming
Parallel Programming
Roman Okolovich
 
Matopt
MatoptMatopt
MapReduce: teoria e prática
MapReduce: teoria e práticaMapReduce: teoria e prática
MapReduce: teoria e prática
PET Computação
 
Background Jobs - Com BackgrounDRb
Background Jobs - Com BackgrounDRbBackground Jobs - Com BackgrounDRb
Background Jobs - Com BackgrounDRbJuan Maiz
 
interfacing matlab with embedded systems
interfacing matlab with embedded systemsinterfacing matlab with embedded systems
interfacing matlab with embedded systems
Raghav Shetty
 
Distributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation ProjectDistributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation ProjectAssignmentpedia
 
Distributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation ProjectDistributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation ProjectAssignmentpedia
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorialhughpearse
 
Matlab - Introduction and Basics
Matlab - Introduction and BasicsMatlab - Introduction and Basics
Matlab - Introduction and Basics
Techsparks
 
GTC16 - S6410 - Comparing OpenACC 2.5 and OpenMP 4.5
GTC16 - S6410 - Comparing OpenACC 2.5 and OpenMP 4.5GTC16 - S6410 - Comparing OpenACC 2.5 and OpenMP 4.5
GTC16 - S6410 - Comparing OpenACC 2.5 and OpenMP 4.5
Jeff Larkin
 
Introduction to MPI
Introduction to MPIIntroduction to MPI
Introduction to MPI
yaman dua
 
Introduction to OpenMP
Introduction to OpenMPIntroduction to OpenMP
Introduction to OpenMP
Akhila Prabhakaran
 

Similar to Matlab ppt (20)

Matlab for diploma students(1)
Matlab for diploma students(1)Matlab for diploma students(1)
Matlab for diploma students(1)
 
Matlab summary
Matlab summaryMatlab summary
Matlab summary
 
Matlab tut2
Matlab tut2Matlab tut2
Matlab tut2
 
Matlab-3.pptx
Matlab-3.pptxMatlab-3.pptx
Matlab-3.pptx
 
Migration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming ModelsMigration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming Models
 
Basic concept of MATLAB.ppt
Basic concept of MATLAB.pptBasic concept of MATLAB.ppt
Basic concept of MATLAB.ppt
 
Parallel Programming on the ANDC cluster
Parallel Programming on the ANDC clusterParallel Programming on the ANDC cluster
Parallel Programming on the ANDC cluster
 
Parallel Programming
Parallel ProgrammingParallel Programming
Parallel Programming
 
Matopt
MatoptMatopt
Matopt
 
MapReduce: teoria e prática
MapReduce: teoria e práticaMapReduce: teoria e prática
MapReduce: teoria e prática
 
Background Jobs - Com BackgrounDRb
Background Jobs - Com BackgrounDRbBackground Jobs - Com BackgrounDRb
Background Jobs - Com BackgrounDRb
 
interfacing matlab with embedded systems
interfacing matlab with embedded systemsinterfacing matlab with embedded systems
interfacing matlab with embedded systems
 
Distributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation ProjectDistributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation Project
 
Distributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation ProjectDistributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation Project
 
Oct.22nd.Presentation.Final
Oct.22nd.Presentation.FinalOct.22nd.Presentation.Final
Oct.22nd.Presentation.Final
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorial
 
Matlab - Introduction and Basics
Matlab - Introduction and BasicsMatlab - Introduction and Basics
Matlab - Introduction and Basics
 
GTC16 - S6410 - Comparing OpenACC 2.5 and OpenMP 4.5
GTC16 - S6410 - Comparing OpenACC 2.5 and OpenMP 4.5GTC16 - S6410 - Comparing OpenACC 2.5 and OpenMP 4.5
GTC16 - S6410 - Comparing OpenACC 2.5 and OpenMP 4.5
 
Introduction to MPI
Introduction to MPIIntroduction to MPI
Introduction to MPI
 
Introduction to OpenMP
Introduction to OpenMPIntroduction to OpenMP
Introduction to OpenMP
 

Recently uploaded

Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 

Recently uploaded (20)

Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 

Matlab ppt

  • 1. Dhammpal Ramtake SoS in Computer sciences & IT Pt. R.S.U. Raipur, (C.G) Guided by Dr. Sanjay Kumar Dr. Vinod Kumar Patle
  • 2. Contents INTRODUCTION OF MATLAB  INTRODUCTION OF PARALLEL COMPUTING  PARALLEL COMPUTING WITH MATLAB  MATLAB FOR MULTI CORE SYSTEM  MATLAB FOR DISTRIBUTED COMPUTING SERVER PARALLEL COMANDS IN MATLAB TEST THE EFFICINCY OF PARALLEL CODE CONCLUSION
  • 3. Introduction • MATLAB is a high-level technical computing language and interactive environment for algorithm development, data visualization, data analysis, and numeric computation. Using the MATLAB we can solve computing problems faster than with traditional programming languages, such as C, C++, and Fortran. • We can use MATLAB in a wide range of applications, including signal and image processing, communications, control design, test and measurement, financial modeling and analysis ,computational biology and parallel computing.
  • 5.  Generally, computer code is written in serial  One task completed after another until the script is finished with only one task completing at each time  Because computer only has single processing unit . What is Parallel Computing?
  • 6. What is Parallel Computing? (cont.)  Parallel Computing: Using multiple computer processing units (CPUs) to solve a problem at the same time. computer with multiple processors or networked computers(Distributed computing )
  • 7. PARALLEL MATLAB Single Multi Core CPU Distributed Computing Server Number of core on single machine as a worker to execute a task parallel like OpenMP Client machine having there core which is take as workers in network with central control of server . PARALLEL COMPUTING WITH MATLAB MATLAB provide Parallel computing tool for Distributed Computing Server as well as Single desktop .
  • 8. MATLAB FOR MULTI CORE SYSTEM  MATLAB Provides workers (MATLAB computational engines) to execute applications on a multi core system.  We can write a commands that will be executed in parallel or call an MATLAB script file that will run in parallel Fig:- MATLAB workers for multi core processor
  • 9. MATLAB FOR DISTRIBUTED COMPUTING SERVER The Distributed Computing Server controls parallel execution of MATLAB on a cluster with tens or hundreds of cores With a cluster running parallel MATLAB, we can submit an Matlab file from a client, to run on the cluster or we can submit an Matlab file to be executed in “batch" Fig:- MATLAB Distributed Computing Server
  • 10. PARALLEL COMMANDS IN MATLAB  findResource  Code performaces commands tic & toc , cputime,profile viewer etc.  Matlabpool  parfor (for loop)  pmode  spmd (distributed computing for datasets)  batch jobs (run job in background)
  • 11. 1. FIND RESOURCE This command give available parallel computing resources Syntax out = findResource() out =findResource('scheduler','configuration','ConfigurationName')
  • 12. Code Performance Commands Use MATLAB’s tic & toc functions tic starts a timer toc tells you the number of seconds since the tic function was called. 1. TIC & TOC Syntax tic ticID = tic toc toc(ticID) elapsedTime = toc Example :-
  • 13. 2. CPU TIME This command returns the total CPU time (in seconds) used by MATLAB application from the time it was started Syntax cputime Out= cputime Example
  • 14. 1. PROFILE VIEWER This command gives profile records information about execution time, number of calls, parent functions, child functions, code line hit count, and code line execution time. Syntax: - profile on; profile off; profile resume; profile clear; profile viewer; Example:-
  • 16. MATLABPOOL This command open or close pool of MATLAB sessions for parallel computation .It starts a worker pool using the default parallel configuration, with the pool size specified by configuration. Syntax matlabpool matlabpool open matlabpool open poolsize matlabpool open configname matlabpool close matlabpool close force matlabpool close force configname Example:-
  • 17.  Request for too many workers, get an error only request 2 workers on this machine!
  • 18. Matlabpool Close  Use matlabpool close to end parallel session  Options  matlabpool close force  deletes all pool jobs for current user in the cluster specified by default profile (including running jobs)  matlabpool close force <profilename>  deletes all pool jobs run in the specified profile
  • 19. Parallel for Loops (parfor)  parfor loops can execute for loop like code in parallel to significantly improve performance  Must consist of code broken into discrete parts that can be solved simultaneously (i.e. it can’t be serial)  Matlab workers evaluate iterations in no particular order and independently of each other. Syntax parfor loopvar = initval:endval; statements; end parfor (loopvar = initval:endval, M); statements; end
  • 20. Parfor example work in parallel loop increments are not dependent on each other: Makes the loop run in parallel
  • 21. Test the efficiency of parallel code Observed speedup of a code which has been parallelized defined as :- Execution time of Serial code Execution time of parallel code Speedup = One of the simplest and widely used speedup formula for parallel programs performances. For the testing the efficiency of parfor loop we considered prime number finding program .which limits is increasing ordered like 10 ,100,1000,10000 and 100000 iteration
  • 22. Simple for loop program :- function [ total ] = simpleprime( n ) %SIMPLEPRIME Summary of this function goes here % Detailed explanation goes here total = 0 ; tic for i = 2 : n prime = 1 ; for j = 2 : i-1 if( mod ( i , j ) == 0 ) prime = 0 ; end end total = total + prime ; end toc return end n=10; while ( n <= 10000) primes = newprime( n ) ; fprintf( 1 , ' %8d %8d n ' , n , primes ) ; n = n * 10 ; Function call
  • 24. parallel for (parfor)loop program :- matlabpool open local 2 n=10; while ( n <= 100000) primes = newprime( n ) ; fprintf( 1 , ' %8d %8d n ' , n , primes ) ; n = n * 10 ; end matlabpool close function [ total ] = newprime( n ) %NEWPRIME Summary of this function goes here % Detailed explanation goes here total = 0 ; tic parfor i = 2 : n prime = 1 ; for j = 2 : i-1 if( mod ( i , j ) == 0 ) prime = 0 ; end end total = total + prime ; end toc return end Function call
  • 26. Problem size Serial execution time Parallel execution time speedup 10 0.529376 0.320184 1.6533 100 0.009848 0.063059 0.1561 1000 0.023988 0.067858 0.3535 10000 2.009835 1.168925 1.7193 100000 200.9593 109.9775 1.8272 Result Table :-
  • 27. Pmode pmode allows the interactive parallel execution of MATLAB commands. pmode achieves this by defining and submitting a parallel job, and opening a Parallel Command Window connected to the labs running the job. Syntax:- pmode start pmode start numlabs pmode start conf numlabs pmode quit pmode exit Example:-
  • 28. Pmode with labindex while ( n <= 10000) primes = newprime( n ) ; fprintf( 1 , ' %8d %8d n ' , n , primes ) ; if labindex==1 n = n * 10 ; else n =n*20; end end function [ total ] = newprime( n ) %NEWPRIME Summary of this function goes here % Detailed explanation goes here total = 0 ; tic Parfor i = 2 : n prime = 1 ; for j = 2 : i-1 if( mod ( i , j ) == 0 ) prime = 0 ; end end total = total + prime ; end toc return end Function call
  • 30. Spmd command Spmd “Single program multiple data” execute code in parallel on MATLAB pool The "single program" aspect of spmd means that the identical code runs on multiple labs. The "multiple data" aspect means that even though the spmd statement runs identical code on all labs, each lab can have different, unique data for that code. Syntax spmd, statements, end spmd(n), statements, end spmd(m, n), statements, end For example, create a random matrix on three labs: matlabpool open spmd (2) R = rand(4,4); end matlabpool close
  • 31. Simple example of spmd with 2 lab
  • 32. Conclusion MATLAB Parallel computing toolbox has the large number of functionality .Which is essay to understand and solve the complex parallel computing problems .