Speeding up MATLAB and Simulink Applications ©...

Post on 20-May-2018

224 views 2 download

transcript

Customer Tour 2009

© 2

009

The

Mat

hWor

ks, I

nc.

® ®

Speeding upMATLAB and Simulink Applications

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

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…

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…

5

® ®

Single processor

Multicore Multiprocessor ClusterGrid,Cloud

GPGPU,FPGA

High-Performance Hardware is Available

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

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

8

® ®

Worker Worker

Worker

Worker

WorkerWorker

Worker

WorkerTOOLBOXES

BLOCKSETS

MATLAB Pool Extends Desktop MATLAB

9

® ®

Programming Parallel MATLAB Applications

Level of control

Minimal

Some

Extensive

Level of effort

None

Straightforward

Extensive

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

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

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

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

15

® ®

Long Computations with Independent Tasks

Task Parallelism

Time Time

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

16

® ®

Example:Multiple Independent Simulations

� Stochastic simulations of model

� Use pool of MATLAB workers

� Convert for to parfor

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

18

® ®

Programming Parallel MATLAB Applications

Support built into Toolboxes and Blocksets

Simple programming constructs:

parfor

Level of effort

None

Straightforward

Extensive

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

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

21

® ®

Example:Multiple Independent Simulations

� Use pool of MATLAB workers

� Distribute dataacross computers

� Run functions and matrixoperations in parallel

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

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

24

® ®

Run 8 Local Workers on DesktopParallel Computing Toolbox

Desktop Computer

Parallel Computing ToolboxParallel Computing Toolbox

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

26

® ®

Extend Desktop to the Grid and Cloud

Desktop Computer

Parallel Computing ToolboxParallel Computing Toolbox

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

28

® ®

Example:Multiple Independent Simulations on Amazon EC2

� Stochastic simulations of model

� Use pool of MATLAB workers

� Convert for to parfor

29

® ®

Parallel Computing with MATLABGoals

� Simple and portable

� Scalable

� Deployable � Simple path from development to enterprise systems

� Integrated into organization’s infrastructure

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

31

® ®

PTG shaker rig.

Oil Exploration

MRI imaging

32

® ®

Parallel Computing with MATLABGoals

� Simple and portable

� Scalable

� Deployable

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

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

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

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

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� …

37

® ®

Works on all PlatformsSupported by MATLAB

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

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

Customer Tour 2009

© 2

009

The

Mat

hWor

ks, I

nc.

® ®