Fortran Libraries Re: Programming Language History

Bill Ricker N1VUX wdr at TheWorld.com
Fri Dec 9 00:37:00 EST 2005


Kevin asked,
>>  Why not port it to C?  Because, for a lot of reasons (see [1] for 
>>   example), Fortran's performance in this space continues to exceed
>>   C-based implementations.

Mike answered
> Correct me if I'm wrong, but I seem to recall that Fortran has built 
> in support for complex numbers and C does not.  


Complex type is helpful in EE codes, but perhaps even more importantly for the
libraries as a whole
* vector-array processing optimization
* code-gen optimizer not constrained by C pointers, 
* optimzer evolved over 40+ years for narrow numeric domain
* core numeric primitives coded in tight assembler 
  (different "core" than C RTLibe's choice of core for different domain)

For problems in it's core domain, the Fortran Optimizer will beat hand-coded
speed.
(C can do as well, in it's core domain ... but they don't really overlap.)

A top quality Lisp did once beat FORTRAN on real number crunching, but nothing
else has that I know of has, and that was only once.  (Was in on the DEC10? I
forget.)

The Gnu Fortran is good, but there are still commercial Fortrans sold as 3rd
Party software (e.g., DEC/HP for Alpha, Portland for 64b x86's, ...) because
their optimizer rocks for the platform(s) targetted.


*** WHAT TO DO ABOUT IT

Porting the massive optimized Fortran libraries and codes that are industry
standards is not going to help; the optimizers for pointer-based languages
like C just can't squeeze as much out as in Fortran.  More useful would be
taking the standard, highly optimized Fortran libraries and making them
conveniently accessible in other languages. This is done through making a C
API declaration of the Fortran libs, and thus usable by all other modern
languages. Which in fact has been done; most modern Fortrans want the ability
to call C-libs, so are callable from C as if they were C-libs as well.  Common
linkage, yeah.

As just one example, the Perl Data Language (PDL) provides pretty much the
full Fortran matrix library accessible as Perl objects with overloading, so
you can add and multiple matrices etc. etc. with Fortran's speed where it
matters, and do the string handling and input/output in a string-handling
language (Perl).  
 http://search.cpan.org/~csoe/PDL-2.4.2/ 
 http://pdl.sourceforge.net/PDLdocs/Impatient.html

But any other language w/ ability to bind C APIs (Python, Ruby, Tcl, Rexx,
...) could do likewise to manipulate big datasets with Fortran from the
comforts of home -- whether they've bothered to do so, and how comfortable or
efficient the interface is, is the question.

Cheers,

Bill in Boston




More information about the gnhlug-discuss mailing list