If you’re wrestling with Hyper-Threading Technology or struggling to work out how you can get the best from the latest multicore processors, Intel has published an in-depth reference guide to help. The Intel Guide for Multithreaded Applications steers clear of hardware specific advice (for now), so that you can have confidence that the ideas (and your code) will be portable across different hardware platforms.
The guide covers a wide range of challenges parallel programmers typically face. It begins with a discussion of some of the issues in parallel programming, including predicting and measuring parallel performance, parallel-friendly loop modifications, granularity and parallel performance, load balancing, using tasks instead of threads, and exploiting parallelism in ordered data streams. These discussions cover general issues but make occasional references to API specific issues.
The guide then looks at how you can manage and minimise any negative effects arising from synchronisation, including local contention. There is advice on using the threading API to synchronise, choosing the right synchronisation primitives to minimise the overhead, and using non-blocking locks.
The third section is dedicated to memory management, including avoiding heap contention among threads, using thread-local storage to cut the synchronisation required, detecting memory bandwidth saturation, and avoiding false sharing.
So that’s the code and theory: how can you put it into practice? The final section explores the various tools available to help you to write and manage parallel code, including Intel Compilers, the Intel Math Kernal Library, Intel Integrated Performance Primitives, Intel Parallel Inspector, Intel Parallel Amplifier, and Intel Parallel Composer.
The articles all fairly short, and the guide is intended as a quick reference rather than a tutorial. To get the most from it, you’ll need to be experienced in a high-level language. Intel recommends C, C++ or Fortran, but says the ideas are equally applicable to Java, C# and Perl. You’ll also need to understand basic concurrent programming and be familiar with one or more threading method already. There are cross references between the topics, but they’re written so you can dip in and out and each article can stand alone, like in an encyclopaedia. It’s free and online now, so why not take a look?