Introduction
Find where parallelism can be implemented effectively within a serial application.
By Clay P. Breshears
Explicit threading methods, such as Windows* threads or POSIX* threads, use library calls to create, manage, and synchronize threads. Use of explicit threads requires an almost complete restructuring of affected code. On the other hand, OpenMP* is a set of pragmas, API functions, and environment variables that enable you to incorporate threads into your applications at a relatively high level. The OpenMP pragmas are used to denote regions in the code that can be run concurrently. An OpenMP-compliant compiler transforms the code and inserts the proper function calls to execute these regions in parallel. In most cases, the serial logic of the original code can be preserved and is easily recovered by ignoring the OpenMP pragmas at compilation time.
OpenMP programs are threaded programs and can suffer from the same errors and performance problems as explicitly threaded applications. We assume you are familiar with OpenMP since this article examines the use of the Intel® Threading Tools, Intel® Thread Checker and Intel® Thread Profiler to analyze OpenMP programs. For Intel Thread Checker, we eschew the standard use of identifying storage conflicts in threaded code; rather, we use the diagnostic output to identify and categorize the scope of variables within parallel regions. After that, two of the more common performance problems encountered in OpenMP codes are discussed. We illustrate how to use Thread Profiler to identify these problems and give some possible solutions. For more details and information on using the Intel Threading Tools, see “Getting Started with the Intel® Thread Checker” and “Getting Started with the Intel® Thread Profiler” included in the threading tools documentation.
To illustrate our points more concretely, we have chosen to analyze code that implements a brute force algorithm to find prime numbers within a user-defined range of integers. The serial code takes each potential prime (even numbers are not considered) and divides it by all the integers less than or equal to the square root of the number. If any of the test factors evenly divides the number under consideration, the number is composite; if none of the factors evenly divides the number, it is prime. Numbers found to be prime can optionally be printed out, but a count of the number of primes found is always computed. It is known that primes greater than 2 can be uniquely classified into two categories: those that can be factored into the form 4n+1 and those of the form 4n-1. In addition to counting the total number of primes found, a count for the relevant class—by finding the remainder of division by 4—of primes is incremented for each prime.
![]()
If you're interested in this topic, these articles may be helpful:
![]() | Intel C++ Compiler 8.1 for Linux free downloads from Intel Corp. Intel® C++ Compiler for Linux accelerates your... |
![]() | For-loop threading methods by Jeff Andrews, application engineer, Intel Corp. Explore differen... |
![]() | Building a distributed rich-media application using Microsoft and Intel technologies by Jonathan Kantor, Intel Corp. Collaborative digital-media applica... |
![]() | Intel Fortran Compiler 8.1 for Linux Intel Corp Reduce time-to-market, optimize your code for Intel®... |
![]() | Deploying Oracle9i Real Application Clusters on Intel® architecture-based clusters Information storage and retrieval lies at the heart of almost all core... |
![]()
Related Jobs:
![]() | Technical Writer #2549416 - NY - Rochester - Ajilon Consulting Title : Technical Writer Posted : 12-29-2005 Contact : R... |
![]() | Project Manager #139792 - WA - Issaquah - Microsoft Corporation Project Manager / Sr. Project Manager This position will project man... |
![]() | PeopleSoft Functional HR/Ben Admin Consultant - MA - Lexington - Surebridge Job Description and Areas of Responsibilities: Major responsibility wi... |
![]() | ***Multi-Thread - JAVA / C++ Developer #2461905 - MD - Baltimore - Ajilon Description : Ajilon Consulting is a premier provider of Information... |
![]() | Senior Data Architect #siin-00004277 - VA - Fairfax - SI International Title: Senior Data Architect Req Number: siin-00004277 Location(s)... |
![]() | Software Development Engineer - NJ - Jersey City - Xceedium This is a chance to work on a truly revolutionary approach to secure r... |
![]() | WAS Administrator #1114BoA - IL - Schaumburg - Alpine Consulting, Inc Job Description : We are looking for a WAS admin to work within the ... |
![]() | Senior Java Developer - Canada - Burnaby - Logical Software Corporation Are you an energetic Java web developer who has been living, breathing... |
![]() | PeopleSoft Functional HR/Payroll Consultant - MA - Lexington, - Surebridge Job Description and Areas of Responsibilities: Major responsibility wi... |
![]() | Computational Scientist - CEA - OH - Dayton - High Performance Technologies, Inc. High Performance Technologies, Inc. (HPTi), based in Reston, VA is a s... |

