Lecture 2 Introduction to Multicore Computing BongSoo Sohn

Lecture 2 : Introduction to Multicore Computing Bong-Soo Sohn Associate Professor School of Computer Science and Engineering Chung-Ang University

What is Parallel Computing? n Parallel computing n n Examples of parallel machines: n n using multiple processors in parallel to solve problems more quickly than with a single processor A cluster computer that contains multiple PCs combined together with a high speed network A shared memory multiprocessor by connecting multiple processors to a single memory system A Chip Multi-Processor (CMP) contains multiple processors (called cores) on a single chip Concurrent execution comes from desire for performance; unlike the inherent concurrency in a multi-user distributed system

Multicore Computer n composed of two or more independent cores n n Core (CPU): computing unit that reads/executes program instructions Ex) dual-core, quad-core, hexa-core, octa-core, … share cache or not symmetric or asymmetric n Cores are integrated onto a single integrated circuit die (CMP : Chip Multi-Processor) n or they may be integrated onto multiple dies in a single chip package

Multicore Computer n performance gained by multi-core processor n strongly dependent on the software algorithms and implementation. Dual-Core CPU

Manycore processor n multi-core architectures with an especially high number of cores (tens or hundreds or even more) n CUDA n n Compute Unified Device Architecture parallel computing platform and programming model created by NVIDIA and implemented by the graphics processing units (GPUs) that they produce

Parallel Programming Techniques n Shared Memory n n Open. MP, pthreads Distributed Memory n MPI n Distributed/Shared Memory n Hybrid (MPI+Open. MP) n GPU Parallel Programming n n CUDA programming (NVIDIA) Open. CL

Parallel Processing Systems n Small-Scale Multicore Environment n n n Notebook, Workstation, Server OS supports multicore POSIX threads (pthread) , win 32 thread GPGPU-based supercomputer Development of CUDA/Open. CL/GPGPU Large-Scale Multicore Environment n n Supercomputer : more than 10, 000 cores Clusters Servers Grid Computing

Parallel Computing vs. Distributed Computing n Parallel Computing n n n all processors may have access to a shared memory to exchange information between processors. more tightly coupled to multi-threading Distributed Computing n n n multiple computers communicate through network each processor has its own private memory (distributed memory). executing sub-tasks on different machines and then merging the results.

Parallel Computing vs. Distributed Computing Parallel Computing n No Clear Distinction

Cluster Computing vs. Grid Computing n Cluster Computing n n a set of loosely connected computers that work together so that in many respects they can be viewed as a single system good price / performance memory not shared Grid Computing n n federation of computer resources from multiple locations to reach a common goal (a large scale distributed system) grids tend to be more loosely coupled, heterogeneous, and geographically dispersed

Cluster Computing vs. Grid Computing

Cloud Computing n shares networked computing resources rather than having local servers or personal devices to handle applications. n “Cloud” is used as a metaphor for “Internet" meaning "a type of Internet-based computing, “ n different services - such as servers, storage and applications - are delivered to an user’s computers and smart phones through the Internet.

Good Parallel Program n Writing good parallel programs n n n Correct (Result) Good Performance Scalability Load Balance Portability Hardware Specific Utilization

Moore’s Law : Review Doubling of the number of transistors on integrated circuits roughly every two years. n Microprocessors have become smaller, denser, and more powerful. n processing speed, memory capacity, sensors and even the number and size of pixels in digital cameras. All of these are improving at (roughly) exponential rates n

Computer Hardware Trend n Chip density is continuing increase ~2 x every 2 years Clock speed is not (in high clock speed, power consumption and heat generation is too high to be tolerated. ) n # of cores may double instead n No more hidden parallelism (ILP; instruction level parallelism) to be found n Transistor# still rising n Clock speed flattening sharply n n Need Multicore programming! Source: Intel, Microsoft (Sutter) and Stanford (Olukotun, Hammond)


Examples of Parallel Computer n Chip Multi. Processor (CMP) n n n Symmetric Multiprocessor (SMP) n n Intel Core Duo AMD Dual Core Sun Fire E 25 K Heterogeneous Chips n Cell Processor Clusters n Supercomputers n

Intel Core Duo Two 32 -bit Pentium processors n Each has its own 32 K L 1 cache n Shared 2 MB or 4 MB L 2 cache n Fast communication through shared L 2 n Coherent shared memory n

AMD Dual Core Opteron Each with 64 K L 1 cache n Each with 1 MB L 2 cache n Coherent shared memory n

Intel vs. AMD n Main difference : L 2 cache position n AMD n n More core private memory Easier to share cache coherency info with other CPUs Preferred in multi chip systems Intel n n n Core can use more of the shared L 2 at times Lower latency communication between cores Preferred in single chip systems

Generic SMP n Symmetric Multi. Processor (SMP) System n n n n multiprocessor hardware architecture two or more identical processors are connected to a single shared memory controlled by a single OS instance Most common multiprocessor systems today use an SMP architecture Both Multicore and multi-CPU Single logical memory image Shared bus often bottleneck

GPGPU : NVIDIA GPU n Tesla K 20 n n n GPU : 1 Kepler GK 110 2496 cores; 706 MHz Tpeak 3. 52 Tflop/s – 32 bit floating point Tpeak 1. 17 Tflop/s – 64 bit floating point GTX 680 n 1536 CUDA cores; 1. 0 GHz

Hybrid Programming Model Main CPU performs hard to parallelize portion n Attached processor (GPU) performs compute intensive parts n

Summary n All computers are now parallel computers! n Multi-core processors represent an important new trend in computer architecture. n n n Decreased power consumption and heat generation. Minimized wire lengths and interconnect latencies. They enable true thread-level parallelism with great energy efficiency and scalability.

Summary n To utilize their full potential, applications will need to move from a single to a multi-threaded model. n n n Parallel programming techniques likely to gain importance. Hardware/Software the software industry needs to get back into the state where existing applications run faster on new hardware.

Why writing (fast) parallel programs is hard

Principles of Parallel Computing n n n Finding enough parallelism (Amdahl’s Law) granularity Locality Load balance Coordination and synchronization All of these things makes parallel programming even harder than sequential programming.

Finding Enough Parallelism Suppose only part of an application seems parallel n Amdahl’s law n n n let s be the fraction of work done sequentially, so (1 -s) is fraction parallelizable P = number of processors Speedup(P) = Time(1)/Time(P) <= 1/(s + (1 -s)/P) <= 1/s • Even if the parallel part speeds up perfectly performance is limited by the sequential part

Overhead of Parallelism n Given enough parallel work, this is the biggest barrier to getting desired speedup n Parallelism overheads include: n n cost of starting a thread or process cost of communicating shared data cost of synchronizing extra (redundant) computation n Each of these can be in the range of milliseconds (=millions of flops) on some systems n Tradeoff: Algorithm needs sufficiently large units of work to run fast in parallel (I. e. large granularity), but not so large that there is not enough parallel work

Locality and Parallelism Conventional Storage Proc Hierarchy Cache L 2 Cache n n L 3 Cache Memory Large memories are slow, fast memories are small Storage hierarchies are large and fast on average Parallel processors, collectively, have large, fast cache n n L 3 Cache the slow accesses to “remote” data we call “communication” Algorithm should do most work on local data potential interconnects n Proc Cache L 2 Cache

Load Imbalance n Load imbalance is the time that some processors in the system are idle due to n n n insufficient parallelism (during that phase) unequal size tasks Algorithm needs to balance load
- Slides: 31