Parallelism Lecture notes from MKP and S. Yalamanchili.

Slides:



Advertisements
Similar presentations
Parallelism Lecture notes from MKP and S. Yalamanchili.
Advertisements

Vectors, SIMD Extensions and GPUs COMP 4611 Tutorial 11 Nov. 26,
CSE431 Chapter 7A.1Irwin, PSU, 2008 CSE 431 Computer Architecture Fall 2008 Chapter 7A: Intro to Multiprocessor Systems Mary Jane Irwin (
Multiprocessors— Large vs. Small Scale Multiprocessors— Large vs. Small Scale.
Lecture 38: Chapter 7: Multiprocessors Today’s topic –Vector processors –GPUs –An example 1.
Lecture 6: Multicore Systems
Issues in Parallel Processing Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University.
Review: Multiprocessor Systems (MIMD)
Chapter 7 Multicores, Multiprocessors, and Clusters.
1  2004 Morgan Kaufmann Publishers Chapter 9 Multiprocessors.
Chapter 7 Multicores, Multiprocessors, and Clusters.
Lecture 37: Chapter 7: Multiprocessors Today’s topic –Introduction to multiprocessors –Parallelism in software –Memory organization –Cache coherence 1.
Computer Organization CS224 Fall 2012 Lesson 52. Message Passing  Each processor has private physical address space  Hardware sends/receives messages.
Chapter 7 - Introduction Goal: connecting multiple computers to get higher performance – Multiprocessors – Scalability, availability, power efficiency.
Chapter 7 Multicores, Multiprocessors, and Clusters CprE 381 Computer Organization and Assembly Level Programming, Fall 2013 Zhao Zhang Iowa State University.
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell CS 352H: Computer Systems Architecture Topic 14: Multicores,
1 Parallelism, Multicores, Multiprocessors, and Clusters [Adapted from Computer Organization and Design, Fourth Edition, Patterson & Hennessy, © 2009]
Multi-core architectures. Single-core computer Single-core CPU chip.
Multi-Core Architectures
CMPE 421 Parallel Computer Architecture Multi Processing 1.
Parallel Processing - introduction  Traditionally, the computer has been viewed as a sequential machine. This view of the computer has never been entirely.
Chapter 2 Parallel Architecture. Moore’s Law The number of transistors on a chip doubles every years. – Has been valid for over 40 years – Can’t.
Multiprocessing. Going Multi-core Helps Energy Efficiency William Holt, HOT Chips 2005 Adapted from UC Berkeley "The Beauty and Joy of Computing"
Morgan Kaufmann Publishers
Memory/Storage Architecture Lab Computer Architecture Multiprocessors.
Morgan Kaufmann Publishers Multicores, Multiprocessors, and Clusters
Computer Organization CS224 Fall 2012 Lesson 52. Introduction  Goal: connecting multiple computers to get higher performance l Multiprocessors l Scalability,
August 13, 2001Systems Architecture II1 Systems Architecture II (CS ) Lecture 11: Multiprocessors: Uniform Memory Access * Jeremy R. Johnson Monday,
Introduction Goal: connecting multiple computers to get higher performance – Multiprocessors – Scalability, availability, power efficiency Job-level (process-level)
Lecture 13 Parallel Processing. 2 What is Parallel Computing? Traditionally software has been written for serial computation. Parallel computing is the.
Auburn University COMP8330/7330/7336 Advanced Parallel and Distributed Computing Parallel Hardware Dr. Xiao Qin Auburn.
COMP 740: Computer Architecture and Implementation
Higher Level Parallelism
CS5102 High Performance Computer Systems Thread-Level Parallelism
Distributed Processors
Morgan Kaufmann Publishers Large and Fast: Exploiting Memory Hierarchy
Parallel Processing - introduction
Morgan Kaufmann Publishers Multicores, Multiprocessors, and Clusters
Morgan Kaufmann Publishers
The University of Adelaide, School of Computer Science
The University of Adelaide, School of Computer Science
Morgan Kaufmann Publishers
Thread Level Parallelism (TLP)
Morgan Kaufmann Publishers
/ Computer Architecture and Design
Morgan Kaufmann Publishers Multicores, Multiprocessors, and Clusters
The University of Adelaide, School of Computer Science
CMSC 611: Advanced Computer Architecture
Computer Architecture Computer Science & Engineering
Morgan Kaufmann Publishers Parallel Processors from Client to Cloud
Parallel Processors from Client to Cloud
The University of Adelaide, School of Computer Science
Kai Bu 13 Multiprocessors So today, we’ll finish the last part of our lecture sessions, multiprocessors.
Morgan Kaufmann Publishers Parallel Processors from Client to Cloud
Chapter 17 Parallel Processing
Morgan Kaufmann Publishers Parallel Processors from Client to Cloud
Chapter 5 Exploiting Memory Hierarchy : Cache Memory in CMP
/ Computer Architecture and Design
CSC3050 – Computer Architecture
Morgan Kaufmann Publishers Multicores, Multiprocessors, and Clusters
Chapter 4 Multiprocessors
The University of Adelaide, School of Computer Science
Lecture 17 Multiprocessors and Thread-Level Parallelism
Lecture 17 Multiprocessors and Thread-Level Parallelism
CSL718 : Multiprocessors 13th April, 2006 Introduction
The University of Adelaide, School of Computer Science
Morgan Kaufmann Publishers Multicores, Multiprocessors, and Clusters
Lecture 17 Multiprocessors and Thread-Level Parallelism
Morgan Kaufmann Publishers Multicores, Multiprocessors, and Clusters
Presentation transcript:

Parallelism Lecture notes from MKP and S. Yalamanchili

Morgan Kaufmann Publishers 31 July, 2018 Introduction Goal: Higher performance through parallelism Job-level (process-level) parallelism High throughput for independent jobs Application-level parallelism Single program run on multiple processors Multicore microprocessors Chips with multiple processors (cores) Support for both job level and application-level parallelism Chapter 7 — Multicores, Multiprocessors, and Clusters

Core Count Roadmap: AMD From anandtech.com

Core Count: NVIDIA

Morgan Kaufmann Publishers 31 July, 2018 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 Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Parallel Programming Parallel software is the problem Need to get significant performance improvement Otherwise, just use a faster uniprocessor, since it’s easier! Difficulties Partitioning Coordination Communications overhead Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Amdahl’s Law Sequential part can limit speedup Example: 100 processors, 90× speedup? Tnew = Tparallelizable/100 + Tsequential Solving: Fparallelizable = 0.999 Need sequential part to be 0.1% of original time Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Scaling Example Workload: sum of 10 scalars, and 10 × 10 matrix sum 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) Idealized model Assumes load can be balanced across processors Chapter 7 — Multicores, Multiprocessors, and Clusters

Scaling Example (cont) Morgan Kaufmann Publishers 31 July, 2018 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) Idealized model Assuming load balanced Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Strong vs Weak Scaling Strong scaling: problem size fixed As in example 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 For a fixed size system grow the number of processors to improve performance Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 What We Have Seen §3.6: Parallelism and Computer Arithmetic Associativity and bit level parallelism §4.10: Parallelism and Advanced Instruction- Level Parallelism Recall multi-instruction issue §6.9: Parallelism and I/O: Redundant Arrays of Inexpensive Disks Now we will look at categories in computation classification Chapter 7 — Multicores, Multiprocessors, and Clusters

Concurrency and Parallelism Each core can operate concurrently and in parallel Multiple threads may operate in a time sliced fashion on a single core Concurrent access to shared data must be controlled for correctness Programming models? Image from futurelooks.com

Instruction Level Parallelism (ILP) Multiple instructions in EX at the same time IF ID MEM WB Single (program) thread of execution Issue multiple instructions from the same instruction stream Average CPI<1 Often called out of order (OOO) cores

The P4 Microarchitecture From, “The Microarchitecture of the Pentium 4 Processor 1,” G. Hinton et.al, Intel Technology Journal Q1, 2001

ILP Wall - Past the Knee of the Curve? Performance Made sense to go Superscalar/OOO: good ROI Very little gain for substantial effort Scalar In-Order Moderate-Pipe Superscalar/OOO Very-Deep-Pipe Aggressive Superscalar/OOO “Effort” Source: G. Loh

Thread Level Parallelism (TLP) Multiple threads of execution Exploit ILP in each thread Exploit concurrent execution across threads

Instruction and Data Streams Morgan Kaufmann Publishers 31 July, 2018 Instruction and Data Streams Taxonomy due to M. Flynn Data Streams Single Multiple Instruction Streams SISD: Intel Pentium 4 SIMD: SSE instructions of x86 MISD: No examples today MIMD: Intel Xeon e5345 SPMD: Single Program Multiple Data A parallel program on a MIMD computer where each instruction stream is identical Conditional code for different processors Chapter 7 — Multicores, Multiprocessors, and Clusters

Programming Model: Multithreading Morgan Kaufmann Publishers 31 July, 2018 Programming Model: Multithreading Performing multiple threads of execution in parallel 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 Coarse-grain multithreading Only switch on long stall (e.g., L2-cache miss) Simplifies hardware, but doesn’t hide short stalls (eg, data hazards) Chapter 7 — Multicores, Multiprocessors, and Clusters

Conventional Multithreading Zero-overhead context switch Duplicated contexts for threads 0:r0 0:r7 1:r0 CtxtPtr Memory (shared by threads) 1:r7 2:r0 2:r7 3:r0 3:r7 Register file

Simultaneous Multithreading Morgan Kaufmann Publishers 31 July, 2018 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 Known as Hyperthreading in Intel terminology Chapter 7 — Multicores, Multiprocessors, and Clusters

Hyper-threading 2 CPU Without Hyper-threading 2 CPU With Hyper-threading Processor Execution Resources Processor Execution Resources Processor Execution Resources Processor Execution Resources Arch State Arch State Arch State Arch State Arch State Arch State Implementation of Hyper-threading adds less that 5% to the chip area Principle: share major logic components by adding or partitioning buffering logic

Multithreading Example Morgan Kaufmann Publishers 31 July, 2018 Multithreading Example Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Shared Memory SMP: shared memory multiprocessor Hardware provides single physical address space for all processors Synchronize shared variables using locks Memory access time UMA (uniform) vs. NUMA (nonuniform) Chapter 7 — Multicores, Multiprocessors, and Clusters

Example: Communicating Threads Producer Consumer The Producer calls while (1) { while (count == BUFFER_SIZE) ; // do nothing // add an item to the buffer ++count; buffer[in] = item; in = (in + 1) % BUFFER_SIZE; }

Example: Communicating Threads Producer Consumer The Consumer calls while (1) { while (count == 0) ; // do nothing // remove an item from the buffer --count; item = buffer[out]; out = (out + 1) % BUFFER_SIZE; }

Uniprocessor Implementation count++ could be implemented as register1 = count; register1 = register1 + 1; count = register1; count-- could be implemented as register2 = count; register2 = register2 – 1; count = register2; Consider this execution interleaving: S0: producer execute register1 = count {register1 = 5} S1: producer execute register1 = register1 + 1 {register1 = 6} S2: consumer execute register2 = count {register2 = 5} S3: consumer execute register2 = register2 - 1 {register2 = 4} S4: producer execute count = register1 {count = 6 } S5: consumer execute count = register2 {count = 4}

Synchronization We need to prevent certain instruction interleavings Or at least be able to detect violations! Some sequence of operations (instructions) must happen atomically E.g., register1 = count; register1 = register1 + 1; count = register1; atomic operations/instructions

The University of Adelaide, School of Computer Science 31 July 2018 Synchronization Two processors sharing an area of memory P1 writes, then P2 reads Data race if P1 and P2 don’t synchronize Result depends of order of accesses Hardware support required Atomic read/write memory operation No other access to the location allowed between the read and write Could be a single instruction E.g., atomic swap of register ↔ memory Or an atomic pair of instructions Chapter 2 — Instructions: Language of the Computer

Synchronization in MIPS The University of Adelaide, School of Computer Science 31 July 2018 Synchronization in MIPS Load linked: ll rt, offset(rs) Store conditional: sc rt, offset(rs) Succeeds if location not changed since the ll Returns 1 in rt Fails if location is changed Returns 0 in rt Example: atomic swap (to test/set lock variable) try: add $t0,$zero,$s4 ;copy exchange value ll $t1,0($s1) ;load linked sc $t0,0($s1) ;store conditional beq $t0,$zero,try ;branch store fails add $s4,$zero,$t1 ;put load value in $s4 Chapter 2 — Instructions: Language of the Computer

Example: Sum Reduction Morgan Kaufmann Publishers 31 July, 2018 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 sum[Pn] = 0; for (i = 1000*Pn; i < 1000*(Pn+1); i = i + 1) sum[Pn] = sum[Pn] + A[i]; Now need to add these partial sums Reduction: divide and conquer Half the processors add pairs, then quarter, … Need to synchronize between reduction steps Chapter 7 — Multicores, Multiprocessors, and Clusters

Example: Sum Reduction Morgan Kaufmann Publishers 31 July, 2018 Example: Sum Reduction half = 100; repeat synch(); if (half%2 != 0 && Pn == 0) sum[0] = sum[0] + sum[half-1]; /* Conditional sum needed when half is odd; Processor0 gets missing element */ half = half/2; /* dividing line on who sums */ if (Pn < half) sum[Pn] = sum[Pn] + sum[Pn+half]; until (half == 1); Chapter 7 — Multicores, Multiprocessors, and Clusters

Cache Coherence A shared variable may exist in multiple caches Multiple copies to improve latency This is a really a synchronization problem

Cache Coherence Problem Morgan Kaufmann Publishers 31 July, 2018 Cache Coherence Problem Suppose two CPU cores share a physical address space Write-through caches Time step Event CPU A’s cache CPU B’s cache Memory 1 CPU A reads X 2 CPU B reads X 3 CPU A writes 1 to X Chapter 5 — Large and Fast: Exploiting Memory Hierarchy

Example (Writeback Cache) Rd? Rd? Cache Cache Cache X= -100 X= -100 X= -100 X= 505 Memory X= -100 Courtesy H. H. Lee

Morgan Kaufmann Publishers 31 July, 2018 Coherence Defined Informally: Reads return most recently written value Formally: P writes X; P reads X (no intervening writes)  read returns written value P1 writes X; P2 reads X (sufficiently later)  read returns written value c.f. CPU B reading X after step 3 in example P1 writes X, P2 writes X  all processors see writes in the same order End up with the same final value for X Chapter 5 — Large and Fast: Exploiting Memory Hierarchy

Cache Coherence Protocols Morgan Kaufmann Publishers 31 July, 2018 Cache Coherence Protocols Operations performed by caches in multiprocessors to ensure coherence Migration of data to local caches Reduces bandwidth for shared memory Replication of read-shared data Reduces contention for access Snooping protocols Each cache monitors bus reads/writes Directory-based protocols Caches and memory record sharing status of blocks in a directory Chapter 5 — Large and Fast: Exploiting Memory Hierarchy

Invalidating Snooping Protocols Morgan Kaufmann Publishers 31 July, 2018 Invalidating Snooping Protocols Cache gets exclusive access to a block when it is to be written Broadcasts an invalidate message on the bus Subsequent read in another cache misses Owning cache supplies updated value CPU activity Bus activity CPU A’s cache CPU B’s cache Memory CPU A reads X Cache miss for X CPU B reads X CPU A writes 1 to X Invalidate for X 1 CPU B read X Chapter 5 — Large and Fast: Exploiting Memory Hierarchy

Morgan Kaufmann Publishers 31 July, 2018 Memory Consistency When are writes seen by other processors “Seen” means a read returns the written value Can’t be instantaneously Assumptions A write completes only when all processors have seen it A processor does not reorder writes with other accesses Consequence P writes X then writes Y  all processors that see new Y also see new X Processors can reorder reads, but not writes Chapter 5 — Large and Fast: Exploiting Memory Hierarchy

Morgan Kaufmann Publishers 31 July, 2018 Message Passing Each processor has private physical address space Hardware sends/receives messages between processors Chapter 7 — Multicores, Multiprocessors, and Clusters

Parallelism Write message passing programs Explicit send and receive of data Rather than accessing data in shared memory

Loosely Coupled Clusters Morgan Kaufmann Publishers 31 July, 2018 Loosely Coupled Clusters Network of independent computers Each has private memory and OS Connected using I/O system E.g., Ethernet/switch, Internet Suitable for applications with independent tasks Web servers, databases, simulations, … High availability, scalable, affordable Problems Administration cost (prefer virtual machines) Low interconnect bandwidth c.f. processor/memory bandwidth on an SMP Chapter 7 — Multicores, Multiprocessors, and Clusters

zdnet.com geekwire.com

High Performance Computing

Morgan Kaufmann Publishers 31 July, 2018 Sum Reduction (Again) Sum 100,000 on 100 processors First distribute 100 numbers to each The do partial sums sum = 0; for (i = 0; i<1000; i = i + 1) sum = sum + AN[i]; Reduction Half the processors send, other half receive and add The quarter send, quarter receive and add, … Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Sum Reduction (Again) Given send() and receive() operations limit = 100; half = 100;/* 100 processors */ repeat half = (half+1)/2; /* send vs. receive dividing line */ if (Pn >= half && Pn < limit) send(Pn - half, sum); if (Pn < (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 Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 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 E.g., SETI@home, World Community Grid Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 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. Simplifies synchronization Reduced instruction control hardware Works best for highly data-parallel applications Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 SIMD Co-Processor Graphics and media processing operates on vectors of 8-bit and 16-bit data Use 64-bit adder, with partitioned carry chain Operate on 8×8-bit, 4×16-bit, or 2×32-bit vectors SIMD (single-instruction, multiple-data) 4x16-bit 2x32-bit Chapter 3 — Arithmetic for Computers

Morgan Kaufmann Publishers 31 July, 2018 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 Chapter 7 — Multicores, Multiprocessors, and Clusters

From pg-server.csc.ncsu.edu Cray-1: Vector Machine Mid 70’s – principles have not changed Aggregate operations defined on vectors Vector ISAs operating on vector instruction sets Load/store ISA ala MIPS Often confused with SIMD From pg-server.csc.ncsu.edu

Morgan Kaufmann Publishers 31 July, 2018 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 Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 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) Moore’s 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 Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Graphics in the System Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 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) Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Example: NVIDIA Tesla Streaming multiprocessor 8 × Streaming processors Chapter 7 — Multicores, Multiprocessors, and Clusters

NVIDIA’s Compute Unified Device Architecture (CUDA) Bulk synchronous processing (BSP) execution model For access to CUDA tutorials http://developer.nvidia.com/cuda-education-training

Morgan Kaufmann Publishers 31 July, 2018 Example: NVIDIA Tesla Streaming Processors Single-precision FP and integer units Each SP is fine-grained multithreaded Warp: group of 32 threads Executed in parallel, SIMD style 8 SPs × 4 clock cycles Hardware contexts for 24 warps Registers, PCs, … Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Classifying GPUs Does not fit nicely into SIMD/MIMD model Conditional execution in a thread allows an illusion of MIMD But with performance degradation Need to write general purpose code with care Static: Discovered at Compile Time Dynamic: Discovered at Runtime Instruction-Level Parallelism VLIW Superscalar Data-Level Parallelism SIMD or Vector Tesla Multiprocessor Chapter 7 — Multicores, Multiprocessors, and Clusters

Interconnection Networks Morgan Kaufmann Publishers 31 July, 2018 Interconnection Networks Network topologies Arrangements of processors, switches, and links Bus Ring N-cube (N = 3) 2D Mesh Fully connected Chapter 7 — Multicores, Multiprocessors, and Clusters

Network Characteristics Morgan Kaufmann Publishers 31 July, 2018 Network Characteristics Performance Latency per message (unloaded network) Throughput Link bandwidth Total network bandwidth Bisection bandwidth Congestion delays (depending on traffic) Cost Power Routability in silicon Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Modeling Performance Assume performance metric of interest is achievable GFLOPs/sec Measured using computational kernels from Berkeley Design Patterns Arithmetic intensity of a kernel FLOPs per byte of memory accessed For a given computer, determine Peak GFLOPS (from data sheet) Peak memory bytes/sec (using Stream benchmark) Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Roofline Diagram Attainable GPLOPs/sec = Max ( Peak Memory BW × Arithmetic Intensity, Peak FP Performance ) Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Comparing Systems Example: Opteron X2 vs. Opteron X4 2-core vs. 4-core, 2× FP performance/core, 2.2GHz vs. 2.3GHz Same memory system To get higher performance on X4 than X2 Need high arithmetic intensity Or working set must fit in X4’s 2MB L-3 cache Chapter 7 — Multicores, Multiprocessors, and Clusters

Optimizing Performance Morgan Kaufmann Publishers 31 July, 2018 Optimizing Performance Optimize FP performance Balance adds & multiplies Improve superscalar ILP and use of SIMD instructions Optimize memory usage Software prefetch Avoid load stalls Memory affinity Avoid non-local data accesses Chapter 7 — Multicores, Multiprocessors, and Clusters

Optimizing Performance Morgan Kaufmann Publishers 31 July, 2018 Optimizing Performance Choice of optimization depends on arithmetic intensity of code Arithmetic intensity is not always fixed May scale with problem size Caching reduces memory accesses Increases arithmetic intensity Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Four Example Systems 2 × quad-core Intel Xeon e5345 (Clovertown) 2 × quad-core AMD Opteron X4 2356 (Barcelona) Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Four Example Systems 2 × oct-core Sun UltraSPARC T2 5140 (Niagara 2) 2 × oct-core IBM Cell QS20 Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 And Their Rooflines Kernels SpMV (left) LBHMD (right) Some optimizations change arithmetic intensity x86 systems have higher peak GFLOPs But harder to achieve, given memory bandwidth Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Pitfalls Not developing the software to take account of a multiprocessor architecture Example: using a single lock for a shared composite resource Serializes accesses, even if they could be done in parallel Use finer-granularity locking Chapter 7 — Multicores, Multiprocessors, and Clusters

Morgan Kaufmann Publishers 31 July, 2018 Concluding Remarks Goal: higher performance by using multiple processors Difficulties Developing parallel software Devising appropriate architectures Many reasons for optimism Changing software and application environment Chip-level multiprocessors with lower latency, higher bandwidth interconnect An ongoing challenge for computer architects! Chapter 7 — Multicores, Multiprocessors, and Clusters

Study Guide