2011 AeroDef Conf - Parallel Computing on the Desktop
Transcript of 2011 AeroDef Conf - Parallel Computing on the Desktop
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
1/25
1
2011 The MathWorks, Inc.
Parallel Computing on the Desktop
Dave Forstot
Senior Application Engineer
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
2/25
2
A Question to Consider
Do you want to speed up your algorithms?
If so
Do you have a multi-core or
multi-processor computer?
Do you have a high-end
graphics processing unit (GPU)?
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
3/25
3
Introduction to the Parallel Computing Tools
Using Multi-core/Multi-processor Machines
Using Graphics Processing Units (GPUs)
Agenda
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
4/25
4
Utilizing Additional Processing Power
Built-in multithreading
In core MATLAB
For specific matrix operations
Automatically enabled since R2008a
Parallel Computing Tools
Controlled by the MATLAB user
For a variety of applications Leverage CPUs and GPUs to speed applications further
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
5/25
5
Parallel Computing on the Desktop
Use Parallel Computing Toolbox
Speed up parallel applications
on local computer
Take full advantage of desktop
power by using CPUs and GPUs
Separate computer cluster
not required
Desktop Computer
Parallel Computing Toolbox
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
6/25
6
Scale Up to Clusters, Grids and Clouds
Desktop Computer
Parallel Computing Toolbox
Computer Cluster
MATLAB Distributed Computing Server
Scheduler
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
7/257
Parallel Computing enables you to
Speed up computations Work with large data
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
Task-Parallel Data-Parallel
Task 1 Task 2 Task 3 Task 4Task 4Task 3Task 2Task 1
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
8/258
Introduction to the Parallel Computing Tools
Using Multi-core/Multi-processor Machines
Using Graphics Processing Units (GPUs)
Agenda
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
9/259
Worker Worker
Worker
Worker
WorkerWorker
Worker
WorkerTOOLBOXES
BLOCKSETS
Going Beyond Serial MATLAB Applications
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
10/2510
Programming Parallel Applications
EaseofUse
G
reaterContro
l
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
11/2511
Using Additional Cores/Processors (CPUs)
Support built into Toolboxes
E
aseofUse
G
reaterControl
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
12/2512
Example:Built-in Support for Parallelism in Other Tools
Use built-in support for
Parallel Computing Toolbox
in Optimization Toolbox
Run optimization in parallel
Use pool of MATLAB workers
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
13/2513
Other Tools ProvidingParallel Computing Support
Optimization Toolbox
Global Optimization Toolbox
Statistics Toolbox SystemTest
Simulink Design Optimization
Bioinformatics Toolbox
Model-Based Calibration Toolbox
Worker
Worker
Worker
WorkerWorker
Worker
WorkerTOOLBOXES
BLOCKSETS
Directly leverage functions in Parallel Computing Toolbox
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
14/2514
Using Additional Cores/Processors (CPUs)
Support built into Toolboxes
Simple programming constructs:
parfor
E
aseofUse
G
reaterContro
l
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
15/2515
Task 1 Task 2 Task 3 Task 4
Task Parallel Applications
Time Time
TOOLBOXES
BLOCKSETS
Worker
Worker
Worker
Worker
Task 1 Task 2 Task 3 Task 4
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
16/2516
Example:Multiple Independent Simulations
Parameter sweep of ODE
system
Use pool of MATLAB workers
Convert for to parfor
Interleave serial and
parallel code
0 5 10 15 20 25-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
Time (s)
Displacement(x)
m = 5, b = 2, k = 2
m = 5, b = 5, k = 5
0
,...2,1,...2,1
5
xkxbxm
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
17/25
18
Using Additional Cores/Processors (CPUs)
Support built into Toolboxes
Simple programming constructs:
parfor
Full control of parallelization:
jobs and tasks
E
aseofUse
G
reaterContro
l
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
18/25
19
Introduction to the Parallel Computing Tools
Using Multi-core/Multi-processor Machines
Using Graphics Processing Units (GPUs)
Agenda
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
19/25
20
Core 1
Core 3 Core 4
Core 2
Cache
Gaining Performance with More Hardware
Using More Cores (CPUs) Using GPUs
Device Memory
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
20/25
21
What is a Graphics Processing Unit (GPU)
Originally used for graphics
acceleration, now available
for scientific calculations
Parallel array of integer and
floating point processors
Dozens to hundreds of processors per card
Less flexible than regular CPU cores
Separate memory from system
* Parallel Computing Toolbox requires NVIDIA GPU with Compute Capability 1.3 or greater
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
21/25
23
Summary of Options for Targeting GPUs
Use GPU array interface with
MATLAB built-in functions
Execute custom functions on
elements of the GPU array
Create kernels from existing CUDA
code and PTX files
E
aseofUse
G
reaterContro
l
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
22/25
24
Performance: A\b with Double Precision
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
23/25
25
Performance Acceleration Options in theParallel Computing Toolbox
Technology ExampleMATLABWorkers
Execution Target
matlabpool parfor Required CPU cores
user-defined tasks createTask Required CPU cores
GPU-based
parallelismGPUArray No
NVIDIA GPU with
Compute Capability
1.3 or greater
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
24/25
26
Summary
Speed up parallel applications on desktop by using
Parallel Computing Toolbox
Take full advantage of CPU and GPU hardware
If required, use MATLAB Distributed Computing Serverto
Scale up to clusters, grids and clouds
Work with data that is too large to fit on to desktop computers
-
7/30/2019 2011 AeroDef Conf - Parallel Computing on the Desktop
25/25
27
For more information
Visit
www.mathworks.com/products/parallel-computing
http://www.mathworks.com/products/parallel-computinghttp://www.mathworks.com/products/parallel-computinghttp://www.mathworks.com/products/parallel-computinghttp://www.mathworks.com/products/parallel-computinghttp://www.mathworks.com/products/parallel-computing