Developing Multithreaded Applications: A Platform Consistent Approach
128 pages
English

Developing Multithreaded Applications: A Platform Consistent Approach

-

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
128 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Developing MultithreadedApplications: A PlatformConsistent Approach V. 2.0, February 2005 Copyright © Intel Corporation 2003-2005 THIS DOCUMENT IS PROVIDED "AS IS" WITH NO WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR ANY PARTICULAR PURPOSE, OR ANY WAY OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE. Information in this document is provided in connection with Intel products. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted by this document or by the sale of Intel products. Except as provided in Intel's Terms and Conditions of Sale for such products, Intel assumes no liability whatsoever, and Intel disclaims any express or implied warranty, relating to sale and/or use of Intel products including liability or warranties relating to fitness for a particular purpose, merchantability, or infringement of any patent, copyright or other intellectual property right. Intel products are not intended for use in medical, life saving, or life sustaining applications. Intel retains the right to make changes to its test specifications at any time, without notice. The hardware vendor remains solely responsible for the design, sale and functionality of its product, including any liability arising from product infringement or product warranty. Performance tests and ratings are measured using specific computer systems and/or components and ...

Informations

Publié par
Publié le 07 novembre 2011
Nombre de lectures 39
Langue English

Extrait

Developing Multithreaded Applications: A Platform Consistent Approach V. 2.0, February 2005 Copyright © Intel Corporation 2003-2005 THIS DOCUMENT IS PROVIDED "AS IS" WITH NO WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR ANY PARTICULAR PURPOSE, OR ANY WAY OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE. Information in this document is provided in connection with Intel products. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted by this document or by the sale of Intel products. Except as provided in Intel's Terms and Conditions of Sale for such products, Intel assumes no liability whatsoever, and Intel disclaims any express or implied warranty, relating to sale and/or use of Intel products including liability or warranties relating to fitness for a particular purpose, merchantability, or infringement of any patent, copyright or other intellectual property right. Intel products are not intended for use in medical, life saving, or life sustaining applications. Intel retains the right to make changes to its test specifications at any time, without notice. The hardware vendor remains solely responsible for the design, sale and functionality of its product, including any liability arising from product infringement or product warranty. Performance tests and ratings are measured using specific computer systems and/or components and reflect the approximate performance of Intel products as measured by those tests. Any difference in system hardware or software design or configuration may affect actual performance. Buyers should consult other sources of information to evaluate the performance of systems or components they are considering purchasing. For more information on performance tests and on the performance of Intel products, reference www.intel.com/procs/perf/limits.htm or call (U.S.) 1-800-628-8686 or 1-916-356-3104. ® ® ®The Pentium III Xeon ™ processors, Pentium 4 processors and Itanium processors may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request. Copyright © Intel Corporation 2003-2005 Other names and brands may be claimed as the property of others. Contents 1. Multithreading Consistency Guide ......................................................................................3 1.1 Motivation..............................................................................................................................................3 1.2 Prerequisites .........................................................................................................................................3 1.3 Scope....................................................................................................................................................3 1.4 Organization..........................................................................................................................................3 Editors 4 Authors 4 Reviewers 4 Technical Writers...................................................................................................................................4 ®Intel Multithreading Consistency Working Group Chairs .....................................................................4 ®2. Intel Software Development Products .............................................................................5 ®Intel C/C++ and Fortran Compilers.....................................................................................................5 ®Intel Performance Libraries.................................................................................................................5 Intel® VTune™ Performance Analyzer..................................................................................................6 ®Intel Thread Checker ..........................................................................................................................6 Intel Thread Profiler...............6 2.1 Automatic Parallelization with Intel Compilers.......................................................................................7 2.2 Multithreaded Functions in the Intel Math Kernel Library ...................................................................12 2.3 Avoiding and Identifying False Sharing Among Threads with the VTune Performance Analyzer ........15 2.4 Find Multithreading Errors with the Intel Thread Checker ..................................................................20 2.5 Using Thread Profiler to Evaluate OpenMP Performance26 3. Application Threading.........................................................................................................31 3.1 Choosing an Appropriate Threading Method: OpenMP Versus Explicit Threading..............................32 3.2 Granularity and Parallel Performance .................................................................................................37 3.3 Load Balance and Parallel Performance.............................................................................................42 3.4 Threading for Turnaround Versus Throughput ....................................................................................46 3.5 Expose Parallelism by Avoiding or Removing Artificial Dependencies ................................................49 3.6 Use Workload Heuristics to Determine Appropriate Number of Threads at Runtime ..........................53 3.7 Reduce System Overhead with Thread Pools.....................................................................................56 3.8 Exploiting Data Parallelism in Ordered Data Streams .........................................................................59 3.9 Manipulate Loop Parameters to Optimize OpenMP Performance.......................................................65 4. Synchronization...................................................................................................................69 4.1 Managing Lock Contention, Large and Small Critical Sections ..........................................................70 4.2 Use Synchronization Routines Provided by the Threading API Rather than Hand-Coded Synchronization...................75 Multithreading Consistency Guide 1 4.3 Win32 Atomics Versus User-Space Locks Versus Kernel Objects for Synchronization.......................78 4.4 Use Non-Blocking Locks when Possible .............................................................................................82 4.5 Use a Double-Check Pattern to Avoid Lock Acquisition for One-Time Events...................85 5. Memory Management..........................................................................................................89 5.1 Avoiding Heap Contention among Threads.........................................................................................89 5.2 Use Thread-Local Storage to Reduce Synchronization......................................................................93 5.3 Offset Thread Stacks to Avoid Cache Conflicts on Intel Processors with Hyper-Threading Technology ..............................................................................................................98 6. Investigating Poor Parallel Application Scaling............................................................103 Software Tools for Root-Cause Analysis..103 Preparing for Root Cause Analysis....................................................................................................104 Contributing Authors..........................................................................................................................104 6.1 Estimating the Degree of Parallelism for a Given Application and Workload.....................................105 6.2 Identifying Load Imbalance among Threads and Processors...........................................................109 6.3 Analyzing Threading Design of Applications and Identifying Issues.................................................112 6.4 Locking of Shared Resources ...........................................................................................................117 6.5 Identifying and Reducing Frequent Operating System Calls.............................................................120 6.6 Potential Windows* XP Scheduler Issue on Processors with Hyper-Threading Technology .............122 2 Multithreading Consistency Guide 1. Multithreading Consistency Guide 1.1 Motivation The objective of the Multithreading Consistency Guide is to provide guidelines for developing efficient multithreaded applications across Intel-based symmetric multiprocessors (SMP) and/or systems with Hyper-Threading Technology. An application developer can use the advice in this document to improve multithreading performance and minimize unexpected performance variations on current as well as future SMP ®architectures built with Intel processors. The first version of the Guide provides general advice on multithreaded performance. Hardware-specific optimizations have deliberately been kept to a minimum. In future versions of the Guide, topics covering hardware-specific optimizations will be added for developers willing to sacrifice portability for higher performance. 1.2 Prerequisites Readers should have programming experience in a high-level language, preferably C, C++, and/or Fortran, though many of the recommendations in this document also apply to languages such as Java, C#, and Perl. Readers must also understand basic concurrent programming and be familiar with one or more threading methods, preferably OpenMP*, POSIX threads (also referred to as Pthreads), or the Win32* threading API. 1.3 Scope The main objective of the Guide is to provide a quick
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents