For my thesis I made some calculations with a CFD program written in Fortran.
I have read all the threads here about CUDA and Fortran and now I unsure what to do.
First, there are two versions of the programm, a single CPU version and a multi-cpu (mpi).
So the first question is, what version to choose to modify?
Would there be any speed advantage by using the original Fortran code?
Should I try to change the code to C?
Or would you say just wait until CUDA supports Fortran?
Are there any examples how to do that? Everytime I search for cuda and fortran I got thousands links, that cuda should support fortran soon but no example how to do it :(
I believe there is an example on the CUDA zone.
You can do now: call CUDA code (written in C) from Fortran
You can do in the (near) future: write CUDA code in C++ & Fortran
There is indeed an example of calling CUDA code from Fortran, but every call to the CUDA function involves allocating memory on the GPU, transferring the Fortran array to the GPU, calling the kernel, and then reading the results back. That’s a lot of back and forth transferring of data for a CFD simulation.
I’m just now finishing up porting a Fortran CFD simulation to CUDA. It’s quite a lot of effort to get everything from Fortran to C and CUDA and to verify that everything works as it should. Given the size of the codebase in the original post, I would estimate at least 4 months would be required to port it.
After a quick peak at the FLAGON example code, it looks like it provides Fortran bindings for CUDA instead of just ways to call CUDA functions from Fortran. That would indeed make the process a lot easier, but it would still be quite a lot of effort to fully transition from a plain Fortran program to a CUDA accelerated one, especially since that simulation is 20,000+ lines of Fortran.
I’m in EWI actually, although the simulation I’m working with comes from the thermal and fluids group and TNW.
Hey, there is no such thing as a free lunch ;) But the impression I got at NVISION is that Flagon is indeed a fast way to get a first speedup when porting a lot of legacy fortran code. It will not let you get maximum possible performance, but still it is a lot easier than converting to C in a lot of cases.
Ah cool, I will tell my old vakgroep that there are now people doing CUDA at TUD.
I think being good at programming is of lesser importance. It all starts to work out when you start to understand parallel programming. Me for example, I make beginner mistakes in C, but I am now quite able to write a parallel program (don’t get scared, after almost a year of CUDA).
The challenge is not in programming, the challenge is in thinking parallel. Although, what I understood from Flagon, it is much less the case for that middleware layer.