Macworld Forums: Fortran? Anyone? - Macworld Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Fortran? Anyone?

#1 User is offline   Nobody Icon

  • Power User
  • PipPipPipPip
  • Group: Members
  • Posts: 58,347
  • Joined: 18-October 07

Posted 25 November 2002 - 10:23 AM

I don't imaging many of you are using Fortran, but I am hoping someone knows a source for a Mac Fortran compiler (hopefully integrated with a C/C compiler) besides Absoft. Absoft's is about $900 for a new user. Anyone?
0

#2 User is offline   Nobody Icon

  • Power User
  • PipPipPipPip
  • Group: Members
  • Posts: 58,347
  • Joined: 18-October 07

Posted 25 November 2002 - 04:07 PM

My dad writes FORTRAN programs on his Mac at work, but I don't know much about what he uses. As far as I can remember, it used MPW (Mac Programming Workshop) as the IDE. I could ask him what he uses when I visit home for Thanksgiving.
0

#3 User is offline   Nobody Icon

  • Power User
  • PipPipPipPip
  • Group: Members
  • Posts: 58,347
  • Joined: 18-October 07

Posted 25 November 2002 - 07:54 PM

This assumes you use OS X...

I do a fair amount of Fortran programming on the Mac, actually.

I use g77, GNU's Fortran 77 compiler. You've probably used it on other platforms, but in case you haven't, it's chief virtues are that it's widely used across many platforms (not just Mac), and that it's free. I installed it with Fink, http://fink.sourceforge.net . You may be able to find another method if you're anti-Fink.

I'm not quite sure what "integrated with a C/C compiler" means, but you can compile .f, .c, and .cc source to .o object files with g77 and gcc, and then link them as is usual with gcc (or whatever). I create such hybrid programs all the time, and am able to call C and C from Fortran and Fortran from C and C, so I've had no problems.

One peculiarity: With 10.2, Apple included a framework vecLib which is altivec enabled, which contains many useful fortran packages including lapack and blas... instead of doing "-lblas" or "-llapack" do "-framework vecLib".

If you need Fortran 90, I don't know of a free 90 compiler for any platform.

Hrm. I wonder if I have enough moxy to write a Cocoa app that uses Fortran...

[ 11-25-2002: Message edited by: Duke Thomas ]

0

#4 User is offline   Nobody Icon

  • Power User
  • PipPipPipPip
  • Group: Members
  • Posts: 58,347
  • Joined: 18-October 07

Posted 26 November 2002 - 06:27 AM

dOOd, that would be nice.

Duke, I currently am not running OS X, but GNU Fortran sounds like an excellent reason NOT to buy a Windows laptop (for which I already have Digital Fortran) and instead buy a new Mac. You may have saved me from a sojourn on the dark side. By the way, calling C routines is exactly what I need to do. All the code is F77, too. It's quite old spagetti code.

Do you have any idea how a program compiled using GNU Fortran compares in execution to, for example, the successor to Digital's Fortran (whoever has that now) on a Win machine? I saw a review using Absoft's that indicated it was not very efficient.

0

#5 User is offline   Nobody Icon

  • Power User
  • PipPipPipPip
  • Group: Members
  • Posts: 58,347
  • Joined: 18-October 07

Posted 26 November 2002 - 08:06 AM

quote:
You may have saved me from a sojourn on the dark side.

Great! I hope it plays out well.

quote:
By the way, calling C routines is exactly what I need to do. All the code is F77, too. It's quite old spagetti code.

Be forewarned that g77 compiles with the ANSI Fortran 77 standard exactly... right down to the 72 char limit on lines and restrictions on indentation. sigh images/icons/wink.gif If this legacy code used compiler specific "enhancements" not standard in Fortran 77 there could be troubles. Hopefully whoever wrote the original code had the foresight to make the code portable, but some developers find it very difficult to resist the Siren's song of the proprietary goddess. images/icons/smile.gif

If you're wondering what my point is, find some guy with g77 on his machine already (it doesn't have to be a Mac) and see how the compilation of your existing code goes.

quote:
Do you have any idea how a program compiled using GNU Fortran ---

g77 is rather good, but it is slower. This, however, is not the real issue: the absolute fastest Intel system is faster than the absolute fastest Mac system, so even with equally efficient compilers a program on Intel is still faster, usually.

Of course, usually this is a non-issue since desktop machines, whether they be Mac or PC, are just used for the development of the code, not for it's use on the really hard problems. It's never been a problem for me personally but I don't know the particulars of your situation.

0

#6 User is offline   Nobody Icon

  • Power User
  • PipPipPipPip
  • Group: Members
  • Posts: 58,347
  • Joined: 18-October 07

Posted 26 November 2002 - 09:08 AM

Hey, Duke,
The old code I am talking about runs now on Windows and on SGs. The original coders though a GO TO was pretty advanced stuff. It doesn't do anything fancy.

We actually run this code on laptops, desktops and SGs. Some of the PCs are actually faster than the (less than top-of-the-line) SGs, and in some cases actually faster than an old Cray. The code is very linear. It is virtually impossible to get anything parallel in it, even with extensive rewriting, and we can't do that because the maintainers distribute new versions every year or so and we would be faced with big mods every time. So we are stuck with the inefficient code and rely on faster processors. Some of my coworkers run this code on 800 MHz or so machines and it's OK, so I guess a 1GHz Tibook or maybe even an 800 mHz iBook would be acceptable.

0

#7 User is offline   Nobody Icon

  • Power User
  • PipPipPipPip
  • Group: Members
  • Posts: 58,347
  • Joined: 18-October 07

Posted 03 December 2002 - 06:37 AM

Duke, if you're still checking this thread, I meant to ask you - what Mac are you using for your Fortran work?
0

#8 User is offline   Nobody Icon

  • Power User
  • PipPipPipPip
  • Group: Members
  • Posts: 58,347
  • Joined: 18-October 07

Posted 04 December 2002 - 01:58 PM

I've successfully used g77 on a Ti800 Mhz (the April 2002 revision Ti) with both OS X.1 and X.2. In the past, I've also used g77 on Wallstreet PB 300Mhz and a Dual 500 G4 tower, both running X.1. My g77 was installed via Fink on all the Macs. My favorite editor for Fortran and most languages on any platform is xemacs, which, again, was installed on my Macs via fink. In all instances I compile all my code with make.

Congratulations on the new addition to your Mac family!

0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

3 User(s) are reading this topic
0 members, 3 guests, 0 anonymous users