Argonne National Laboratory recently published several sessions from its Summer 2013 Extreme-Scale Computing program to YouTube. One of these is a lesson on combining performance and portability presented by Argonne Assistant Computational Scientist Jeff Hammond. For some reason the video image does not match the lecture, but you will find a link to Hammond’s slide deck here.
The strongest point that Hammond makes is the admonition to never forget the essence of portable performance: use libraries. There is no reason to roll your own unless something does not exist. If a library does not exist, Hammond’s suggestion is to write it and actively solve it the right way and then share it.
In nearly all cases, you’ll want to trade performance for portability, says Hammond. “In general, your code will outlive the machine,” he adds. “The most successful supercomputers make it just over five years; the most successful scientific applications may reach five decades.”
The way to ensure longevity is through portability. But if you require something non-portable stick it in something that is portable (encapsulation). Hammond compares this approach to using virtual machines to test potentially unsafe code.
The next section of the lecture is devoted to portable MPI communication. While the standard is perfect, the implementation is not, says Hammond. Wrapping MPI may cost cycles, but has huge payoffs in many instances, enabling bugs and performance quirks as well as other issues to be addressed with minimal headache.
The rest of this one-hour lecture gets pretty technical, but should be required viewing for any programmers who are considering a career in HPC.