Professional Documents
Culture Documents
A Question to Consider
Agenda
Built-in multithreading
In core MATLAB For specific matrix operations Automatically enabled since R2008a
Desktop Computer
Scheduler
Task-Parallel
Data-Parallel
Speed up computations
Task 1
Task 2
Task 3
Task 4
Agenda
Worker
Worker Worker
TOOLBOXES
Worker Worker
BLOCKSETS
Worker
Worker
Worker
Greater Control
Ease of Use
10
Greater Control
11
Example:
Built-in Support for Parallelism in Other Tools
12
Optimization Toolbox Global Optimization Toolbox Statistics Toolbox SystemTest Simulink Design Optimization Bioinformatics Toolbox Model-Based Calibration Toolbox
Worker
Worker
TOOLBOXES BLOCKSETS
Worker Worker
Worker
Worker
Worker
Greater Control
parfor
14
Worker
TOOLBOXES
BLOCKSETS
Worker Worker
Worker
Task 1
Task 2
Task 3
Task 4
Time
Time
15
Example:
Multiple Independent Simulations
1.2 1 0.8
Displacement (x)
Parameter sweep of ODE system Use pool of MATLAB workers Convert for to parfor Interleave serial and parallel code
m = 5, b = 2, k = 2
m = 5, b = 5, k = 5
0 5 10 15 20 25
-0.4
Time (s)
5 m b x k x 0 x 1, 2,... 1, 2 ,...
16
Greater Control
parfor
Full control of parallelization:
18
Agenda
19
Core 1
Core 2
Core 3 Cache
20
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
* Parallel Computing Toolbox requires NVIDIA GPU with Compute Capability 1.3 or greater
Ease of Use
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
Greater Control
23
24
MATLAB Workers
Required
Execution Target
matlabpool
CPU cores
user-defined tasks
createTask
Required
CPU cores
GPU-based parallelism
GPUArray
No
25
Summary
26
Visit www.mathworks.com/products/parallel-computing
27