It's finally done! I submitted my practical term report yesterday. The 6 months at the super computing center Stuttgart (HLRS) were a very interesting time. My task there was to port a computational fluid dynamics (CFD) code to graphics processors. The CDF code was from the Institute of Aerodynamics and Gas Dynamics of the University of Stuttgart.
The people there were very helpful and tried to explain CFD to me. This topic was (and largely still is) totally new to me. It's very interesting to be a programmer in a world of physics and mathematics. I can highly recommend spending 6 month in a field totally new to you. It's a great experience to see the world and problems from different point of views. But just one hint: Don't start with fluid dynamics. ;)
The part of porting the code to GPUs turned out to become a major bug hunt. I hunted some bugs for up to 3 weeks. However I wasn't desperate enough to give them names… so it wasn't as bad as in the IE 6 days.
The CFD code called “Strukti” is written in Fortran and was not multithreaded when the project started. One of the super computers of the HLRS contains some GPUs as calculation accelerators. The basic idea of the project was to use these for Strukti. Since the GPUs are nVidia Tesla chips CUDA was the main focus on the GPU side of things. So for 6 months I tried to understand CFD, learned Fortran, CUDA and a whole lot of other stuff.
Fortran is a very interesting language. Despite its somewhat dusty reputation is's quite alive. Some ideas behind the language really fascinated me (modules, optimization, pointer handling, …). While the ideas are nice the language itself shows the long tradition of backward compatibility and compromises. Basically its like C with a lot nicer syntax and with its ugly corners at other places. But thanks to its syntax it sometimes even felt like writing Ruby (but only for a very short time). I know some people will scream when they read this but well, I'm tired of detailed language comparisons.
Learning CUDA was interesting because of its focus on the hardware. The language itself is not very impressive in my opinion but the GPU architectures are. It's very interesting how they evolved parallel to the CPUs but share some of the same thoughts. I wrote about that in my background studies section of the report: GPGPU origins and GPU hardware architecture. I was somewhat tired of the topic when I wrote the report so it's unfortunately not my usual level of writing. But I don't have the time to rewrite it in a proper way.
If you're interested in what I really did feel free to look into my report: Evaluation of CUDA Fortran for the CFD code “Strukti”. Its a bit better since I wrote it first. It covers how we mixed CUDA and Fortran with the CUDA Fortran PGI compiler extension. The compiler bugs that consumed most of the projects time are also listed and explained in detail.
It's a basic introduction into general purpose computations on the GPU as well as CUDA Fortran. It also covers the bugs encountered during the project. The discussion towards the end is more about how one can manage the the complexity of the current hardware. This is the more interesting part in my opinion. GPUs and CPUs are mixing on other platforms like notebooks and desktop systems, too. Therefore this might be interesting for other programmers, not only for high performance computing people.
Looking back it was a very interesting time. I learned much, gained insight into the scientific world and worked on some very interesting super computers. I don't regret taking that choice. :)