cs140-multicoreintro

cs140-multicoreintro - CS140:Jan27Feb3,2010...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS 140 :  Jan 27 – Feb 3, 2010 Multicore (and Shared Memory)  Programming with Cilk++   Multicore and NUMA  architectures   Multithreaded  Programming   Cilk++ as a concurrency  Thanks to  Charles E. Leiserson for some of these slides
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Multicore Architecture Memory I/O $ $ $ Chip Multiprocessor (CMP) core core core
Background image of page 2
3 cc-NUMA Architectures AMD 8-way Opteron Server (neumann@cs.ucsb.edu) A processor  (CMP) with  2/4 cores  Memory bank  local to a  processor 
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 cc-NUMA Architectures No Front Side Bus Integrated memory controller  On-die interconnect among CMPs  Main memory is physically distributed  among  CMPs (i.e. each piece of memory has an  affinity to a CMP) NUMA: Non-uniform memory access. § For multi-socket servers only  § Your desktop is safe (well, for now at least) § Triton nodes are also NUMA !
Background image of page 4
5 Desktop Multicores Today This is your AMD Shangai or Intel Core i7 (Nehalem) ! On-die  interconnect  Private cache:  Cache  coherence is  required 
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Multithreaded Programming thread of execution  is a fork of a computer  program into two or more concurrently running  tasks.  POSIX Threads (Pthreads) is a set of  threading interfaces developed by the IEEE Assembly of shared memory programming Programmer has to manually: § Create and terminating threads § Wait for threads to complete  § Manage the interaction between threads using  mutexes, condition variables, etc.
Background image of page 6
7 Concurrency Platforms Programming directly on PThreads is painful  and error-prone. With PThreads, you either sacrifice memory usage or load-balance among  processors  concurrency platform  provides linguistic support and handles load  balancing. Examples:  Threading Building Blocks (TBB)  OpenMP   Cilk++ Ahh!  Sigh! 
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Cilk vs. PThreads How will the following code execute in  PThreads?  In Cilk? for (i=1; i<1000000000; i++) { spawn-or-fork foo(i); } sync-or-join; What if  foo  contains code that waits (e.g., spins) on a  variable being set by another instance of foo? This different is a liveness property: Cilk threads are spawned lazily, “may” parallelism PThreads are spawned eagerly, “must” parallelism
Background image of page 8
9 Cilk vs. OpenMP Cilk++ guarantees space bounds. On P  processors, Cilk++ uses no more than P  times the stack space of a serial execution.  Cilk++ has serial semantics.  Cilk++ has a solution for global variables (a  construct called "hyperobjects")  Cilk++ has nested parallelism that works and  provides guaranteed speed-up.  Cilk++ has a race detector for debugging and  software release. 
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 Great, how do we program it? Cilk++ is a faithful extension of C++
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/27/2011 for the course CMPSC 140 taught by Professor Gilbert during the Fall '11 term at UCSB.

Page1 / 32

cs140-multicoreintro - CS140:Jan27Feb3,2010...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online