The State of FORTRAN on Mac OS X

I've got my old thesis work that I was looking at yesterday. It's primarily f77 code, with a few of the critical methods converted to C with f2c and hand-tuned by me to get the best performance possible out of the code. It's nothing exceptional, but it's something I'm proud of, and I like to go back to it every so often and test it on new hardware that I get. Well, yesterday I was thinking about testing it on my MacBook Pro because the last time I tested it was on my G5 iMac, and it was very fast there, and I expect it to be even faster on my MacBook. It's got a faster processor, and if the compiler is capable of using multiple cores, then this will be even faster. So I was looking forward to it.

In the past, I've gone to the HPC Mac OS X page and they have had tarballs of g77, g95, gfortran that are built with the Developer Tools so that they work well with Xcode, which I am a big believer in. So I go there and get the latest Intel binaries for gfortran. Problem is, they don't compile the code. There's a problem in newton.F that causes an internal compiler segfault, and while they say "send in a bug report", I looked at the site and I think it's probably safe to assume that someone else has done this. There are a ton of rules to follow to submit the bug. So I missed there.

I tried the g95 compiler on SourceForge as it is supposed to be a different fork on the code, and while it compiled a little test program, it was spewing some errors that didn't look good, and in the end, didn't compile as much of the codebase as gfortran did. Strike two.

While I suppose I could buy a FORTRAN compiler, I really don't want to. I like the GCC tools, and I know that right now the gfortran snapshot (4.3.0) in the HPC download is 'experimental', it'll get better, and when it does, I'll get the next version. Until then, I'll have to wait. Not the worst thing in the world. It would be nice if Apple put it in Xcode, though. Face it, they're using gcc, so how hard could it really be?


UPDATE: I chatted with the maintainer of the HPC Mac OS X site and he said that he'd be updating the gfortran code in a few weeks due to the updates, but that the g77 code should work and it can be installed alongside the gfortran package. So I got it and it worked! The code compiles in less than a minute, and the tests run faster than any other machine I've ever run the code on. Amazing! Great guy.

As the hardware gets better, the times drop. I may have to come up with different tests. The latest tests show the MacBook Pro beats the G5 iMac. Nice.