| September 1, 2010 12:00 AM PDT | |
Intel® Cilk™ Plus is a simple C/C++ language extension construct for data parallel operations.
Intel® Cilk™ Plus provides simple to use language extensions to express data and task-parallelism to the C and C++ language implemented by the Intel® C++ Compiler, which is part of Intel® Parallel Composer and Intel® Parallel Studio. This article describes one of these programming constructs: “elemental functions”.
There are cases in which the algorithm performs operations on large collection of data, with no dependence among the operations being performed on the various data item. For example, the programmer may write, at a certain point of the algorithm: add arrays a1 and a2 and store the result in array r. When thinking at that level, the programmer is thinking in terms of a single operation that needs to be performed on many elements, independently of each other. Unfortunately, the C/C++ programming languages do not provide constructs that allow expressing the operation as such. Instead, they force the programmer to elaborate the operation in terms of a loop that operates on each array element. The end result, in terms of the values being stored in the result array, would be the same. However, the introduction of the loop introduces an unintended order of operations: The implementation has to add the first two array elements, store the results in the first location of the result array, move on to perform the same operation on the second set of elements, and so on. An example later will show what is expected to be a typical use of elemental function: use a single line to mark a standard C/C++ function as elemental, change the invocation loop from serial to parallel (in this example, it is a change of one keyword) and that is it.
To continue reading the article, click on the link below.
Refer to http://software.intel.com/en-us/articles/optimization-notice for more information regarding performance and optimization choices in Intel software products.
Introduction
Intel® Cilk™ Plus provides simple to use language extensions to express data and task-parallelism to the C and C++ language implemented by the Intel® C++ Compiler, which is part of Intel® Parallel Composer and Intel® Parallel Studio. This article describes one of these programming constructs: “elemental functions”.
There are cases in which the algorithm performs operations on large collection of data, with no dependence among the operations being performed on the various data item. For example, the programmer may write, at a certain point of the algorithm: add arrays a1 and a2 and store the result in array r. When thinking at that level, the programmer is thinking in terms of a single operation that needs to be performed on many elements, independently of each other. Unfortunately, the C/C++ programming languages do not provide constructs that allow expressing the operation as such. Instead, they force the programmer to elaborate the operation in terms of a loop that operates on each array element. The end result, in terms of the values being stored in the result array, would be the same. However, the introduction of the loop introduces an unintended order of operations: The implementation has to add the first two array elements, store the results in the first location of the result array, move on to perform the same operation on the second set of elements, and so on. An example later will show what is expected to be a typical use of elemental function: use a single line to mark a standard C/C++ function as elemental, change the invocation loop from serial to parallel (in this example, it is a change of one keyword) and that is it.
To continue reading the article, click on the link below.
Refer to http://software.intel.com/en-us/articles/optimization-notice for more information regarding performance and optimization choices in Intel software products.
Do you need more help?
Article Attachments
This article applies to: Intel® C++ Compiler for Linux* Knowledge Base, Intel® C++ Compiler for Mac OS X* Knowledge Base, Intel® C++ Compiler for Windows* Knowledge Base, Intel® Parallel Composer Knowledge Base
For more complete information about compiler optimizations, see our Optimization Notice.
Comments (4) 
| April 10, 2011 5:43 PM PDT
MKL | http://software.intel.com/en-us/articles/intel-cilk-plus/ is poorly written. I don't need Intel to tell me multicore has become prevalent and Cilk is "quick" and "easy." Just show me a program! |
| September 9, 2011 11:02 AM PDT
David | I have to agree with MLK. I have been looking for a simple example for 10 minutes and keep coming up dry. You keep telling me there are only three keywords without saying what they are. PDFs, white papers, and marketing BS are just ways to pay consultants more. Just give me a bulleted list of this "simple" language extension with a brief, CONCRETE description. |
| September 9, 2011 12:28 PM PDT
Aubrey W. (Intel)
|
Hello, You can find Intel(R) Cilk(TM) Plus documentation at http://software.intel.com/en-us/articles/intel-cilk-plus-support/?wapkw=(CILK) Best regards, == Aubrey W. Intel(R) Software Network Support |
Trackbacks (0)
Leave a comment 
To obtain technical support, please go to Software Support.



MKL