Fortran + CUDA

PGI has some very nice CUDA support in the latest version of their fortran compiler.  Here’s the article. []  This may be old news to some of you, but I’m impressed.  Hopefully CUDA support is in the pipeline for the other fortran vendors as well, and something of a standard can emerge from this.

My first impression is that this is an ideal sweet spot, allowing the usage of nice high-level fortran array expressions on the host when convenient, and dropping into CUDA code where speed is a must.  Granted the host-device bandwith is painfully slow, so there is a significant overhead, but ideally it would allow incremental speedups, all within fortran.

I’m glad to see Fortran adapting to the latest technology, as it has done every generation or so; brings to mind the quip:

“What language will they be using 30 years from now?”

“I don’t know, but they’ll call it ‘Fortran’.”

And yet the standard is still backwards compatible with code from almost 35 years ago.  AFAICT, it’s the combination of adaptibility and backwards compatibility that keeps Fortran around.

Now if they would only get better I/O syntax, named goto labels (not ‘assign 10 to n’, more like C’s goto), etc…


2 Responses to “Fortran + CUDA”

  1. zbeekman Says:

    Can’t we just kill goto statements?

    • Kurt Smith Says:

      For languages like C & Fortran with no built-in exception functionality, goto has exactly one good use, IMHO: resource cleanup when an error is detected. And for this one reason I think it should be kept around. This feature is used all over the place in Python’s C code and the Linux kernel, for instance, and it makes the code much cleaner than the alternative.

      The way goto is used in 99% of Fortran should be killed off, I agree. And I despise having to use a numeric label for the goto label; C’s named goto label is much better.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: