1 Cilk Chao Huang CS498LVK. 2 Introduction A multithreaded parallel programming language Effective for exploiting dynamic, asynchronous parallelism (Chess.

Slides:



Advertisements
Similar presentations
Multi-core Computing Lecture 3 MADALGO Summer School 2012 Algorithms for Modern Parallel and Distributed Models Phillip B. Gibbons Intel Labs Pittsburgh.
Advertisements

© 2009 Charles E. Leiserson and Pablo Halpern1 Introduction to Cilk++ Programming PADTAD July 20, 2009 Cilk, Cilk++, Cilkview, and Cilkscreen, are trademarks.
IBM Research: Software Technology © 2006 IBM Corporation 1 Programming Language X10 Christoph von Praun IBM Research HPC WPL Sandia National Labs December.
Fine-grain Task Aggregation and Coordination on GPUs
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
MINJAE HWANG THAWAN KOOBURAT CS758 CLASS PROJECT FALL 2009 Extending Task-based Programming Model beyond Shared-memory Systems.
1 CS 240A : Numerical Examples in Shared Memory with Cilk++ Matrix-matrix multiplication Matrix-vector multiplication Hyperobjects Thanks to Charles E.
Cilk NOW Based on a paper by Robert D. Blumofe & Philip A. Lisiecki.
U NIVERSITY OF M ASSACHUSETTS, A MHERST – Department of Computer Science The Implementation of the Cilk-5 Multithreaded Language (Frigo, Leiserson, and.
CILK: An Efficient Multithreaded Runtime System. People n Project at MIT & now at UT Austin –Bobby Blumofe (now UT Austin, Akamai) –Chris Joerg –Brad.
Parallelizing Incremental Bayesian Segmentation (IBS) Joseph Hastings Sid Sen.
Nested Parallelism in Transactional Memory Kunal Agrawal, Jeremy T. Fineman and Jim Sukha MIT.
Parallelizing C Programs Using Cilk Mahdi Javadi.
Stacks and HeapsCS-3013 A-term A Short Digression on Stacks and Heaps CS-3013 Operating Systems A-term 2008 (Slides include materials from Modern.
Threads Section 2.2. Introduction to threads A thread (of execution) is a light-weight process –Threads reside within processes. –They share one address.
Digression on Stack and Heaps CS-502 (EMC) Fall A Short Digression on Stacks and Heaps CS-502, Operating Systems Fall 2009 (EMC) (Slides include.
Image Processing Using Cilk 1 Parallel Processing – Final Project Image Processing Using Cilk Tomer Y & Tuval A (pp25)
ISBN Chapter 10 Implementing Subprograms.
Compiling Application-Specific Hardware Mihai Budiu Seth Copen Goldstein Carnegie Mellon University.
Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
1 CSCI 360 Survey Of Programming Languages 9 – Implementing Subprograms Spring, 2008 Doug L Hoffman, PhD.
Chapter 10 Implementing Subprograms. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Semantics of Call and Return The subprogram call and return.
Cilk CISC 879 Parallel Computation Erhan Atilla Avinal.
Juan Mendivelso.  Serial Algorithms: Suitable for running on an uniprocessor computer in which only one instruction executes at a time.  Parallel Algorithms:
Computer Systems Research at UNT 1 A Multithreaded Architecture Krishna Kavi (with minor modifcations)
Multithreaded Programming in Cilk L ECTURE 2 Charles E. Leiserson Supercomputing Technologies Research Group Computer Science and Artificial Intelligence.
Introduction to Processes CS Intoduction to Operating Systems.
Object Oriented Analysis & Design SDL Threads. Contents 2  Processes  Thread Concepts  Creating threads  Critical sections  Synchronizing threads.
Multithreaded Programming in Cilk L ECTURE 3 Charles E. Leiserson Supercomputing Technologies Research Group Computer Science and Artificial Intelligence.
Overview Work-stealing scheduler O(pS 1 ) worst case space small overhead Narlikar scheduler 1 O(S 1 +pKT  ) worst case space large overhead Hybrid scheduler.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Continuations And Java Regis -
1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads.
Frequent Itemset Mining on Graphics Processors, Fang et al., DaMoN Turbo-charging Vertical Mining of Large Databases, Shenoy et al., MOD NVIDIA.
Parallelizing MiniSat I-Ting Angelina Lee Justin Zhang May 05, Final Project Presentation.
Cilk Pousse James Process CS534. Overview Introduction to Pousse Searching Evaluation Function Move Ordering Conclusion.
Parallel Computing CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
ISBN Chapter 10 Implementing Subprograms.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
P ARALLEL P ROCESSING F INAL P RESENTATION CILK Eliran Ben Moshe Neriya Cohen.
Scheduling Multithreaded Computations By Work-Stealing Robert D. Blumofe The University of Texas, Austin Charles E. Leiserson, MIT Laboratory for Computer.
10-1 Chapter 10: Implementing Subprograms The General Semantics of Calls and Returns Implementing “Simple” Subprograms Implementing Subprograms with Stack-Dynamic.
ISBN Chapter 10 Implementing Subprograms.
Implementing Subprograms
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
ISBN Chapter 10 Implementing Subprograms.
© 2004 Goodrich, Tamassia Queues. © 2004 Goodrich, Tamassia Stacks2 The Queue ADT The Queue ADT stores arbitrary objects Insertions and deletions follow.
Advanced Programming in C
Implementing Subprograms
CILK: An Efficient Multithreaded Runtime System
Process concept.
CMPS 5433 Programming Models
Prabhanjan Kambadur, Open Systems Lab, Indiana University
CSE4102/5102 Team Project A Study of Parallel Programming Languages
Multithreaded Programming in Java
Implementing Subprograms
Nachos Assignment#2 Priority Scheduling.
Multithreaded Programming in Cilk LECTURE 1
Multithreaded Programming
Introduction to CILK Some slides are from:
Threads Chapter 5 2/17/2019 B.Ramamurthy.
Transactions with Nested Parallelism
Threads Chapter 5 2/23/2019 B.Ramamurthy.
Cilk A C language for programming dynamic multithreaded applications on shared-memory multiprocessors. Example applications: virus shell assembly graphics.
Why we have Counterintuitive Memory Models
Threads and Multithreading
Cilk and Writing Code for Hardware
Introduction to CILK Some slides are from:
Implementing Subprograms
Java Chapter 3 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

1 Cilk Chao Huang CS498LVK

2 Introduction A multithreaded parallel programming language Effective for exploiting dynamic, asynchronous parallelism (Chess games) Developed by the Supercomputing Technologies Group under Prof. Charles E. Leiserson at MIT

3 Cilk Keywords spawn : indicates the procedure can operate in parallel with other code; the scheduler decides whether to execute it on a new thread or not sync : indicates that the current procedure cannot proceed until all previous spawned procedures have completed and returned C elision of a Cilk program is a valid C program

4 Example (1) cilk int fib (int n) { if (n < 2) return n; else { int x, y; x = spawn fib (n-1); y = spawn fib (n-2); sync; return (x+y); }

5 Cilk Keywords inlet : identifies a function inside the procedure as an inlet An inlet is a C function internal to a Cilk procedure which handles the returned results of a spawned procedure call Allows more complex way of handling return value in the parent’s frame

6 Example (2) cilk int fib (int n) { int x = 0; inlet void sum (int result) { x += result; return; } if (n<2) return n; else { sum(spawn fib (n-1)); sum(spawn fib (n-2)); sync; return (x); }

7 Example (3) cilk int fib (int n) { int x = 0; if (n<2) return n; else { /* implicit inlets */ x += spawn fib (n-1); x += spawn fib (n-2); sync; return (x); }

8 Cilk Keywords abort : indicates that other procedures that have been spawned off by the parent procedure can be safely aborted Useful in speculative work such as space searching

9 Cilk Keywords cilk void baz(int n); cilk void foo(int n) { inlet void bar() { abort; } bar(spawn baz(17)); spawn baz(28); sync; }

10 Implementation Scheduling scheme: work-stealing  Ready procedures are put on a double-ended queue  The processor restores suspended procedures from the end of the deque they have been stored  Underloaded processors steal work from other processors’ queues at the other end of the deque

11 Important Applications Parallel chess programs  Cilkchess  *Socrates  Parallel gomoku