310 likes | 401 Views
Chapter 3 Interacting with Distributed Arrays. Chung-Wei Chen , Department of Mathematics, National Taiwan University 2011/10/28. Outline. Introduction to Beamformer Algorithm of Beamformer Code of Beamformer How to Debug Performance Introduction to Parrallel Pipelines.
E N D
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 Beamformer Interacting with Distributed Arrays
Introduction to Beamformer • Nbpoint sources • Each source can emit waves ofNf different frequencies • Wave emitting pattern are recorded at time t1, …, tNt SourceNb Source1 Source2 t1 f1, …,fNf f1, …,fNf f1, …,fNf Nt t2 f1, …,fNf Nf Nb tNt f1, …,fNf f1, …,fNf f1, …,fNf Interacting with Distributed Arrays
Introduction to Beamformer • There is a linear array of Ns sensors to detect the wave emitting pattern Steering Vector Sensor1 Noise Source1 Sensor1 Source2 SourceNb SensorNs Interacting with Distributed Arrays
Algorithm of Beamformer Interacting with Distributed Arrays
Algorithm of Beamformer • Serial: Interacting with Distributed Arrays
Algorithm of Beamformer • Parallel: Interacting with Distributed Arrays
Algorithm of Beamformer Interacting with Distributed Arrays
Algorithm of Beamformer Interacting with Distributed Arrays
Code of Beamformer Interacting with Distributed Arrays
Code of Beamformer (1/3) Interacting with Distributed Arrays
Code of Beamformer(2/3) Interacting with Distributed Arrays
Code of Beamformer(3/3) Interacting with Distributed Arrays
How to Debug Interacting with Distributed Arrays
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 Interacting with Distributed Arrays
How to Debug • 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_fmyV • Type pBeamformer at the MATLAB prompt • This ensure the basic serial code is correct Interacting with Distributed Arrays
How to Debug Interacting with Distributed Arrays
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 Interacting with Distributed Arrays
How to Debug Interacting with Distributed Arrays
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 Interacting with Distributed Arrays
How to Debug Interacting with Distributed Arrays
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 Interacting with Distributed Arrays
Performance Interacting with Distributed Arrays
Performance • Performance in the book • Performance of the machine Cambridge in City Cluster Interacting with Distributed Arrays
Performance • The loops of Stage 1 and 2 can be combined into one loop Interacting with Distributed Arrays
Introduction to Parallel Pipelines Interacting with Distributed Arrays
Introduction to Parallel Pipelines Interacting with Distributed Arrays
Introduction to Parallel Pipelines • Original method Stage i Stage i+1 Interacting with Distributed Arrays
Introduction to Parallel Pipelines • Parallel Piplines Stage i Stage i+1 Interacting with Distributed Arrays
Reference • “Parallel MATLAB for Multicore and MultinodeSystems”by Jeremy Kepner, SIAM Press, 2009 Thanks for your attention! Interacting with Distributed Arrays