Docsity

Analytical Modeling of Parallel Performance: Scalability, Overheads, and Efficiency, Slides of Parallel Computing and Programming

Partial preview of the text

Download Analytical Modeling of Parallel Performance: Scalability, Overheads, and Efficiency and more Slides Parallel Computing and Programming in PDF only on Docsity!

Analytical Modeling of

Parallel Performance

2

Topic Overview

  • Performance metrics for parallel systems
  • Scalability of parallel systems
  • Cost optimality, scalability, efficiency
  • Asymptotic isoefficiency
  • Minimum execution time
  • Other scalability metrics —memory and time constrained scaling —serial fraction —Amdahl’s law

4

Asymptotic Execution Time

  • Sequential execution time —function of - input size
  • Parallel execution time —function of
  • input size
  • number of processors
  • communication parameters of target platform
  • Implications —must analyze parallel algorithms for a particular target platform —communication characteristics can differ by more than O(1) —parallel system = parallel algorithm + platform

5

Performance Metrics: Execution Time

  • Serial time: TS —time elapsed between the start and end of serial execution
  • Parallel time: Tp —time elapsed between first process start and last process end

7

Overheads in Parallel Programs

  • Extra computation —computation not performed by serial version - e.g., partially-replicated computation to reduce communication
  • Communication —data movement
  • Idling —load imbalance —synchronization —serialization
  • Contention —memory —network

8

Performance Metrics: Speedup

  • S = TS / TP

Example

  • Add^ n^ numbers using^ n^ processing elements
  • If^ n^ is a power of two —can perform this operation in log n steps on n processors - propagate partial sums up a logical binary tree

Performance analysis

  • TS =^ Θ^ ( n )
  • Assumptions —addition takes constant time^ tc —communication of a single word takes time^ ts +^ tw
  • TP =^ Θ^ (log^ n )
  • Speedup^ S^ =^ Θ^ ( n^ /^ log^ n )

Example: Sorting

Bubble sort

10 procedure bubbleSort( A : vector) n := length( A ) do swapped := false n := n - 1 for each i in 0 to n - 1 if A[i] > A[i + 1] swap(A[i], A[i + 1]); swapped := true while (swapped) end procedure procedure oddEvenSort( A : vector) n := length( A ) do swapped := false for each i in 0 to n - 1 by 2 in parallel if A[i] > A[i + 1] swap(A[i], A[i + 1]); swapped := true for each i in 1 to n - 1 by 2 in parallel if A[i] > A[i + 1] swap(A[i], A[i + 1]); swapped := true while (swapped) end procedure

Odd-even sort

“parallel bubble sort”

11

Speedup of Odd-Even Parallel Sort

  • Serial time for bubblesort: 150 seconds
  • Odd-even parallel sort on 4 processors: 40 seconds
  • Apparent speedup = 150/40 = 3. —is this a fair assessment?

Should consider the best serial

program as the baseline for Ts

  • What if serial quicksort only took 30 seconds?
  • Speedup of odd-even sort over quicksort = 30/40 = 0. —fairer assessment

13

Asymptotic Parallel Efficiency

- Fraction of time a processor performs useful work

  • E = S / p = TS / (p TP) - Bounds —theoretically: 0 ≤ E ≤ 1 —in practice: can have efficiency > 1 if superlinear speedup - Previous example: add^ n^ numbers using^ n^ PEs —speedup S = Θ ( n / log n ) —efficiency E = S / n = Θ (n / log n) / n = Θ (1 / log n)

14

Example: Edge Detection

  • Operation uses a^^3 x^^3 template to compute each pixel value
  • Serial time for an^ n^ x^ n^ image is given by^ TS =^9 tcn 2
  • Possible parallelization — partition image equally into vertical slabs, each with n^2 / p pixels — boundary of each slab is 2n pixels - number of pixel values that will have to be communicated — communication time =^^2 ( ts +^ twn )
  • Apply template to all^ n 2 / p pixels in time TS = 9 tcn 2 / p

16

Cost Optimality

- Cost of parallel system =^ pTP —sum of the work time for each processor — AKA work or processor-time product - Parallel system is^ cost-optimal^ if —O(solving a problem on a parallel computer) = O(serial) - Since^ E^ =^ TS /^ pTP , for cost optimal systems^ E^ =^ O (1)

17

Considering Cost Optimality

Problem revisited: add n numbers

- Is it cost-optimal on a parallel system using^ n^ PEs? - As before,^ TP =^ log^ n^ for^ p^ =^ n - Cost of this system =^ p^ TP =^ Θ( n^ log^ n ) - Serial runtime =^ Θ( n ) - Algorithm is not cost optimal - E =^ Θ (n / (n log n)) =^ Θ (1 / log n)

19

Effect of Granularity on Performance

  • Scaling down a parallel system —using fewer processors than the maximum possible —usually improves parallel system efficiency —naïve scaling down - consider each original processor as virtual processor - map virtual processors to scaled-down number of processors
  • Impact —# PE decreases by a factor of n / p —computation for each PE increases by a factor of n / p —communication cost depends upon what the VPs do

20

Sum on Virtual Processors

  • Add^ n^ numbers on^ p^ processing elements — p < n — n and p are powers of 2
  • Use parallel algorithm for^ n^ (virtual) processors —assign each processor n / p virtual processors