Distributed Systems CS

Slides:



Advertisements
Similar presentations
Multiple Processor Systems
Advertisements

Distributed Systems CS
SE-292 High Performance Computing
Multiprocessors— Large vs. Small Scale Multiprocessors— Large vs. Small Scale.
May 2, 2015©2006 Craig Zilles1 (Easily) Exposing Thread-level Parallelism  Previously, we introduced Multi-Core Processors —and the (atomic) instructions.
Multiple Processor Systems
Parallel System Performance CS 524 – High-Performance Computing.
An Introduction To PARALLEL PROGRAMMING Ing. Andrea Marongiu
1 Lecture 1: Parallel Architecture Intro Course organization:  ~5 lectures based on Culler-Singh textbook  ~5 lectures based on Larus-Rajwar textbook.
An Introduction to Parallel Computing Dr. David Cronk Innovative Computing Lab University of Tennessee Distribution A: Approved for public release; distribution.
Multiprocessors CSE 471 Aut 011 Multiprocessors - Flynn’s Taxonomy (1966) Single Instruction stream, Single Data stream (SISD) –Conventional uniprocessor.
1 CSE SUNY New Paltz Chapter Nine Multiprocessors.
Parallel System Performance CS 524 – High-Performance Computing.
Distributed Systems CS Programming Models- Part I Lecture 16, Oct 31, 2011 Majd F. Sakr, Mohammad Hammoud andVinay Kolar 1.
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.
Introduction to Symmetric Multiprocessors Süha TUNA Bilişim Enstitüsü UHeM Yaz Çalıştayı
Computer System Architectures Computer System Software
18-447: Computer Architecture Lecture 30B: Multiprocessors Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 4/22/2013.
Multiple Processor Systems. Multiprocessor Systems Continuous need for faster and powerful computers –shared memory model ( access nsec) –message passing.
1 Interconnects Shared address space and message passing computers can be constructed by connecting processors and memory unit using a variety of interconnection.
Data Warehousing 1 Lecture-24 Need for Speed: Parallelism Virtual University of Pakistan Ahsan Abdullah Assoc. Prof. & Head Center for Agro-Informatics.
Introduction, background, jargon Jakub Yaghob. Literature T.G.Mattson, B.A.Sanders, B.L.Massingill: Patterns for Parallel Programming, Addison- Wesley,
Multiple Processor Systems Chapter Multiprocessors 8.2 Multicomputers 8.3 Distributed systems.
Distributed Systems CS /640 Programming Models Borrowed and adapted from our good friends at CMU-Doha, Qatar Majd F. Sakr, Mohammad Hammoud andVinay.
Distributed Systems CS Programming Models Gregory Kesden Borrowed and adapted from our good friends at CMU-Doha, Qatar Majd F. Sakr, Mohammad Hammoud.
Chapter 2: Parallel Programming Models Yan Solihin Copyright notice: No part of this publication may be reproduced, stored in a retrieval.
TM Parallel Concepts An introduction. TM The Goal of Parallelization Reduction of elapsed time of a program Reduction in turnaround time of jobs Overhead:
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,
1 Lecture 17: Multiprocessors Topics: multiprocessor intro and taxonomy, symmetric shared-memory multiprocessors (Sections )
Background Computer System Architectures Computer System Software.
Introduction Goal: connecting multiple computers to get higher performance – Multiprocessors – Scalability, availability, power efficiency Job-level (process-level)
INTRODUCTION TO HIGH PERFORMANCE COMPUTING AND TERMINOLOGY.
Group Members Hamza Zahid (131391) Fahad Nadeem khan Abdual Hannan AIR UNIVERSITY MULTAN CAMPUS.
Chapter 4: Threads Modified by Dr. Neerja Mhaskar for CS 3SH3.
Introduction to Parallel Computing: MPI, OpenMP and Hybrid Programming
Introduction to Parallel Computing: MPI, OpenMP and Hybrid Programming
18-447: Computer Architecture Lecture 30B: Multiprocessors
Introduction to parallel programming
CS5102 High Performance Computer Systems Thread-Level Parallelism
Distributed Processors
The University of Adelaide, School of Computer Science
CS 147 – Parallel Processing
September 4, 1997 Parallel Processing (CS 667) Lecture 5: Shared Memory Parallel Programming with OpenMP* Jeremy R. Johnson Parallel Processing.
Multi-Processing in High Performance Computer Architecture:
CMSC 611: Advanced Computer Architecture
Distributed Systems CS
Guoliang Chen Parallel Computing Guoliang Chen
Lecture 1: Parallel Architecture Intro
Kai Bu 13 Multiprocessors So today, we’ll finish the last part of our lecture sessions, multiprocessors.
Multiprocessors - Flynn’s taxonomy (1966)
Multiple Processor Systems
CS 213: Parallel Processing Architectures
Introduction to Multiprocessors
Lecture 24: Memory, VM, Multiproc
Distributed Systems CS
Distributed Systems CS
Chapter 4: Threads & Concurrency
Chapter 4 Multiprocessors
The University of Adelaide, School of Computer Science
Lecture 17 Multiprocessors and Thread-Level Parallelism
Lecture 24: Virtual Memory, Multiprocessors
Lecture 23: Virtual Memory, Multiprocessors
Database System Architectures
Lecture 17 Multiprocessors and Thread-Level Parallelism
CSL718 : Multiprocessors 13th April, 2006 Introduction
Operating System Overview
The University of Adelaide, School of Computer Science
Lecture 17 Multiprocessors and Thread-Level Parallelism
Presentation transcript:

Distributed Systems CS 15-440 Programming Models- Part I Lecture 13, Oct 23, 2013 Mohammad Hammoud

Today… Part 1 of the Session: Consistency and Replication- Part IV Programming Models – Part I

Discussion on Programming Models Objectives Discussion on Programming Models MapReduce, Pregel and GraphLab Message Passing Interface (MPI) Types of Parallel Programs Traditional models of parallel programming Parallel computer architectures Why parallelism? Why parallelism?

Amdahl’s Law We parallelize our programs in order to run them faster How much faster will a parallel program run? Suppose that the sequential execution of a program takes T1 time units and the parallel execution on p processors takes Tp time units Suppose that out of the entire execution of the program, s fraction of it is not parallelizable while 1-s fraction is parallelizable Then the speedup (Amdahl’s formula):  

Amdahl’s Law: An Example Suppose that 80% of your program can be parallelized and that you use 4 processors to run your parallel version of the program The speedup you can get according to Amdahl’s law is: Although you use 4 processors you cannot get a speedup more than 2.5 times!  

Real Vs. Actual Cases Amdahl’s argument is too simplified to be applied to real cases When we run a parallel program, there are a communication overhead and a workload imbalance among processes (in general) 20 80 20 80 Serial Serial Parallel 20 20 Parallel 20 20 Process 1 Process 1 Process 2 Process 2 Cannot be parallelized Process 3 Process 3 Cannot be parallelized Can be parallelized Communication overhead Process 4 Can be parallelized Process 4 Load Unbalance 1. Parallel Speed-up: An Ideal Case 2. Parallel Speed-up: An Actual Case

Guidelines In order to efficiently benefit from parallelization, we ought to follow these guidelines: Maximize the fraction of our program that can be parallelized Balance the workload of parallel processes Minimize the time spent for communication

Discussion on Programming Models Objectives Discussion on Programming Models MapReduce, Pregel and GraphLab Message Passing Interface (MPI) Types of Parallel Programs Traditional models of parallel programming Parallel computer architectures Parallel computer architectures Why parallelism?

Parallel Computer Architectures We can categorize the architecture of parallel computers in terms of two aspects: Whether the memory is physically centralized or distributed Whether or not the address space is shared Memory Address Space Shared Individual Centralized SMP (Symmetric Multiprocessor) N/A Distributed NUMA (Non-Uniform Memory Access) MPP (Massively Parallel Processors) Memory Address Space Shared Individual Centralized UMA – SMP (Symmetric Multiprocessor) N/A Distributed NUMA (Non-Uniform Memory Access) MPP (Massively Parallel Processors) Memory Address Space Shared Individual Centralized SMP (Symmetric Multiprocessor) N/A Distributed NUMA (Non-Uniform Memory Access) MPP (Massively Parallel Processors) Memory Address Space Shared Individual Centralized SMP (Symmetric Multiprocessor) N/A Distributed NUMA (Non-Uniform Memory Access) MPP (Massively Parallel Processors) Memory Address Space Shared Individual Centralized SMP (Symmetric Multiprocessor) N/A Distributed NUMA (Non-Uniform Memory Access) MPP (Massively Parallel Processors)

Symmetric Multiprocessor Symmetric Multiprocessor (SMP) architecture uses shared system resources that can be accessed equally from all processors Usually, a single OS controls the SMP machine and it schedules processes and threads on processors so that the load is balanced Processor Processor Processor Processor Cache Cache Cache Cache Bus or Crossbar Switch Memory I/O

Massively Parallel Processors Massively Parallel Processors (MPP) architecture consists of nodes with each having its own processor, memory and I/O subsystem An independent OS runs at each node Interconnection Network Processor Processor Processor Processor Cache Cache Cache Cache Bus Bus Bus Bus Memory I/O Memory I/O Memory I/O Memory I/O

Non-Uniform Memory Access Non-Uniform Memory Access (NUMA) architecture machines are built on a similar hardware model as MPP NUMA typically provides a shared address space to applications using a hardware/software directory-based coherence protocol The memory latency varies according to whether the memory is accessed directly (locally) or through the interconnect (remotely) As in an SMP machine, usually a single OS controls the whole system

Discussion on Programming Models Objectives Discussion on Programming Models MapReduce, Pregel and GraphLab Message Passing Interface (MPI) Types of Parallel Programs Traditional Models of parallel programming Traditional Models of parallel programming Parallel computer architectures Why parallelizing our programs?

Models of Parallel Programming What is a parallel programming model? A programming model is an abstraction provided by the hardware to programmers It determines how easily programmers can specify their algorithms into parallel units of computations (i.e., tasks) that the hardware understands It determines how efficiently parallel tasks can be executed on the hardware Main Goal: utilize all the processors of the underlying architecture (e.g., SMP, MPP, NUMA, and Distributed Systems) and minimize the elapsed time of your program

Traditional Parallel Programming Models Shared Memory Message Passing Message Passing

Shared Memory Model In the shared memory programming model, the abstraction provided implies that parallel tasks can access any location of the memory Accordingly, parallel tasks can communicate through reading and writing common memory locations This is similar to threads in a single process (in traditional OSs), which share a single address space Multi-threaded programs (e.g., OpenMP programs) use the shared memory programming model

Shared Memory Model Si = Serial Pj = Parallel Single Thread Multi-Thread S1 S1 Time Time Spawn P1 P1 P2 P3 P3 P2 P3 Join S2 Shared Address Space P4 S2 Process Process

Shared Memory Example Sequential Parallel begin parallel // spawn a child thread private int start_iter, end_iter, i; shared int local_iter=4, sum=0; shared double sum=0.0, a[], b[], c[]; shared lock_type mylock; start_iter = getid() * local_iter; end_iter = start_iter + local_iter; for (i=start_iter; i<end_iter; i++) a[i] = b[i] + c[i]; barrier; if (a[i] > 0) { lock(mylock); sum = sum + a[i]; unlock(mylock); } barrier; // necessary end parallel // kill the child thread Print sum; for (i=0; i<8; i++) a[i] = b[i] + c[i]; sum = 0; if (a[i] > 0) sum = sum + a[i]; Print sum; Sequential Parallel

Traditional Parallel Programming Models Shared Memory Shared Memory Message Passing

Message Passing Model In message passing, parallel tasks have their own local memories One task cannot access another task’s memory Hence, tasks have to rely on explicit messages to communicate This is similar to the abstraction of processes in traditional OSs, which do not share address spaces MPI programs use the message passing programming model

Message Passing Model Single Thread Message Passing S = Serial P = Parallel S1 S1 S1 S1 S1 Time Time P1 P1 P1 P1 P1 P2 S2 S2 S2 S2 P3 P4 Process 0 Process 1 Process 2 Process 3 S2 Node 1 Node 2 Node 3 Node 4 Data transmission over the Network Process

Message Passing Example id = getpid(); local_iter = 4; start_iter = id * local_iter; end_iter = start_iter + local_iter; if (id == 0) send_msg (P1, b[4..7], c[4..7]); else recv_msg (P0, b[4..7], c[4..7]); for (i=start_iter; i<end_iter; i++) a[i] = b[i] + c[i]; local_sum = 0; if (a[i] > 0) local_sum = local_sum + a[i]; if (id == 0) { recv_msg (P1, &local_sum1); sum = local_sum + local_sum1; Print sum; } send_msg (P0, local_sum); for (i=0; i<8; i++) a[i] = b[i] + c[i]; sum = 0; if (a[i] > 0) sum = sum + a[i]; Print sum; Sequential Parallel

Shared Memory Vs. Message Passing Comparison between the shared memory and message passing programming models: Aspect Shared Memory Message Passing Communication Implicit (via loads/stores) Explicit Messages Synchronization Explicit Implicit (Via Messages) Hardware Support Typically Required None Development Effort Lower Higher Tuning Effort Aspect Shared Memory Message Passing Communication Implicit (via loads/stores) Explicit Messages Synchronization Explicit Implicit (Via Messages) Hardware Support Typically Required None Development Effort Lower Higher Tuning Effort Aspect Shared Memory Message Passing Communication Implicit (via loads/stores) Explicit Messages Synchronization Explicit Implicit (Via Messages) Hardware Support Typically Required None Development Effort Lower Higher Tuning Effort Aspect Shared Memory Message Passing Communication Implicit (via loads/stores) Explicit Messages Synchronization Explicit Implicit (Via Messages) Hardware Support Typically Required None Development Effort Lower Higher Tuning Effort Aspect Shared Memory Message Passing Communication Implicit (via loads/stores) Explicit Messages Synchronization Explicit Implicit (Via Messages) Hardware Support Typically Required None Development Effort Lower Higher Tuning Effort

Next Class Discussion on Programming Models MapReduce, Pregel and GraphLab Message Passing Interface (MPI) Types of Parallel Programs Traditional Models of parallel programming Parallel computer architectures Why parallelizing our programs? Programming Models- Part II