Skip to Main Content
Intel Threading Building Blocks
book

Intel Threading Building Blocks

by James Reinders
July 2007
Intermediate to advanced content levelIntermediate to advanced
332 pages
10h 4m
English
O'Reilly Media, Inc.
Content preview from Intel Threading Building Blocks

Automaton

We call our implementation automaton and, when run, it presents a pair of blank grids side by side. The lefthand grid displays cell colony generations with the calculations being done with sequential logic. The righthand grid displays cell colony generations with the calculations being done with parallel logic using Threading Building Blocks. Above each grid is the current generation number. Running on a single-processor core will work, but the results will vary based on the threads that get priority. Some will see the parallel side appear to be faster, even on a single-core processor, because it will have more resources competing fairly for the single-processor core than the sequential version (see the section “Fair Scheduling,” in Chapter 9). Other machines show the opposite behavior because the sequential thread ends up with a priority. Neither result says anything about the efficiency of the parallel version. However, if you run this code on a quad-core (or better) processor, you will see a commensurate increase in speed for the parallel side due to true parallelism.

The Game of Life was originally assumed to take place on an infinite space. In this implementation, both of the grids wrap. The top edge is treated as though it is connected to the bottom edge, and the left edge is treated as though it is connected to the right edge. Therefore, a glider pattern moving off one edge will come into the grid from the opposite edge.

To seed both grids with the same starting cell ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Intel® Xeon Phi™ Coprocessor Architecture and Tools: The Guide for Application Developers

Intel® Xeon Phi™ Coprocessor Architecture and Tools: The Guide for Application Developers

Rezaur Rahman

Publisher Resources

ISBN: 9780596514808Errata Page