Wednesday, February 01, 2012

Dusting off my bookshelf I find a book on FORTRAN

The following quote is from the back of a book that I dusted off and took off of my shelf recently:
FORTRAN is one of the oldest high-level languages and remains the premier language for writing code for science and engineering applications. (NOTE- The back of the book uses Fortran but the spell checker I am using insists on FORTRAN. As a fan of capitol letters, I don't mind going along.)
Was this book written in
  1. The 1960's
  2. the 1970's
  3. the 1980's
  4. the 1990's
  5. the 2000's (meaning 2000-2009)
  6. the 2010's (meaning 2010-2012)
Some questions and thoughts about FORTRAN:
  1. How much is FORTRAN used? Perhaps more than you might think: Its in packages that have been running smoothly and quickly for a long time. It may not be worth it to swap it out for C or C++ or something else. However, it may be hard to modify.
  2. How much new code in FORTRAN is being written? I suspect not much. UMCP does not have a course in it. Does your school?
  3. Since people are not learning FORTRAN we will we become like one of those Science Fiction Aliens who says: Our ancestors left us these machines,but over time we only know how to operate them, not how to fix them or build new ones.
So, when was the book written?

The book is Modern Fortran by Clerman and Spector. The book came out in 2012 (I really need to dust my shelves). I doubt that FORTRAN is the premier languages for writing code in science and engineering. But how far off the mark is this? As always I ask non-rhetorically.

19 comments:

  1. RPI still has FORTRAN programming courses in the schedule.

    ReplyDelete
  2. I know of at least one (close friend) Mathematician who writes his code in FORTRAN mostly because of LAPACK.

    ReplyDelete
  3. At my university (Technical University of Denmark), it seems like the only students who learn FORTRAN, is aroun 5-10 chemistry students every year. Math-people learn Matlab, Software people learn Java, Biochemistry-people learn Perl. Electro-people learn C/C++, and in general most people learn Matlab.

    ReplyDelete
  4. At least climate science is mostly all Fortran. Of the Global Climate Models used in the latest IPCC 2007 report, I can find by googling that the following Global Climate Models are written in Fortran:

    BCM (Bergen Climate Model), Norway
    CNRM-CM, France
    Community Earth System Model (CESM), NCAR, USA
    ECHAM5, Germany
    ECHO-G (based on ECHAM), Germany
    GFDL CM2.x, NOAA, USA
    GISS, NASA, USA
    HadCM3, UK
    HadGEM1, UK
    IPSL-CM, France

    This one, I can only find slight hints that it'd also be Fortran:

    CSIRO Mk3.5 Climate Model, Australia

    These, I could not find much info at all (but all bets are on them being in Fortran, too):

    BCC-CM1, China
    FGOALS, China
    GCGM, Canada
    MIROC3.2, Japan
    MRI-CGCM, Japan

    Model list is from these sources:

    http://www.ipcc.ch/publications_and_data/ar4/wg1/en/ch8s8-2.html
    http://www-pcmdi.llnl.gov/ipcc/model_documentation/ipcc_model_documentation.php

    In numerical weather prediction (local and regional weather forecasts for 1-2 weeks) the scene is very probably all Fortran, too, but I don't have a list of models at hand. Two widely used models that I know of: WRF (USA), and HIRLAM (Europe), are in Fortran.

    ReplyDelete
  5. Not sure of the answer to the popularity question. As to the spelling, FORTRAN is short for Formula Translation. I read somewhere around the time that F90 was introduced that the proper spelling is all uppercase for FORTRAN 77 and earlier dialects, and mixed case for Fortran 90 and subsequent dialects.

    ReplyDelete
  6. Fortran is an old friend of mine, though we parted ways some time in the mid 1990s. I believe that a large corpus of molecular dynamics and other simulation tools is still maintained in Fortran. But I doubt if new tools are written in Fortran, at least exclusively.

    Your 3rd question above got me concerned but I had the following two reassuring (?) thoughts.

    - COBOL has been off the curriculum for quite a while now but existing code is still maintained (albeit by an community of aging programmers); and

    - Well-trained CS graduates with a good understanding of programming in general, should be able to pick Fortran if their duties call for it.

    ReplyDelete
  7. We still offer a small FORTRAN course, but only as a service to the Geosciences department which requires it (since it is similar in syntax to IDL. I was under the impression that it is still used in a lot of embedded systems (bar scanning systems). I imagine that new stuff is being developed, but on more recent standards of the language (F08 being the most recent apparently) which has updated OOP aspects and other features to "keep up".

    ReplyDelete
  8. I've heard from a friend in the physics department that physicists often still use FORTRAN. There is also, apparently, a version of FORTRAN in popular use on supercomputers (which agrees with what some of the other commenters have noted): http://chronicle.com/blogs/wiredcampus/supercomputers-often-run-outdated-software/8184.

    ReplyDelete
  9. I am a retired computer programmer. FORTRAN was the first language I learned, in 1963 at Florida State University. I must admit I was never fond of FORTRAN. My programs ran on an IBM 709 with vacuum tubes and printers with plug boards. I went on to learn over 100 languages after that. COBOL was my third language, which I learnd the year it was released in 1965 and went on to use throughout much of my career. The most recent languages I learned were Ruby and Python for an AI graduate level class I took at UCF, using them to explore the Collatz Conjecture. Fun stuff.

    ReplyDelete
  10. I remember a professor, announce at board that he need a Fortran Programmer. I think he wanted his old codes to be rewritten. I had actually learn a few things while I wanted to explain a piece of code to a civil engineer.
    They still use Fortran and use OpenMP with it. it is fun :)

    ReplyDelete
  11. I had a course last year in numerical analysis where we were required to write programs in FORTRAN. It is still widely used in NA and scientific computing and engineering. There are translators from FROTRAN to C by the way.

    It would be interesting to know how of the new generation use python/java and don't know C/C++.

    ReplyDelete
  12. There are a lot of physicists who still use Fortran. There's so much legacy code written in Fortran, but there's also another reason why people still use it: speed. For numerical work, Fortran code can be faster than the corresponding C/C++ code, and Intel has a really nice Fortran compiler.

    ReplyDelete
  13. Is FORTRAN fast because over time they've got REALLY GOOD
    optimizing compilers for it OR is there something other reason,
    perhaps a reason inherent to the the language. In particular,
    COULD C or C++ be as fast as FORTRAN or is there some reason
    it could not be?

    ReplyDelete
  14. I vote for a "2010's" publication date. There was a 2008 update to Fortran.

    ReplyDelete
  15. Writing optimizing compilers for Fortran is far easier than for C due to things like no pointers to worry about.

    ReplyDelete
  16. GASARCH, that's a good question. Like the Anonymous commenter stated, the older Fortran standard (Fortran 77) did not have pointers. Fortran 90 introduced them, so it did get more complicated for the compiler writers. I know that in the past, C was slower than Fortran for various reasons. However, the performance gap has narrowed over time, to the point where most optimized codes are virtually the same speed. C++ can be slower due to some of the object-oriented features but isn't in most cases. I just found a good discussion about this on the Physics Forums at http://www.physicsforums.com/showthread.php?t=169974 . It looks like my earlier assertion that Fortran is faster is not true in most cases these days. I'm not sure if there is a possibility that Fortran is faster in parallel codes.

    I write all my code in C++ but then port it to Fortran, since that is the only programming language my adviser knows. I'm really not the biggest fan of the language.

    ReplyDelete
  17. There is a famous saying among programming language folks that "We don't know what the scientific programming language of the 21st century will be, but we know it will be called Fortran."

    ReplyDelete
  18. Many programs used to calculate molecules and solids are written in Fortran 90/95 (often with using few selected features from Fortran 2003). Some of them were written from scratch in the last few years (such as elk.sf.net alias exciting-code.org). Most of the programs are designed to run both on small laptops and on hundreds to thousands of cores/processors on supercomputers.

    See http://www.psi-k.org/codes.shtml for a list of codes from this domain of physics/chemistry. (There might be also C/C++ codes in this list, but a large chunk of the codes are written mostly in Fortran.)

    Someone counted recently nine commercial compilers for the x86/x86-64 architecture alone, in addition there are some open-source compilers and other hardware architectures also exist.

    I think one indicator of the current demand is the number of compilers which are implementing Fortran 2003 and 2008 features. If there were only old programs, no one would do this. See http://fortranwiki.org/fortran/show/Fortran+2003+status and http://fortranwiki.org/fortran/show/Fortran+2008+status

    As one can see from the list, recent additions were extensions to the object-oriented programming support of Fortran 90 (such as - in Fortran 2003 - polymorphism, methods bound to a type, inheritance) but also [in F2008] build-in parallelization (coarrays). Upcoming are changes to make Fortran's nifty arrays better accessible from C (and C++) and to enhance the coarrays features.

    ReplyDelete