Multicore programming: it’s all in the messaging
Validation & OptimizationOnce you have a working prototype, you need to validate it against the requirements defined at the outset. Does the programming model match the application and did you provision the system well to support this programming model?
You need to look at the mapping to see if you succeeded in smoothing out the function pipeline or if unexpected stalls and waiting occur. Of course, you need to evaluate if the multicore platform is capable of supporting the application within the requirements, and it is extremely valuable to have access to a simulator in combination with rapid prototyping tools when evaluating the hardware platform.
Rapid Prototyping & Exploration
A packet processing application (Figure 2, below) which has one extremely compute-intensive function illustrates the concept and usefulness of rapid prototyping in this context.
In this example, a programming platform is used with MCAPI message passing support, a real time OS, and a multicore capable simulator. Global shared memory moves data between processor local memories.
The simulator allows you to modify the cycles required to access global shared memory and to easily add cores. The tools let you quickly rearrange the communication topology and provision the resources in the topology.
You need to find out how memory accesses latency impacts performance and if you can re-factor the application to find an optimal number of cores for parallelizing this function.
What you will find is that with perfect memory (i.e., zero-cycle access latency), you can improve performance with up to five parallel cores, but will likely not see any improvement with the addition of cores.
However, if you look at batch processing multiple data sets to reduce the transaction cost, you will find that by combining multiple packets per transfer with realistic memory access latency, you can have almost linear improvement, with up to twice the number of cores.
Click on image to enlarge.
Figure 2: Rapid Prototyping and Exploration
Without having the capability to explore an application in this way, it's highly unlikely that a development team could have gone beyond the five cores without leaving performance on the table.
And the Winner Is?
Without a doubt, planning ahead will get you the results faster that you are after in your migration to multicore. First you need to look at the application and its behavior to determine a suitable programming model.
For a function pipeline, it is suggested that you use a message passing model. This message passing can of course be used in other situations as well, since one of its attractive features is its ability to scale to very large systems with numerous cores.
You also need to look at standards, which help provide solutions as well as future-proofing your efforts for this project to the next and more. Make sure that the standard applies to the target system used (i.e., message passing MCAPI is more suitable for embedded systems whereas MPI is the obvious choice for widely distributed high-performance computing).
For the multicore platform, the approach depends on whether the platform is already available or whether you need to define a suitable platform. A programming platform providing the appropriate tools and runtime software, to enable you to iteratively explore options and to reduce time to product, would be the most suitable choice for such a project.
In other words, multicore programming is not that much different than the rest of life. The more planning, proper tools and smarts applied to examine the process and ensure you’re following the optimal path, the faster your team will achieve an optimized multicore application. While this appears slower at the outset, just remember the story about the tortoise and the hare and who really wins the race.
Sven Brehmer, President & CEO of PolyCore Software, is a founding member of the Multicore Association and chairman of the Communications API working group. Prior to founding PolyCore Software, Brehmer served as senior director for Wind River's Embedded Platforms Division as a result of the acquisition of Integrated Systems in 2000, where Brehmer served as the chief operating officer and executive vice president of DIAB-SDS. Brehmer was also President and CEO of Diab Data after receiving his Master's degree in Electronics Engineering from the Royal Institute of Technology in Stockholm,Sweden.


Loading comments... Write a comment