Issues in Parallel Processing Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University.

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.
ENGS 116 Lecture 101 ILP: Software Approaches Vincent H. Berk October 12 th Reading for today: , 4.1 Reading for Friday: 4.2 – 4.6 Homework #2:
Lecture 6: Multicore Systems
Computer Abstractions and Technology
The University of Adelaide, School of Computer Science
Chapter 2 — Instructions: Language of the Computer — 1 Branching Far Away If branch target is too far to encode with 16-bit offset, assembler rewrites.
Lecture Objectives: 1)Define pipelining 2)Calculate the speedup achieved by pipelining for a given number of instructions. 3)Define how pipelining improves.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 7:
Vector Processing. Vector Processors Combine vector operands (inputs) element by element to produce an output vector. Typical array-oriented operations.
Review: Multiprocessor Systems (MIMD)
Chapter 7 Multicores, Multiprocessors, and Clusters.
1 COMP 206: Computer Architecture and Implementation Montek Singh Mon, Dec 5, 2005 Topic: Intro to Multiprocessors and Thread-Level Parallelism.
Chapter 17 Parallel Processing.
Chapter 7 Multicores, Multiprocessors, and Clusters.
1 Computer Science, University of Warwick Architecture Classifications A taxonomy of parallel architectures: in 1972, Flynn categorised HPC architectures.
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.
1 Chapter 1 Parallel Machines and Computations (Fundamentals of Parallel Processing) Dr. Ranette Halverson.
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]
Pipeline And Vector Processing. Parallel Processing The purpose of parallel processing is to speed up the computer processing capability and increase.
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"
SJSU SPRING 2011 PARALLEL COMPUTING Parallel Computing CS 147: Computer Architecture Instructor: Professor Sin-Min Lee Spring 2011 By: Alice Cotti.
Morgan Kaufmann Publishers
1 Multithreaded Programming Concepts Myongji University Sugwon Hong 1.
ECE200 – Computer Organization Chapter 9 – Multiprocessors.
EKT303/4 Superscalar vs Super-pipelined.
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,
3/12/2013Computer Engg, IIT(BHU)1 PARALLEL COMPUTERS- 2.
3/12/2013Computer Engg, IIT(BHU)1 INTRODUCTION-1.
Advanced Computer Architecture pg 1 Embedded Computer Architecture 5SAI0 Chip Multi-Processors (ch 8) Henk Corporaal
Introduction Goal: connecting multiple computers to get higher performance – Multiprocessors – Scalability, availability, power efficiency Job-level (process-level)
Processor Performance & Parallelism Yashwant Malaiya Colorado State University With some PH stuff.
Processor Level Parallelism 2. How We Got Here Developments in PC CPUs.
Vector computers.
Modified by S. J. Fritz Spring 2009 (1) Based on slides from D. Patterson and www-inst.eecs.berkeley.edu/~cs152/ COM 249 – Computer Organization and Assembly.
Processor Level Parallelism 1
Auburn University COMP8330/7330/7336 Advanced Parallel and Distributed Computing Parallel Hardware Dr. Xiao Qin Auburn.
18-447: Computer Architecture Lecture 30B: Multiprocessors
Parallel Processing - introduction
Morgan Kaufmann Publishers Multicores, Multiprocessors, and Clusters
Morgan Kaufmann Publishers
Atomic Operations in Hardware
The University of Adelaide, School of Computer Science
The University of Adelaide, School of Computer Science
Morgan Kaufmann Publishers
Morgan Kaufmann Publishers
Morgan Kaufmann Publishers Multicores, Multiprocessors, and Clusters
Parallel Processors from Client to Cloud
Morgan Kaufmann Publishers Parallel Processors from Client to Cloud
CSC3050 – Computer Architecture
Morgan Kaufmann Publishers Multicores, Multiprocessors, and Clusters
The University of Adelaide, School of Computer Science
Lecture 17 Multiprocessors and Thread-Level Parallelism
Lecture 17 Multiprocessors and Thread-Level Parallelism
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:

Issues in Parallel Processing Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

Chapter 7 — Multicores, Multiprocessors, and Clusters — 2 Introduction Goal: connecting multiple computers to get higher 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) §9.1 Introduction

Questions to Address 1.How do the parallel processors share data? 2.How do the parallel processors coordinate their computing schedules? 3.How many processors should be used? 4.What is the minimum speedup S(N) acceptable for N processors? What are the factors that drive this decision?

Question: How to Get Great Computing Power? There are two obvious options. 1.Build a single large very powerful CPU. 2.Construct a computer from multiple cooperating processing units. The early choice was for a computing system with only a few (1 to 16) processing units. This choice was based on what appeared to be very solid theoretical grounds.

Linear Speed-Up The cost of a parallel processing system with N processors is about N times the cost of a single processor; the cost scales linearly. The goal is to get N times the performance of a single processor system for an N-processor system. This is linear speedup. For linear speedup, the cost per unit of computing power is approximately constant.

The Cray-1

Supercomputers vs. Multiprocessor Clusters “If you were plowing a field, which would you rather use: Two strong oxen or 1024 chickens”. Seymour Cray Here are two opinions from a 1984 article. “The speedup factor of using an n–processor system over a uniprocessor system has been theoretically estimated to be within the range (log 2 n, n/log 2 n).” “By the late 1980s, we may expect systems of 8–16 processors. Unless the technology changes drastically, we will not anticipate massive multiprocessor systems until the 90s.” The drastic technology change is called “VLSI”.

The Speed–Up Factor: S(N)

Cost Efficiency: S(N) / N

Harold Stone on Linear Speedup Harold Stone wrote in 1990 on what he called “peak performance”. “When a multiprocessor is operating at peak performance, 1.All processors are engaged in useful work. 2.No processor is idle, and no processor is executing an instruction that would not be executed if the same algorithm were executing on a single processor. 3.In this state of peak performance, all N processors are contributing to effective performance, and the processing rate is increased by a factor of N. 4.Peak performance is a very special state that is rarely achievable.”

The Problem with the Early Theory The early work focused on the problem of general computation. Not all problems can be solved by an algorithm that can be mapped onto a set of parallel processors. However, many very important problems can be solved by parallel algorithms.

Chapter 7 — Multicores, Multiprocessors, and Clusters — 12 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

Cooperation Among Processes Parallel execution on a multi-core CPU is not inherently a difficult problem. The problems arise when the processes need to cooperate. Example: A quad-core running 4 independent programs that do not communicate. One measure of the complexity of parallel execution is the amount of communication required among the processes. More communication means more complex.

Chapter 7 — Multicores, Multiprocessors, and Clusters — 14 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 §7.2 The Difficulty of Creating Parallel Processing Programs

Chapter 7 — Multicores, Multiprocessors, and Clusters — 15 Amdahl’s Law Sequential part can limit speedup Example: 100 processors, 90× speedup? T new = T parallelizable /100 + T sequential Solving: F parallelizable = Need sequential part to be 0.1% of original time

Some Results Due to Amdahl’s Law

Characterizing Problems One result of Amdahl’s Law is that only problems with very small necessarily sequential parts can benefit from massive parallel processing. Fortunately, there are many such problems 1.Weather forecasting. 2.Nuclear weapons simulation. 3.Protein folding and issues in drug design.

Chapter 7 — Multicores, Multiprocessors, and Clusters — 18 Scaling Example Workload: sum of 10 scalars, and 10 × 10 matrix sum Speed up from 10 to 100 processors Single processor: Time = ( ) × t add 10 processors Time = 10 × t add + 100/10 × t add = 20 × t add Speedup = 110/20 = 5.5 (55% of potential) 100 processors Time = 10 × t add + 100/100 × t add = 11 × t add Speedup = 110/11 = 10 (10% of potential) Assumes load can be balanced across processors

Chapter 7 — Multicores, Multiprocessors, and Clusters — 19 Scaling Example (cont) What if matrix size is 100 × 100? Single processor: Time = ( ) × t add 10 processors Time = 10 × t add /10 × t add = 1010 × t add Speedup = 10010/1010 = 9.9 (99% of potential) 100 processors Time = 10 × t add /100 × t add = 110 × t add Speedup = 10010/110 = 91 (91% of potential) Assuming load balanced

Chapter 7 — Multicores, Multiprocessors, and Clusters — 20 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 × t add 100 processors, 32 × 32 matrix Time = 10 × t add /100 × t add = 20 × t add Constant performance in this example

Chapter 2 — Instructions: Language of the Computer — 21 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 §2.11 Parallelism and Instructions: Synchronization

The Necessity for Synchronization “In a multiprocessing system, it is essential to have a way in which two or more processors working on a common task can each execute programs without corrupting the other’s sub- tasks”. “Synchronization, an operation that guarantees an orderly access to shared memory, must be implemented for a properly functioning multiprocessing system”. Chun & Latif, MIPS Technologies Inc.

Synchronization in Uniprocessors The synchronization issue posits 2 processes sharing an area of memory. The processes can be on different processors, or on a single shared processor. Most issues in operating system design are best imagined within the context of multiple processors, even if there is only one that is being time shared.

The Lost Update Problem Here is a synchronization problem straight out of database theory. Two travel agents book a flight with one seat remaining. A1 reads seat count. One remaining. A2 reads seat count. One remaining. A1 books the seat. Now there are no more seats. A2, working with old data, also books the seat. Now we have at least one unhappy customer.

I’ve Got It; You Can’t Have It What is needed is a way to put a “lock” on the seat count until one of the travel agents completes the booking. Then the other agent must begin with the new seat count. Database engines use “record locking” as one way to prevent lost updates. Another database technique is the idea of an atomic transaction, here a 2-step transaction.

Atomic Transactions We do not mean the type of transaction at left. An atomic read and modify must proceed without any interruption. No other process can access the shared memory between the read and write back to the memory location.

Chapter 2 — Instructions: Language of the Computer — 27 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

Details on LL and SC These commands work with the cache memory system at a cache line level. Each cache line has a LL bit, which is set by the Load Linked command. The LL bit will be cleared if another process writes to that specific cache line. The SC command works only if the LL bit remains set; otherwise it fails.

Chapter 7 — Multicores, Multiprocessors, and Clusters — 29 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) §7.5 Hardware Multithreading

Chapter 7 — Multicores, Multiprocessors, and Clusters — 30 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

Chapter 7 — Multicores, Multiprocessors, and Clusters — 31 Multithreading Example

Chapter 7 — Multicores, Multiprocessors, and Clusters — 32 Future of Multithreading Will it survive? In what form? Power considerations  simplified microarchitectures Simpler forms of multithreading Tolerating cache-miss latency Thread switch may be most effective Multiple simple cores might share resources more effectively

Chapter 7 — Multicores, Multiprocessors, and Clusters — 33 Instruction and Data Streams An alternate classification §7.6 SISD, MIMD, SIMD, SPMD, and Vector Data Streams SingleMultiple Instruction Streams SingleSISD: Intel Pentium 4 SIMD: SSE instructions of x86 MultipleMISD: No examples today MIMD: Intel Xeon e5345 SPMD: Single Program Multiple Data A parallel program on a MIMD computer Conditional code for different processors

Chapter 7 — Multicores, Multiprocessors, and Clusters — 34 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 — 35 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 — 36 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 load loop: 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

Chapter 7 — Multicores, Multiprocessors, and Clusters — 37 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