One Minute Bottom Line
|The book gives an excellent introduction to parallel programming for multiple cores using threads and OpenMP in C++ on multiple platforms. The book is very comprehensive in covering the main topics and contains a lot of small self-contained source code examples.
The first part of the book is about how to write code than runs efficiently on the hardware. To write such optimized code, you'll need to know:
- The hardware architecture of your system
- The programming tools (compiler and profiler)
- How algorithms can be parallelized.
The book covers these three topics in detail and this introduction gives you a solid foundation, that you will use intensively for the rest of the book.
The next part is about threading: First the general principles of threads are explained, this includes different kinds of synchronization methods such as mutex, barriers and semaphores as well as different ways of sharing data between threads. The next two chapters cover the details of POSIX threads for Unix based systems, and Windows threading.
Open Multi-Processing (OpenMP) is the topic of the next chapter. Using OpenMP makes parallel programming simple – adding a few clauses to your code gives you an application utilizing all available hardware threads. The chapter explains the main OpenMP techniques, such as reduction, scheduling, sections and tasks. This chapter, along with the thread chapters, is the central topic of the book.
The book also contains a chapter about how to hand code your synchronization and data sharing and the pitfalls of doing so. This is by far the most complex topic in the book. If you are a novice programmer I suggest you skip this chapter. In most cases you will use the synchronization mechanism provided by the OS, as the author also points out.
The rest of the book covers a practical guide on how to make your application scale and a quick walk through of alternative technologies, such as GPGPU programming (CUDA, OpenCL) and C++ language extensions (Intel Threading Building Blocks, Gran Central Dispatch, etc.).