02-11-2012, 06:09 PM
Multicore Programming and Cilk++
Multicore Programming.doc (Size: 373.5 KB / Downloads: 25)
MULTICORE.ppt (Size: 1.53 MB / Downloads: 24)
ABSTRACT
A multi-core processor is a processing system composed of two or more independent cores (or CPU’s). The multi core CPU’s provides far more computing power and at reduced cost.
Building multicore processors delivers on the promise of Moore's Law, but it creates an enormous problem for developers. Multicore processors are parallel computers, and parallel computers are notoriously difficult to program. To deliver competitive application performance on these new processors, many applications must be written (or rewritten) as parallel, multithreaded applications. Multithreaded development can be difficult, expensive, time‐consuming, and error‐prone and it requires new programming skill sets. Organizations need a solution to meet the multicore software challenge.
Cilk is a language for multithreaded parallel programming based on ANSI C. It is designed for general-purpose parallel programming, but is especially effective for exploiting dynamic, highly asynchronous parallelism, which can be difficult to write in data-parallel or message-passing style. Cilk++, from Cilk Arts(2008), extends C++ into the multicore realm without sacrificing serial semantics. Cilk++ was inspired by the award winning MIT Cilk project, which pioneered key ideas in multithreading, including the “work stealing” strategy for scheduling. The Cilk++ cross platform solution offers the easiest, quickest and most reliable way to maximize application performance on multicore processors. Cilk++ provides a simple set of extensions for C++, coupled with a powerful runtime system for multicore enabled applications. Cilk++ enables rapid development, testing, and deployment of high performance multicore applications. With Cilk++, you can retain the serial semantics of your existing applications, use existing serial methodologies for programming, tooling, debugging and regression testing.
INTRODUCTION
In a 1965 paper, Intel cofounder Gordon Moore observed that transistor density increases exponentially, roughly doubling every 18 months or so. For the last 40 years, Moore’s Law has continued unabated; semiconductor density continues to increase. Moreover, since the mid 1980’s, a similar trend has resulted in clock speed increases of about 30% per year.
Around 2003, however, clock speed hit a wall due to fundamental physics. Although computing power increases linearly with clock speed, power density rises with the square or cube, depending on the electrical model, and clock frequencies beyond 5GHz “melt” chips. The clock speed wall has forced microprocessor vendors, in their efforts to continue leveraging Moore’s Law, to increase performance and reduce power through Multiprocessing, producing chip multiprocessors with multiple processing cores per chip.
CONCEPT OF MULTICORE PROCESSORS
First generation microprocessors were single core processors, with just one execution core and associated components. Their power depended only on their clock speed and caches. But it was soon seen that we cannot push the clock speeds too much, a barrier was set around 4GHZ. So to build more powerful processors, chip manufacturers gave rise to a new idea, Multi core Processors.
A multi-core processor is a processing system composed of two or more independent cores (or CPUs). The cores are typically integrated onto a single integrated circuit die (known as a chip multiprocessor or CMP), or they may be integrated onto multiple dies in a single chip package. Cores in a multi-core device may be coupled together tightly or loosely. All cores are identical in homogeneous multi-core systems and they are not identical in heterogeneous multi-core systems. Just as in single-processor systems, cores in multi-core systems may implement architectures such as superscalar, VLIW, vector processing, SIMD, or multithreading.
EMERGENCE OF MULTICORE SOFTWARE
Because multicore programming differs so greatly from the serial software technology that has carried the software industry through 5 decades of Moore’s Law, software developers face an unprecedented challenge to their substantial investment in legacy serial code bases. Moreover, every generation of multicore processors widens the “software gap” between hardware potential and the performance that can be delivered by today’s applications.
This multicore discontinuity has placed three new demands on the software development industry :
1. For continued competitive levels of application performance, software programmers must identify and adopt multicore software platforms.
2. Since multicore enablement requires multicore expertise, which is in short supply, software vendors must engage in a massive training effort.
3. The entire software tool chain, from debugging to software release, must be engineered to allow reliable multicore software to be developed.
The Cilk Language
The basic Cilk language is simple. It consists of C with the addition of three keywords to indicate parallelism and synchronization. A Cilk program, when run on one processor, has the same semantics as the C program that results when the Cilk keywords are deleted. We call this C program the serial elision or C elision of the Cilk program. Cilk extends the semantics C in a natural way for parallel execution.
One of the simplest examples of a Cilk program is a recursive program to compute the nth Fibonacci number. A C program to compute the nth Fibonacci number is shown in Figure 2.(a), and Figure 2.(b) shows a Cilk program that does the same computation in parallel. The two programs look quite similar except for the inclusion of a few keywords: cilk, spawn, and sync.