The SIMD execution model
Having first encountered the Single Instruction Multiple Data execution model in Chapter 1, it is now time to revisit the concept and use it in real programs.
A quick recap: the idea is that we execute the same instruction on many pieces of data at the same time. This makes things faster because we are computing many items together.
However, keep in mind that not all problems can map directly to this kind of processing; this is one of our challenges. Another important point is that we need data to be arranged contiguously in memory in order to optimize access to it.
Remember that threads will execute in groups that share a little memory, but more than that, these groups will execute at the same instruction level, which means that if we have a branch in the code some threads will execute first while the others will be idly awaiting their turn to be executed. We have to carefully think about our code and try to minimize these kinds of situation to...