lördag 20 juni 2009

Programming for multi-core processors

CPUs come with an increasingly number of cores. As a programmer, you just have to relate to this in some way. One way would be to make sure you really understand parallel programming to utilize the higher responsiveness and speedup made possible with multi-core CPUs. But parallel programming is complicated and it's quite common not see the speedup you hoped for. Here's an insight I just had:

If you parallelize your code yourself, you will also have to maintain and improve it yourself. Conversely, if you rely on automatic programming constructs, the provider will continue to improve the parallelization for you!

For instance, by using the Cilk extension of the C programming language to expose parallelism in your program, you can recompile it with an improved version of Cilk to get a better speedup. If you would have used for instance MPI, you would have to reprogram your code by yourself to get a faster program. We both know it; it's not gonna happen, it's way too boring to deal with old code :)

With this argument in mind, I think the only reason to learn about parallel programming is because it's fun. It's not necessary in order to remain competitive in a multi-core future. I guess this calls for a blog post on different ways to exploit multi-cores CPUs without having to do the actual parallelization yourself...

Inga kommentarer:

Skicka en kommentar