31
Chapter 3 Interacting with Distributed Arrays Chung-Wei Chen, Department of Mathematics, National Taiwan University 2011/10/28

Chapter 3 Interacting with Distributed Arrays Chung-Wei Chen, Department of Mathematics, National Taiwan University 2011/10/28

Embed Size (px)

Citation preview

Chapter 3 Interacting with Distributed Arrays

Chung-Wei Chen, Department of Mathematics, National Taiwan University2011/10/28

Outline Introduction to Beamformer Algorithm of Beamformer Code of Beamformer How to Debug Performance Introduction to Parrallel Pipelines

Introduction to BeamformerInteracting with Distributed Arrays3

Introduction to Beamformer

Introduction to Beamformer Nb point sources Each source can emit waves of Nf different frequencies Wave emitting pattern are recorded at time t1, …, tNt

Introduction to BeamformerInteracting with Distributed Arrays4

t1 f1, …, fNf

t2

f1, …, fNf

tNt

f1, …, fNf

Source1 Source2SourceNb

f1, …, fNff1, …, fNff1, …, fNf

f1, …, fNf

Nt

Nb

Nf

Introduction to Beamformer There is a linear array of Ns sensors to detect the wave

emitting pattern

Introduction to BeamformerInteracting with Distributed Arrays5

Source1

Source2

SourceNb

Sensor1

Sensor1

SensorNs

Noise

SteeringVector

Algorithm of BeamformerInteracting with Distributed Arrays6

Algorithm of Beamformer

Algorithm of Beamformer Serial:

Algorithm of BeamformerInteracting with Distributed Arrays7

Algorithm of Beamformer Parallel:

Algorithm of BeamformerInteracting with Distributed Arrays8

Algorithm of Beamformer

Algorithm of BeamformerInteracting with Distributed Arrays9

Algorithm of Beamformer

Algorithm of BeamformerInteracting with Distributed Arrays10

Code of BeamformerInteracting with Distributed Arrays11

Code of Beamformer

Code of Beamformer (1/3)

Code of BeamformerInteracting with Distributed Arrays12

Code of Beamformer (2/3)

Code of BeamformerInteracting with Distributed Arrays13

Code of Beamformer (3/3)

Code of BeamformerInteracting with Distributed Arrays14

How to DebugInteracting with Distributed Arrays15

How to Debug

Step 1: run the program in serial on the local machine with the distributed arrays turned off

Step 2: run the program in serial on the local machine with the distributed arrays turned on

Step 3: run the program in parallel on the local machine Step 4: run the program in parallel on the remote

machine Step 5: run the program in parallel on the remote

machine but with a problem size of interest

How to DebugInteracting with Distributed Arrays16

How to Debug

How to Debug

How to DebugInteracting with Distributed Arrays17

Step 1: run the program in serial on the local machine with the distributed arrays turned off Set PARALLEL=0 Add the following line to the end of the m-file: whos X0 X1 X2 X3 X0loc X1loc X2loc x3

myI_f myV Type pBeamformer at the MATLAB prompt

This ensure the basic serial code is correct

How to DebugInteracting with Distributed Arrays18

How to Debug

Debug Step 2: run the program in serial on the local machine

with the distributed arrays turned on Set PARALLEL=1 Type eval(pRUN(‘pBeamformer’,1,{})) at the

MATLAB prompt This ensure the parallel code is correct

How to DebugInteracting with Distributed Arrays19

How to Debug

How to DebugInteracting with Distributed Arrays20

How to Debug Step 3: run the program in parallel on the local machine

Type eval(pRUN(‘pBeamformer’,4,{})) at the MATLAB prompt

Type !type MatMPI\*.out or !more MatMPI/*.out to show the output from the other MATLABs

This will detect errors introduced by communications

How to DebugInteracting with Distributed Arrays21

How to DebugInteracting with Distributed Arrays22

How to Debug

Step 4: run the program in parallel on the remote machine Type eval(pRUN(‘pBeamformer’,4,{‘machine1’ ‘machine2’})) at the MATLAB prompt

This will detect errors introduced by remote communications

Step 5: run the program in parallel on the remote machine but with a problem size of interest

How to DebugInteracting with Distributed Arrays23

How to Debug

PerformanceInteracting with Distributed Arrays24

Performance

Performance

PerformanceInteracting with Distributed Arrays25

Performance in the book

Performance of the machine Cambridge in City Cluster

Performance The loops of Stage 1 and 2 can be combined into one loop

PerformanceInteracting with Distributed Arrays26

Introduction to Parallel PipelinesInteracting with Distributed Arrays27

Introduction to Parallel Pipelines

Introduction to Parallel Pipelines

Introduction to Parallel PipelinesInteracting with Distributed Arrays28

Introduction to Parallel Pipelines

Introduction to Parallel PipelinesInteracting with Distributed Arrays29

Stage i Stage i+1

Original method

Parallel Piplines

Introduction to Parallel Pipelines

Introduction to Parallel PipelinesInteracting with Distributed Arrays30

Stage i Stage i+1

Reference

ReferenceInteracting with Distributed Arrays31

“Parallel MATLAB for Multicore and Multinode Systems”by Jeremy Kepner, SIAM Press, 2009

Thanks for your attention!