At Intel research day last week, one of the most impressive things I've seen to date in the parallel programming arena leapt out on center stage. I blogged earlier this month about "The death of single-threaded development" due to the systemic shift microprocessor progression. The OpenMP code took 172 lines of code while the Ct code was written in 6 lines!The future looked grim for any developer who didn't know how to write multi-threaded code and up to this point; a programmer either wrote multi-threaded code by hand-threading or using a multi-threaded API like OpenMP.
The fundamental difficulty in multi-threaded programming was the need to deal with multiple program threads running simultaneously and possibly interacting with each other. Writing a single multi-threaded program was like writing multiple programs only it was more difficult because of the heavy interaction. What was missing in multi-threaded programming was a higher level of abstraction that freed the programmer from having to think so much about threads. While OpenMP was much easier than hand-threading applications, it was still far more difficult than conventional single-threaded programming.
Enter Intel's new Ct API which is an extension to C and C++. To demonstrate how powerful this new multi-threaded programming API was, Intel had several demos of compiled Ct code running complex and CPU-intensive applications running on 4 to 8 CPU cores. The most impressive thing I saw was a sample of code written in OpenMP and the same thing written in Ct. The OpenMP code took 172 lines of code while the Ct code was written in 6 lines! According to Intel, Ct will scale as well or slightly better than OpenMP. But even that was being exaggerated and Ct code ends up being slightly slower than OpenMP, the fact that it's so much easier to code will mean it will be very desirable.
Sample of Ct code:
Equivalent OpenMP code:
Ct applications will scale from 1 to n processors so that programs can take advantage of the newer CPUs such as dual-core, quad-core, and even the Intel 80-core tera-scale chip. Intel (and the rest of the Microprocessor industry) has a huge stake in multi-threaded development because Multi-core processors won't sell if people aren't seeing a return in better performance. With current software development being mostly a single-threaded affair, Intel wants to help developers write more multi-threaded code and the only way to do that is to give them better and easier tools to work with. The creation of Ct code will most likely help other microprocessor makers as well Intel's own products but this is one of those leaps that must be made if anyone is going to sell newer and higher-core CPU.