Csinparallel.org Patterns and Exemplars: Compelling Strategies for Teaching Parallel and Distributed Computing to CS Undergraduates Libby Shoop Joel Adams.

Slides:



Advertisements
Similar presentations
MINJAE HWANG THAWAN KOOBURAT CS758 CLASS PROJECT FALL 2009 Extending Task-based Programming Model beyond Shared-memory Systems.
Advertisements

Starting Parallel Algorithm Design David Monismith Based on notes from Introduction to Parallel Programming 2 nd Edition by Grama, Gupta, Karypis, and.
1 Programming Explicit Thread-level Parallelism  As noted previously, the programmer must specify how to parallelize  But, want path of least effort.
Open[M]ulti[P]rocessing Pthreads: Programmer explicitly define thread behavior openMP: Compiler and system defines thread behavior Pthreads: Library independent.
PARALLEL PROGRAMMING WITH OPENMP Ing. Andrea Marongiu
Scientific Programming OpenM ulti- P rocessing M essage P assing I nterface.
1 Tuesday, November 07, 2006 “If anything can go wrong, it will.” -Murphy’s Law.
DISTRIBUTED AND HIGH-PERFORMANCE COMPUTING CHAPTER 7: SHARED MEMORY PARALLEL PROGRAMMING.
Computer Architecture II 1 Computer architecture II Programming: POSIX Threads OpenMP.
Message-Passing Programming and MPI CS 524 – High-Performance Computing.
1 ITCS4145/5145, Parallel Programming B. Wilkinson Feb 21, 2012 Programming with Shared Memory Introduction to OpenMP.
A Very Short Introduction to OpenMP Basile Schaeli EPFL – I&C – LSP Vincent Keller EPFL – STI – LIN.
CS 470/570 Lecture 7 Dot Product Examples Odd-even transposition sort More OpenMP Directives.
Parallel and Distributed Computing in CS2013 Mehran Sahami Computer Science Department Stanford University.
Programming with Shared Memory Introduction to OpenMP
CS470/570 Lecture 5 Introduction to OpenMP Compute Pi example OpenMP directives and options.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Chapter 5 Shared Memory Programming with OpenMP An Introduction to Parallel Programming Peter Pacheco.
1 Datamation Sort 1 Million Record Sort using OpenMP and MPI Sammie Carter Department of Computer Science N.C. State University November 18, 2004.
Parallel Programming in Java with Shared Memory Directives.
Lecture 5: Shared-memory Computing with Open MP. Shared Memory Computing.
MPI3 Hybrid Proposal Description
ICOM 5995: Performance Instrumentation and Visualization for High Performance Computer Systems Lecture 7 October 16, 2002 Nayda G. Santiago.
1 OpenMP Writing programs that use OpenMP. Using OpenMP to parallelize many serial for loops with only small changes to the source code. Task parallelism.
OpenMP: Open specifications for Multi-Processing What is OpenMP? Join\Fork model Join\Fork model Variables Variables Explicit parallelism Explicit parallelism.
Hands-On Exploration of Parallelism for Absolute Beginners With Scratch Steven Bogaerts Department of Mathematics & Computer Science Wittenberg University.
Part I MPI from scratch. Part I By: Camilo A. SilvaBIOinformatics Summer 2008 PIRE :: REU :: Cyberbridges.
Spreading Curricular Change in PDC: Some Practical Tools This material is based on work supported by the National Science Foundation under Grant Nos. DUE / /
04/10/25Parallel and Distributed Programming1 Shared-memory Parallel Programming Taura Lab M1 Yuuki Horita.
Chapter 3 Parallel Programming Models. Abstraction Machine Level – Looks at hardware, OS, buffers Architectural models – Looks at interconnection network,
Hybrid MPI and OpenMP Parallel Programming
Work Replication with Parallel Region #pragma omp parallel { for ( j=0; j
Widespread Integration of Parallelism Steven Bogaerts.
Message Passing Programming Model AMANO, Hideharu Textbook pp. 140-147.
Csinparallel.org Patternlets: A Teaching Tool for Introducing Students to Parallel Design Patterns Joel C. Adams Department of Computer Science Calvin.
Early Adopter: Integration of Parallel Topics into the Undergraduate CS Curriculum at Calvin College Joel C. Adams Chair, Department of Computer Science.
CSCI-455/522 Introduction to High Performance Computing Lecture 4.
1 Message Passing Models CEG 4131 Computer Architecture III Miodrag Bolic.
1 "Workshop 31: Developing a Hands-on Undergraduate Parallel Programming Course with Pattern Programming SIGCSE The 44 th ACM Technical Symposium.
© David Kirk/NVIDIA and Wen-mei W. Hwu, ECE408/CS483/498AL, University of Illinois, Urbana-Champaign 1 ECE 408/CS483 Applied Parallel Programming.
Introduction to Parallel Programming at MCSR Message Passing Computing –Processes coordinate and communicate results via calls to message passing library.
A Pattern Language for Parallel Programming Beverly Sanders University of Florida.
2.1 Collective Communication Involves set of processes, defined by an intra-communicator. Message tags not present. Principal collective operations: MPI_BCAST()
3/12/2013Computer Engg, IIT(BHU)1 MPI-1. MESSAGE PASSING INTERFACE A message passing library specification Extended message-passing model Not a language.
3/12/2013Computer Engg, IIT(BHU)1 OpenMP-1. OpenMP is a portable, multiprocessing API for shared memory computers OpenMP is not a “language” Instead,
Heterogeneous Computing using openMP lecture 2 F21DP Distributed and Parallel Technology Sven-Bodo Scholz.
Csinparallel.org Workshop 307: CSinParallel: Using Map-Reduce to Teach Parallel Programming Concepts, Hands-On Dick Brown, St. Olaf College Libby Shoop,
1 ITCS4145 Parallel Programming B. Wilkinson March 23, hybrid-abw.ppt Hybrid Parallel Programming Introduction.
Introduction to OpenMP
Accelerators to Applications
Lecture 5: Shared-memory Computing with Open MP
CS427 Multicore Architecture and Parallel Computing
Open[M]ulti[P]rocessing
Pattern Parallel Programming
Computer Engg, IIT(BHU)
MPI Message Passing Interface
Introduction to OpenMP
September 4, 1997 Parallel Processing (CS 667) Lecture 5: Shared Memory Parallel Programming with OpenMP* Jeremy R. Johnson Parallel Processing.
Computer Science Department
Multi-core CPU Computing Straightforward with OpenMP
Pattern Parallel Programming
September 4, 1997 Parallel Processing (CS 730) Lecture 5: Shared Memory Parallel Programming with OpenMP* Jeremy R. Johnson Wed. Jan. 31, 2001 *Parts.
September 4, 1997 Parallel Processing (CS 730) Lecture 5: Shared Memory Parallel Programming with OpenMP* Jeremy R. Johnson *Parts of this lecture.
Programming with Shared Memory
Hybrid Parallel Programming
Introduction to OpenMP
Programming with Shared Memory
OpenMP Parallel Programming
Mattan Erez The University of Texas at Austin
CS 584 Lecture 8 Assignment?.
Programming Parallel Computers
Presentation transcript:

csinparallel.org Patterns and Exemplars: Compelling Strategies for Teaching Parallel and Distributed Computing to CS Undergraduates Libby Shoop Joel Adams Dick Brown

csinparallel.org Today’s messages Parallel Design Patterns provide an established, practical set of principles for teaching PDC “Exemplar” example applications with multiple implemented solutions provide motivation for students and teaching materials for instructors Patterns and Exemplars fit together naturally and are ready for deployment

csinparallel.org Parallel Design Patterns Following on the original Gang of Four design patterns work Active work on parallel design patterns and parallel pattern languages: Catalog parallel patterns used in solutions and describe a methodology for using the pattern

csinparallel.org Past Work Lea : – Java Concurrency Patterns book Mattson, Saunders, and Massingil : – PPLP book Ralph Johnson et al. : – Parallel Programming Patterns online; books of Visual C++,.NET examples Oretega-Arjona book McCool, Reinders, and Robison book Kreutzer, Mattson, et al. : – Our Pattern Language (OPL) online ParaPLoP Workshop on Parallel Programming Patterns ParaPLoP ‘

csinparallel.org Pattern Approach Using existing design knowledge when designing new parallel programs Leads to parallel software systems that are: – modular, adaptable, understandable and evolve easily Also provides an effective problem-solving framework and a guide for teaching about good parallel solutions

csinparallel.org PATTERNLETS

csinparallel.org Patternlets… … are minimalist, scalable, executable programs, each illustrating a particular pattern’s behavior: – Minimalist so that students can grasp the concept without non-essential details getting in the way – Scalable so that students see different behaviors as the number of threads changes – Executable so that Instructors can use it in a live-coding demo Students can use it in a hands-on exercise Patternlets let students see the pattern in action

csinparallel.org Existing Patternlets (so far) OpenMP – Fork-Join – SPMD – Master-Worker – Parallel For Loop (blocks) – Parallel For Loop (stripes) – Reduction – Private – Atomic – Critical – Critical2 – Sections – Barrier MPI – SPMD – Master-Worker – Message Passing – Parallel For Loop (stripes) – Parallel For Loop (blocks) – Broadcast – Reduction – Scatter – Gather – Barrier

MPI Patternlets OpenMP Patternlets

csinparallel.org /* masterWorker.c (MPI) … */ #include int main(int argc, char** argv) { int id = -1, numProcs= -1, length = -1; char hostName[MPI_MAX_PROCESSOR_NAME]; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &id); MPI_Comm_size(MPI_COMM_WORLD, &numProcs); MPI_Get_processor_name (hostName, &length); if ( id == 0 ) { // process with ID == 0 is the master printf("Greetings from the master, #%d (%s) of %d processes\n”, id, hostName, numProcs); } else { // processes with IDs > 0 are workers printf("Greetings from a worker, #%d (%s) of %d processes\n”, id, hostName, numProcs); } MPI_Finalize(); return 0; }

csinparallel.org Sample Executions $ mpirun -np 1./masterWorker Greetings from the master, #0 (node-01) of 1 processes $ mpirun –np 8./masterWorker Greetings from the master, #0 (node-01) of 8 processes Greetings from a worker, #1 (node-02) of 8 processes Greetings from a worker, #5 (node-06) of 8 processes Greetings from a worker, #3 (node-04) of 8 processes Greetings from a worker, #4 (node-05) of 8 processes Greetings from a worker, #7 (node-08) of 8 processes Greetings from a worker, #2 (node-03) of 8 processes Greetings from a worker, #6 (node-07) of 8 processes

csinparallel.org /* masterWorker.c (OpenMP) … */ #include int main(int argc, char** argv) { int id = -1, numThreads = -1; // #pragma omp parallel { id = omp_get_thread_num(); numThreads = omp_get_num_threads(); if ( id == 0 ) { // thread with ID 0 is master printf(”Greetings from the master, #%d of %d threads\n\n”, id, numThreads); } else { // threads with IDs > 0 are workers printf(”Greetings from a worker, #%d of %d threads\n\n”, id, numThreads); } return 0; }

csinparallel.org Sample Executions $./masterWorker// pragma omp parallel disabled Greetings from the master, #0 of 1 threads $./masterWorker// pragma omp parallel enabled Greetings from a worker, #1 of 8 threads Greetings from a worker, #2 of 8 threads Greetings from a worker, #5 of 8 threads Greetings from a worker, #3 of 8 threads Greetings from a worker, #6 of 8 threads Greetings from the master, #0 of 8 threads Greetings from a worker, #4 of 8 threads Greetings from a worker, #7 of 8 threads

csinparallel.org EXEMPLARS

csinparallel.org Motivation Everyone in CS needs PDC Not everyone is naturally drawn to PDC topics How shall we motivate every CS undergraduate to learn the PDC they will need for their careers?

csinparallel.org Motivation Everyone in CS needs PDC Not everyone is naturally drawn to PDC topics Proposal: Teach PDC concepts with compelling applications. Some CS students draw by concepts and tech Other CS students drawn by the applications How shall we motivate every CS undergraduate to learn the PDC they will need for their careers?

csinparallel.org Exemplars An exemplar is: A representative applied problem plus multiple code solutions implemented in various PDC technologies, with commentary

csinparallel.org Exemplar A (from EAPF Practicum) Compute π via numerical integration Implemented solutions – Serial – Shared memory (OpenMP, TBB, pthreads, Windows Threads, go language) – Distributed computing (MPI) – Accelerators (CUDA, Array Building Blocks) Comments: – Flexible uses: demo, concepts, tech, compare – But not a compelling application

csinparallel.org Exemplar B (from EAPF Practicum) Drug design Implemented solutions – Serial – Shared memory (OpenMP, boost threads, go lang) – Map-reduce framework (Hadoop)

csinparallel.org Exemplar B (from EAPF Practicum) Comments – Compelling application – Molecular dynamics, docking algorithm – Substitute for docking algorithm to score ligands: (score is maximal match count) Relates to genetic alignment algorithm Multiple ways to scale: # ligands, ligand length, # cores Random strings with random lengths for variable computational load per ligand

csinparallel.org Exemplars + Patterns Exemplar implementations offer a rich opportunity for learning patterns Examples – π as area (among 8 PDC implementations): Data Decomposition, Geometric Decomposition; Parallel For Loop, Master-Worker, Strict Data Parallel, Distributed Array; SIMD, Thread Pool, Message Passing, Collective Communication, Mutual Exclusion – Drug design (among 4 PDC implementations): Map-Reduce; Data Decomposition; Parallel For Loop, Fork- Join, BSP, Master-Worker, Task Queue, Shared Array, Shared Queue; Thread Pool, Message Passing, Mutual Exclusion

Drug design π as area

csinparallel.org Conclusion Patterns – a meaning for “parallel thinking,” best practice from industry Patternlets – minimalist, scalable, executable programs, each illustrating a particular pattern’s behavior Exemplars – motivation, hands-on/demo, teaching resource, opportunities for PDC These are naturally combined and ready for deployment