Multicore - Who is affected?
Multi-Core: Will It Affect Us?
Who's affected? Obviously; Oil and Gas, the Military, the financial institutions, games/simulation developers and anybody interested in climate or alien visitation prediction; but perhaps the other 99% of us need to at least consider multi-core as a relevant technology.
How will it affect me?
Before considering the most important question of all "What's the Solution?" it's worth considering what type of problem (if any) does your application belong to? This will determine how easy/hard your problem is likely to be. Broadly speaking (and it’s a pretty rough guide) multi-core problems could be considered to fall into the five categories below (or in some cases combinations of). The simplest cases are the data-parallel ones (all the CPUs do the same thing) and the hardest by far, are the irregular cases where there is a wide range of different tasks that may be required to execute in parallel. Ironically GUI-centric applications, which are amongst the most typical; are also going to be amongst the hardest to deal with (always assuming they require the benefits afforded by multi-core).
- The simplest multi-core devices may have the restriction that each core must execute the same instruction at the same time. So if the calculation needs to branch on a particular data value and each core potentially has a different value, then it could be that the CPUs are unable to sustain fully parallel execution. Amongst others this approach may be sufficient for pixel rendering (GPU devices), some signal processing, and a wide range of matrix operations. See SIMD devices. There are solutions to these types of problems and these would include RapidMind and Peakstream’s technologies.
- If your problem is data parallel (all the CPUs execute the same program) but the calculation is not restricted to executing actual instructions in parallel, then you are unlikely to benefit from SIMD programming techniques and could consider an SPMD approach. This could introduce some new issues like load balancing (if the execution time is data dependant), but this approach would enable you to consider a wider range of problems. OpenMP and also Intel’s recent Threading Building Blocks (TBB) solutions would be applicable.
- If your problem is data parallel but needs to recruit multiple CPUs (distributed) then it could be suitable for MPI, but some cases will be more difficult than others. If you are fortunate enough to have a cluster of identical machines then load balancing could be as simple as implementing a scatter/gather mechanism, but if you want to capitalize on all available resources (general heterogeneous clusters) then load-balancing even something as routine as Finite Difference Time Domain (FDTD), becomes an issue. Not only that, but whilst single machine multi-core is typically addressed by OpenMP, the distributed case is usually addressed by MPI. So what do you do with a cluster of multi-core machines (these problems need a higher level of abstraction)?
- Real-time applications add another layer of difficulty to the multi-core problem because none of the solutions referenced in the three cases above support the notion of network level pre-emption.
- If your problem is irregular (cannot typically benefit from expandable for-loops) then your options are considerably more limited and in the worst case may lead you to consider raw threads/locks/semaphores which most commentators agree are the concurrent programming world’s equivalent of assembly language – just a lot harder.
It is important to remember that the application components that consume the most machine cycles are not necessarily the ones that require the most programming effort (and vice-versa). Acoustic and/or Seismic exploration system’s such as those used by the Military and/or Oil and Gas are highly complex, and as well as convenient data-parallel signal processing sub-systems, also tend to have irregular components (tracking and classification) that are far more difficult to parallelize, add in logging/replaying, control, display, data distribution policies and many other highly irregular features, not to mention the fact that all of this often needs to be hard/soft real-time and you can see why multi-core is likely to be viewed as both an opportunity and challenge for these and similar sectors.