OpenMPAuthor: Andrey KarpovDate: 20.11.2009AbstractThe article briefly describes the OpenMP technology.OpenMPOpenMP (Open ...
POSIX-interface for threading (Pthreads) has a wide support (nearly on all UNIX-systems) but due tomany reasons it does no...
Upcoming SlideShare
Loading in...5
×

OpenMP

199

Published on

The article briefly describes the OpenMP technology.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
199
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

OpenMP

  1. 1. OpenMPAuthor: Andrey KarpovDate: 20.11.2009AbstractThe article briefly describes the OpenMP technology.OpenMPOpenMP (Open Multi-Processing) is a set of compiler directives, library procedures and environmentvariables intended for programming multi-threaded applications on multi-processor systems withshared memory (SMP-systems).The first OpenMP standard was developed in 1997 as an API oriented on writing easy portable multi-threaded applications. At first, it was based on Fortran language but then included C and C++ as well.OpenMP interface became one of the most popular parallel programming technologies. OpenMP issuccessfully exploited both in programming of supercomputer systems with many processors and indesktop user systems or, for example, Xbox 360.OpenMP specification is developed by several large computer and software vendors whose activity isregulated by the non-profit organization "OpenMP Architecture Review Board" (ARB) [1].OpenMP exploits the parallel execution model called "branching-merging". OpenMP program begins asa single execution thread called the initial thread. When the thread meets a parallel construction, itcreates a new group of threads consisting of the initial thread itself and some other threads andbecomes the main thread in the group. All the members of the new group (including the main thread)execute the code inside the parallel construction. At the end of the parallel construction, there is animplicit barrier. After the parallel construction is processed, the further execution of the user code isperformed only by the main thread. A parallel area may include other parallel areas where each threadof the initial area becomes the main thread of its thread group. The embedded areas may also includeareas of a deeper nesting level.The number of threads in a group performed concurrently can be controlled by several methods. One ofthem is using the environment variable OMP_NUM_THREADS. Another method is to call the procedureomp_set_num_threads(). One more way is to use the expression num_threads together with paralleldirective.OpenMP and other parallel programming technologiesAt present, MPI interface (Message Passing Interface) is considered to be the most flexible, portable andpopular interface in parallel programming. But the Message Passing Interface: • is not too efficient on SMP-systems; • is relatively difficult to study because it demands thinking in "non-computing" terms.
  2. 2. POSIX-interface for threading (Pthreads) has a wide support (nearly on all UNIX-systems) but due tomany reasons it does not suite the practical parallel programming: • Fortran is not supported; • its level is too low; • no support for data concurrency; • the threading mechanism was originally developed not for the purposes of computing concurrency arrangement.OpenMP can be viewed as a high-level superstructure over Pthreads (or other similar thread libraries).Let us list the advantages OpenMP provides a developer with. 1. Due to the idea of "incremental parallelization", OpenMP is ideal for the developers wishing to quickly parallelize their applications with large parallel loops. A developer does not create a new parallel program but simply adds OpenMP-directives into the text of a serial program. 2. OpenMP is a very flexible mechanism providing the developer with great capabilities of controlling a parallel applications behavior. 3. OpenMP-program is supposed to be used as a serial one on a single-processor platform, i.e. you do not need to support both the serial and parallel versions. OpenMP-directives are simply ignored by the serial compiler and to call the OpenMP-procedures you may place stubs whose texts are given in the specifications. 4. One of OpenMPs advantages, as its developers point out, is support of the so called "orphan" directives, i.e. work synchronization and distribution directives do not necessarily need to be included directly into the lexical context of a parallel area.OpenMP and toolkitAt present, OpenMP technology is supported by most C/C++ compilers. Yet, it is not so good with thetools of testing parallel OpenMP programs. Although analysis tools and tools for testing and optimizingparallel programs have existed for a long time, they were not too popular in the sphere of appliedsoftware development until recently. That is why they are often less convenient than otherdevelopment tools.The fullest support of parallel OpenMP-program development is provided by the package Intel ParallelStudio. It includes a tool of preliminary code analysis for detecting code fragments that can bepotentially parallelized. There is a compiler with OpenMP support providing good optimization. There isalso a profiler and a dynamic analysis tool for detecting parallel errors.Also, we should mention one more tool - VivaMP included into PVS-Studio. This is a static code analyzeroriented on detecting errors in OpenMP programs at the stage of writing.References 1. OpenMP Architecture Review Board. http://www.openmp.org/ 2. Joel Yliluoma. Guide into OpenMP: Easy multithreading programming for C++. http://www.viva64.com/go.php?url=135 3. Kang Su Gatlin and Pete Isensee. OpenMP and C++. http://www.viva64.com/go.php?url=113 4. The collection of links referring to parallel programming and OpenMP technology. http://www.viva64.com/links/parallel-programming/

×