+ All Categories
Home > Documents > Speeding up MATLAB and Simulink Applications ©...

Speeding up MATLAB and Simulink Applications ©...

Date post: 20-May-2018
Category:
Upload: nguyenliem
View: 224 times
Download: 2 times
Share this document with a friend
40
Customer Tour 2009 © 2009 The MathWorks, Inc. ® ® Speeding up MATLAB and Simulink Applications
Transcript
Page 1: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

Customer Tour 2009

© 2

009

The

Mat

hWor

ks, I

nc.

® ®

Speeding upMATLAB and Simulink Applications

Page 2: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

2

® ®

Today’s Schedule

� Introduction to Parallel Computing with MATLAB and Simulink

� Break

� Master Class on Speeding Up MATLAB – OR

� Master Class on Optimizing Simulation Performance in Simulink

Page 3: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

3

® ®

Large Problems and Large Data

Find new cancer therapies• High-quality 3-D images of

protein complexes

• Millions of projections

Computational Biology

Schematic of the 26S proteasome.

Working on this problem for 10 years…

Page 4: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

4

® ®

Large Problems and Large Data

Computational Finance

Optimize stock portfolios• High-fidelity simulations of

risk-return relationship

• Thousands of stocks

• Millions of time points

Data is too large fordesktop computer…

Page 5: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

5

® ®

Single processor

Multicore Multiprocessor ClusterGrid,Cloud

GPGPU,FPGA

High-Performance Hardware is Available

Page 6: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

6

® ®

Grids and Clouds Offer Dynamic, Large-Scale Resources

Cloud computingResizable compute capacity Cloud computingResizable compute capacity

Grid computingSharing computing and storage resources Grid computingSharing computing and storage resources

Page 7: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

7

® ®

Parallel Computing with MATLABGoals

� Simple and portable• Straightforward speed up of users’ programs • Interactive programming• Portable code

� Scalable

� Deployable

� Integrated into organization’s infrastructure

Page 8: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

8

® ®

Worker Worker

Worker

Worker

WorkerWorker

Worker

WorkerTOOLBOXES

BLOCKSETS

MATLAB Pool Extends Desktop MATLAB

Page 9: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

9

® ®

Programming Parallel MATLAB Applications

Level of control

Minimal

Some

Extensive

Level of effort

None

Straightforward

Extensive

Page 10: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

10

® ®

Programming Parallel MATLAB Applications

Support built into Toolboxes and Blocksets:

▪ Optimization Toolbox▪ Genetic Algorithm and

Direct Search Toolbox…

▪ SystemTest▪ Real Time Workshop▪ Simulink Design Optimization

Level of effort

None

Straightforward

Extensive

Page 11: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

11

® ®

Example:Built-in Support for Parallelism in Other Tools

� Use built-in support forParallel Computing Toolboxin Optimization Toolbox

� Optimize in parallelusing fmincon

� Use pool of MATLAB workers

Page 12: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

12

® ®

Example:Built-in Support for Parallelism in Other Tools

� Use built-in support forParallel Computing Toolbox inSimulink Design Optimization

� Parameter estimation of amodel in parallel

� Use pool of MATLAB workers

Page 13: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop
Page 14: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

14

® ®

Programming Parallel MATLAB Applications

Support built into Toolboxes and Blocksets:

▪ Optimization Toolbox▪ Genetic Algorithm and

Direct Search Toolbox…

▪ SystemTest▪ Real Time Workshop▪ Simulink Design Optimization

Level of effort

None

Straightforward

Extensive

Page 15: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

15

® ®

Long Computations with Independent Tasks

Task Parallelism

Time Time

Task 1 Task 2 Task 3 Task 4Task 4Task 3Task 2Task 1

Page 16: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

16

® ®

Example:Multiple Independent Simulations

� Stochastic simulations of model

� Use pool of MATLAB workers

� Convert for to parfor

Page 17: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

17

® ®

Speed up of MATLAB ProgramsMax Planck Institute

Find new cancer therapies• High-quality 3-D images of

protein complexes

• Millions of projections

Simulations run on 64MATLAB workers

"Parallel Computing Toolbox enabled us to speed up our processing by 20 to 30

times. We were able to use our cluster from MATLAB without having to be experts in

parallel programming or having to learn another pro gramming language."

Andreas Korinek

Max Planck Institute of Biochemistry

Page 18: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

18

® ®

Programming Parallel MATLAB Applications

Support built into Toolboxes and Blocksets

Simple programming constructs:

parfor

Level of effort

None

Straightforward

Extensive

Page 19: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

19

® ®

11 26 41

12 27 42

13 28 43

11 26 41

12 27 42

13 28 43

14 29 44

15 30 45

16 31 46

17 32 47

17 33 48

19 34 49

20 35 50

21 36 51

22 37 52

Large Data Problems

Page 20: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

20

® ®

11 26 41

12 27 42

13 28 43

14 29 44

15 30 45

16 31 46

17 32 47

17 33 48

19 34 49

20 35 50

21 36 51

22 37 52

Large Data Problems

11 26 41

12 27 42

13 28 43

14 29 44

15 30 45

16 31 46

17 32 47

17 33 48

19 34 49

20 35 50

21 36 51

22 37 52

Data Parallelism

Page 21: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

21

® ®

Example:Multiple Independent Simulations

� Use pool of MATLAB workers

� Distribute dataacross computers

� Run functions and matrixoperations in parallel

Page 22: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

22

® ®

Programming Parallel MATLAB Applications

Support built into Toolboxes and Blocksets

Simple programming constructs:

parfor

Full control of parallelization:job and task

MATLAB and MPI

distributed arrayspmd

Level of effort

None

Straightforward

Extensive

Page 23: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

23

® ®

Parallel Computing with MATLABGoals

� Simple and portable

� Scalable • Support parallelism on desktop• Treat large resources as extensions of desktop

� Deployable

� Integrated into organization’s infrastructure

Page 24: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

24

® ®

Run 8 Local Workers on DesktopParallel Computing Toolbox

Desktop Computer

Parallel Computing ToolboxParallel Computing Toolbox

Page 25: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

25

® ®

Computer ClusterComputer Cluster

MATLAB Distributed Computing ServerMATLAB Distributed Computing Server

Scheduler

Scale up with No Code ChangesMATLAB Distributed Computing Server

Desktop Computer

Parallel Computing ToolboxParallel Computing Toolbox

Page 26: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

26

® ®

Extend Desktop to the Grid and Cloud

Desktop Computer

Parallel Computing ToolboxParallel Computing Toolbox

Page 27: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

27

® ®

“I wrote and debugged my program by using multiple MATLAB workers on a workstation. I then ran it on the EGEE Grid and reduced computation time from 5 days to just 6 hours.”

Pavel IvanovOptics Group, University of Bristol

Page 28: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

28

® ®

Example:Multiple Independent Simulations on Amazon EC2

� Stochastic simulations of model

� Use pool of MATLAB workers

� Convert for to parfor

Page 29: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

29

® ®

Parallel Computing with MATLABGoals

� Simple and portable

� Scalable

� Deployable � Simple path from development to enterprise systems

� Integrated into organization’s infrastructure

Page 30: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

30

® ®

Deployment of MATLAB Applications

Share application with others who do not use MATLAB � Standalone executables or components (C++, Java, C#, etc.)

� Royalty-free distribution

PTG shaker rig.

Oil Exploration

MRI imaging

Parallelqqqq

Page 31: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

31

® ®

PTG shaker rig.

Oil Exploration

MRI imaging

Page 32: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

32

® ®

Parallel Computing with MATLABGoals

� Simple and portable

� Scalable

� Deployable

� Integrated into organization’s infrastructure� Dynamic licensing� Support for third-party schedulers

Page 33: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

33

® ®

Desktop Computer

Parallel Computing ToolboxParallel Computing Toolbox

LicensingParallel Computing Tools

Cluster, Grid or CloudCluster, Grid or Cloud

MATLAB Distributed Computing ServerMATLAB Distributed Computing Server

Scheduler

Page 34: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

34

® ®

LicensingMATLAB Distributed Computing Server

� Only product required on cluster

� All-product installation

� One license key per worker� Not per core, processor, …

� Available in worker packs of 8, 16, 32, 64, …

Cluster, Grid or CloudCluster, Grid or Cloud

MATLAB Distributed Computing ServerMATLAB Distributed Computing Server

Scheduler

Page 35: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

35

® ®

Dynamic LicensingAccess by Multiple Users

� Users have access totheir licensed products

� Cluster is extensionof desktop

� Can exit MATLABafter submitting work

Cluster, Grid or CloudCluster, Grid or Cloud

MATLAB Distributed Computing ServerMATLAB Distributed Computing Server

Scheduler

Page 36: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

36

® ®

Support for Schedulers

� Integrated with product� MathWorks job manager

� Supported by product� Platform LSF� Windows HPC Server 2008 (and CCS 2003)� PBS family

� PBS Professional� TORQUE

� Open API for other schedulers� Sun Grid Engine� gLite� …

Page 37: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

37

® ®

Works on all PlatformsSupported by MATLAB

Page 38: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

38

® ®

Parallel Computing with MATLAB

Simple and portable• Straightforward program speed up• Interactive parallel programming• Portable code

Scalable• Support parallelism on desktop• Treat large resource as

extensions of desktop

Deployable• Simple path from development

to enterprise systems

Integrated into organization• Dynamic licensing• Support for third-party

schedulers

Page 39: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

39

® ®

Today’s Schedule

� Introduction to Parallel Computing with MATLAB and Simulink

� Break

� Master Class on Speeding Up MATLAB – OR

� Master Class on Optimizing Simulation Performance in Simulink

Page 40: Speeding up MATLAB and Simulink Applications © …modb.oce.ulg.ac.be/wiki/upload/matlabtutos/HPC_stan...Genetic Algorithm and Direct Search Toolbox … SystemTest Real Time Workshop

Customer Tour 2009

© 2

009

The

Mat

hWor

ks, I

nc.

® ®


Recommended