[Beowulf] Threaded code (& Fortran)
Josip Loncaric
josip at lanl.gov
Wed Aug 18 16:47:41 EDT 2004
Jeff Layton wrote:
> [...] Start coding in Fortran or the dog gets it! [...]
I learned programming 34 years ago the hard way, using Fortran IV and
punched cards, but my preference today is C. Even so, there are a few
advantages Fortran had (or still has):
* Intrinsic complex data types and functions
* More sensible notation for indexing matrices and multi-dim. arrays
* Operators like x**y
* Same precision operations & pass-by-value (unlike traditional K&R C)
* etc.
C was originally devised for systems programming, but Fortran is geared
towards scientific computing, where it still dominates for historical
reasons (e.g. LINPACK).
If we start talking about C99, we should at least talk about Fortran 90
or 95. Fortran 90/95 is not your father's Fortran IV. Many scientific
programmers prefer Fortran 90/95 despite the addition of "complex" data
type in C99.
Fortran has evolved to include a nice array language and abstract data
types, so that C's advantage in handling data structures is reduced.
Fortran now allows free source form (no column 7-72 limit), recursion,
improved I/O, "implicit none" statement, and many other enhancements
which deliver faster and more reliable development cycle in scientific
computing.
Having said all that, I use C mostly because it is ubiquitous. GNU C is
excellent and available virtually everywhere. Good Fortran 90/95
compilers are harder to get.
For a good discussion of Fortran-vs-C in scientific computing, see the
"Preliminaries" section of "Numerical Recipes in C" by William Press et
al., particularly early editions.
Sincerely,
Josip
P.S. Real physicists (and control theorists and mathematicians)
*routinely* use complex numbers: generic real polynomials have complex
roots. Computing roots (or eigenvalues) using only real numbers is
possible, but needlessly complicated and prone to coding errors.
Pre-C99 extensions for complex arithmetic in C are a royal pain.
Quaternions are rarely used. Equivalent matrix representations are
often easier to work with anyway.
_______________________________________________
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf
More information about the Beowulf
mailing list