Part of Chapter 7 - PowerPoint PPT Presentation

About This Presentation
Title:

Part of Chapter 7

Description:

Simplifies hardware, but doesn't hide short stalls (eg, data hazards) Good: Does not require too many thread switches Bad: Throughput loss on short stalls ... – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 33
Provided by: peter1183
Category:
Tags: chapter | part | stalls

less

Transcript and Presenter's Notes

Title: Part of Chapter 7


1
Part of Chapter 7
  • Multicores, Multiprocessors, and Clusters

2
Introduction
9.1 Introduction
  • Goal of computer architects connect multiple
    computers to improve performance
  • Multiprocessors
  • Scalability, availability, power efficiency
  • Job-level (process-level) parallelism
  • High throughput for independent jobs
  • Parallel processing program
  • Single program run on multiple processors
  • Multicore microprocessors
  • Chips with multiple processors (cores)

3
Hardware and Software
  • Hardware
  • Serial e.g., Pentium 4
  • Parallel e.g., quad-core Xeon e5345
  • Software
  • Sequential e.g., matrix multiplication
  • Concurrent e.g., operating system
  • Sequential/concurrent software can run on
    serial/parallel hardware
  • Challenge making effective use of parallel
    hardware

4
Parallel Programming
  • Parallel software is the problem
  • Need to get significant performance improvement
  • Otherwise, just use a faster uniprocessor, since
    its easier!
  • Difficulties
  • Partitioning
  • Coordination
  • Communications overhead

7.2 The Difficulty of Creating Parallel
Processing Programs
5
Amdahls Law
  • Sequential part can limit speedup
  • Tprog Tseq Tpar
  • Example 100 processors, 90 speedup?
  • Solving Fparallelizable 0.999
  • Need seq part to be 0.1 of original time
  • If f0.8, 10 proc for Tseq10m, Tpar40m
  • S 3.57, Max S 5 regardless of N.

6
Scaling Example
  • Workload sum of 10 scalars, and 10 10 matrix
    sum
  • First sum cannot benefit from parallel processors
  • Speed up from 10 to 100 processors
  • Single processor Time (10 100) tadd
  • 10 processors
  • Time 10 tadd 100/10 tadd 20 tadd
  • Speedup 110/20 5.5 (55 of potential)
  • 100 processors
  • Time 10 tadd 100/100 tadd 11 tadd
  • Speedup 110/11 10 (10 of potential)
  • Assumes load can be balanced across processors

7
Scaling Example (cont)
  • What if matrix size is 100 100?
  • Single processor Time (10 10000) tadd
  • 10 processors
  • Time 10 tadd 10000/10 tadd 1010 tadd
  • Speedup 10010/1010 9.9 (99 of potential)
  • 100 processors
  • Time 10 tadd 10000/100 tadd 110 tadd
  • Speedup 10010/110 91 (91 of potential)
  • Assuming load balanced

8
Assuming unbalanced Load
  • If one of the processors does 2 of the
    additions
  • Time 10 tadd max(9800/99200/1 ) tadd
  • Time 210 tadd
  • Speedup 10010/210 48
  • Speedup drops almost in half

9
Strong vs Weak Scaling
  • Strong scaling problem size fixed
  • Measuring speedup while keeping problem fixed
  • Weak scaling problem size proportional to number
    of processors
  • 10 processors, 10 10 matrix
  • Time 20 tadd
  • 100 processors, 32 32 matrix
  • Time 10 tadd 1000/100 tadd 20 tadd
  • Constant performance in this example

10
Multiprocessor systems
  • These systems can communicate through
  • Shared memory
  • Two categories based on how they access memory
  • Uniform Memory Access (UMA) systems
  • all memory accesses take the same amount of time
  • Nonuniform memory access (NUMA) systems
  • Each processor gets its own piece of the memory
  • A processor can access its own memory quicker
  • Message passing
  • Using an interconnection network
  • Network topology is important to reduce overhead

11
Shared Memory
  • SMP shared memory multiprocessor
  • Hardware provides single physicaladdress space
    for all processors
  • Synchronize shared variables using locks

7.3 Shared Memory Multiprocessors
12
Example Sum Reduction
  • Sum 100,000 numbers on 100 processor UMA
  • Each processor has ID 0 Pn 99
  • Partition 1000 numbers per processor
  • Initial summation on each processor
  • sumPn 0 for (i 1000Pn i lt
    1000(Pn1) i i 1) sumPn sumPn
    Ai
  • Now need to add these partial sums
  • Use a divide and conquer technique Reduction
  • Half the processors add pairs, then quarter of
    processors add pairs of the new partial sums,
  • Need to synchronize between reduction steps

13
Example Sum Reduction
  • half 100
  • repeat
  • synch()
  • if (half2 ! 0 Pn 0)
  • sum0 sum0 sumhalf-1
  • / Conditional sum needed when half is odd
  • Processor0 gets missing element /
  • half half/2 / dividing line on who sums /
  • if (Pn lt half) sumPn sumPn
    sumPnhalf
  • until (half 1)

14
Message Passing
  • Each processor has private physical address space
  • Hardware sends/receives messages between
    processors

7.4 Clusters and Other Message-Passing
Multiprocessors
15
Message-passing multiprocs
  • Alternative to sharing and address space
  • Network of independent computers
  • Each has private memory and OS
  • Connected using high-performance network
  • Suitable for applications with independent tasks
  • Databases, simulations,
  • Dont require shared addressing to run well
  • Better performance than clusters using LAN
  • With much higher costs

16
Clusters
  • Collection of computers connected using a LAN
  • Each run a distinct copy of an OS
  • Connected using I/O systems (e.g., Ethernet)
  • Problems
  • Administration cost
  • Cost of administering a cluster of n machines is
    about the same as the cost of administering n
    independent machines
  • Lower cost of administering a shared memory
    multiprocessor
  • Processors in a cluster are connected using the
    I/O interconnect of each computer
  • Shared memory multiprocessors have a higher
    bandwidth
  • Programs in shared memory multiprocessors can use
    almost the entire memory

17
Sum Reduction (Again)
  • Sum 100,000 on 100 processors
  • First distribute 1000 numbers to each
  • Then do partial sums
  • sum 0for (i 0 ilt1000 i i 1) sum
    sum ANi
  • Reduction
  • Half the processors send, other half receive and
    add
  • The quarter send, quarter receive and add,

18
Sum Reduction (Again)
  • Given send() and receive() operations
  • limit 100 half 100/ 100 processors
    /repeat half (half1)/2 / send vs.
    receive dividing line /
    if (Pn gt half Pn lt limit) send(Pn -
    half, sum) if (Pn lt (limit/2)) sum sum
    receive() limit half / upper limit of
    senders /until (half 1) / exit with final
    sum /
  • Send/receive also provide synchronization
  • Assumes send/receive take similar time to addition

19
Grid Computing
  • Separate computers interconnected by long-haul
    networks
  • E.g., Internet connections
  • Work units farmed out, results sent back
  • Can make use of idle time on PCs
  • Each PC works on an independent piece of a
    problem
  • E.g., Search for Extra-terrestrial intelligence
  • SETI_at_home, World Community Grid

20
Hardware Multithreading
  • Performing multiple threads of execution in
    parallel
  • Goal Utilize hardware more efficiently
  • Memory shared through virtual memory mechanism
  • Replicate registers, PC, etc.
  • Fast switching between threads
  • Fine-grain multithreading
  • Switch threads after each cycle
  • Interleave instruction execution
  • If one thread stalls, others are executed using
    round-robin fashion
  • Good Hide losses from stalls
  • Bad Delay execution of threads without stalls

7.5 Hardware Multithreading
21
Multithreading (cont.)
  • Coarse-grain multithreading
  • Only switch on long stall (e.g., L2-cache miss)
  • Simplifies hardware, but doesnt hide short
    stalls (eg, data hazards)
  • Good Does not require too many thread switches
    Bad Throughput loss on short stalls
  • There is a variation of multithreading called
    simultaneous multithreading (SMT)

22
Simultaneous Multithreading
  • In multiple-issue dynamically scheduled processor
  • Schedule instructions from multiple threads
  • Instructions from independent threads execute
    when function units are available
  • Within threads, dependencies handled by
    scheduling and register renaming
  • Example Intel Pentium-4 HT
  • Two threads duplicated registers, shared
    function units and caches

23
Multithreading Example
24
Future of Multithreading
  • Will it survive? In what form?
  • Power wall ? simplified microarchitectures
  • Use fine-grained multithreading to use better
    under-utilized resources
  • Tolerating cache-miss latency
  • Thread switch may be most effective
  • Multiple simple cores might share resources more
    effectively
  • This resource sharing reduces the benefit of
    multithreading

25
Instruction and Data Streams
  • An alternate classification

Data Streams Data Streams
Single Multiple
Instruction Streams Single SISDIntel Pentium 4 SIMD SSE instructions of x86
Instruction Streams Multiple MISDNo examples today MIMDIntel Xeon e5345
7.6 SISD, MIMD, SIMD, SPMD, and Vector
  • SPMD Single Program Multiple Data
  • A parallel program on a MIMD computer
  • Conditional code for different processors
  • Different than having a separate program being
    executed on an MIMD system

26
SIMD
  • Operate elementwise on vectors of data
  • E.g., MMX and SSE instructions in x86
  • Multiple data elements in 128-bit wide registers
  • All processors execute the same instruction at
    the same time
  • Each with different data address, etc.
  • Parallel executions are synchronized
  • Use of a single program counter (PC)
  • Works best for highly data-parallel applications
  • Only one copy of the code is used with identical
    structured data

27
Vector Processors
  • Highly pipelined function units
  • Stream data from/to vector registers to units
  • Data collected from memory into registers
  • Results stored from registers to memory
  • Example Vector extension to MIPS
  • 32 64-element registers (64-bit elements)
  • Vector instructions
  • lv, sv load/store vector
  • addv.d add vectors of double
  • addvs.d add scalar to each element of vector of
    double
  • Significantly reduces instruction-fetch bandwidth

28
Example DAXPY (Y a X Y)
  • Conventional MIPS code
  • l.d f0,a(sp) load scalar a
    addiu r4,s0,512 upper bound of what to
    loadloop l.d f2,0(s0) load x(i)
    mul.d f2,f2,f0 a x(i) l.d
    f4,0(s1) load y(i) add.d f4,f4,f2
    a x(i) y(i) s.d f4,0(s1)
    store into y(i) addiu s0,s0,8
    increment index to x addiu s1,s1,8
    increment index to y subu t0,r4,s0
    compute bound bne t0,zero,loop check
    if done
  • Vector MIPS code
  • l.d f0,a(sp) load scalar a
    lv v1,0(s0) load vector x mulvs.d
    v2,v1,f0 vector-scalar multiply lv
    v3,0(s1) load vector y addv.d
    v4,v2,v3 add y to product sv
    v4,0(s1) store the result

29
Vector vs. Scalar
  • Vector architectures and compilers
  • Simplify data-parallel programming
  • Explicit statement of absence of loop-carried
    dependences
  • Reduced checking in hardware
  • Regular access patterns benefit from interleaved
    and burst memory
  • Avoid control hazards by avoiding loops
  • More general than ad-hoc media extensions (such
    as MMX, SSE)
  • Better match with compiler technology

30
History of GPUs
  • Early video cards
  • Frame buffer memory with address generation for
    video output
  • 3D graphics processing
  • Originally high-end computers (e.g., SGI)
  • Moores Law ? lower cost, higher density
  • 3D graphics cards for PCs and game consoles
  • Graphics Processing Units
  • Processors oriented to 3D graphics tasks
  • Vertex/pixel processing, shading, texture
    mapping,rasterization

7.7 Introduction to Graphics Processing Units
31
Graphics in the System
32
GPU Architectures
  • Processing is highly data-parallel
  • GPUs are highly multithreaded
  • Use thread switching to hide memory latency
  • Less reliance on multi-level caches
  • Graphics memory is wide and high-bandwidth
  • Trend toward general purpose GPUs
  • Heterogeneous CPU/GPU systems
  • CPU for sequential code, GPU for parallel code
  • Programming languages/APIs
  • DirectX, OpenGL
  • C for Graphics (Cg), High Level Shader Language
    (HLSL)
  • Compute Unified Device Architecture (CUDA)
Write a Comment
User Comments (0)
About PowerShow.com