13.07.2015 Views

Parallel Algorithm Design

Parallel Algorithm Design

Parallel Algorithm Design

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Parallel</strong> <strong>Algorithm</strong> <strong>Design</strong> 12– scatter operation – reverse of gather– Send the correct n/p particles to each task in turn∗ p − 1 messages, each of length 4n/p∗ Time used: (p − 1)(λ + 4n/(pβ))∗ Not efficient because communication is not balanced among processors– Derive a scatter operation requiring log p communication steps∗ Send half the list to another task∗ Next, each process sends quarter list to previously inactive tasks∗ And keep on going by sending half of previous step∗ Time required for this islog∑pi=1(λ +– Data transmission time is identical for both algorithms• Analysis4n )4n(p − 1)2 i = λ log p +pββp∗ Task/channel model supports the concurrent transmission of messages from multiple tasks, as long as they usedifferent channels, and no two active channels have the same source or destination task– Derive an expression for the total expected execution time of the parallel n-body algorithm– I/O of positions and velocities of n particles is a completely sequential operation requiring time2(λ io + 4n/β io )– Scattering at the beginning and gathering particles at the end of the computation requires time()4n(p − 1)2 λ log p +βp– Each iteration of parallel algorithm requires an all-gather communication of particles’ position, requiring timeλ log p +2n(p − 1)βp– Each processor performs its share of computation, requiring time⌈ ⌉ nχ (n − 1)p– If algorithm executes for m iterations, overall execution time of parallel computation is about(2 λ io + 4n ) () (⌈ ⌉ )4n(p − 1)2n(p − 1) n+ 2 λ log p + + m λ log p + + χ (n − 1)β io βpβp pSieve of EratosthenesSequential algorithmCreate a Boolean array from 1 to nMark all values as truek = 2while kˆ2 < nChange all multiples of k between kˆ2 and n to falseFind smallest index p > k that contains truek = pThe indices that are true represent prime numbers

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!