Slashdot Mirror


Is FORTRAN Still Kicking?

Algorithm wrangler queries: "I'm beginning to wonder if I should invest the time in learning FORTRAN. Although it is, arcane it seems to be the best tool when it comes to demanding optimization tasks and heavy computations. C/C++ does not cut it for me - it is simply too easy to make mistakes and I find myself using half of my time hunting bugs unrelated to the problem at hand. Additionally, although tools like Matlab exist they don't provide the power that justify the huge price tag they carry. I find any script based language (Matlab, Numeric Python, Scilab) to be inadequate as soon as it is necessary to use loops to describe a problem and using such tools for recursive systems can be a real pain. As another data-point, the Netlib repository seems to be very FORTRAN oriented, and it is a true gold mine when it comes to free routines for solving almost any computing task. What bothers me though is that FORTRAN code is really ugly and the language lacks almost any modern day language feature (I know about Fortran 90 but it is not much nicer than F77, and no one seems to use it). Can it really be true that the best tool we have for heavy duty computing is a 25 year old language, or have you found anything better - free or non-free?"

236 of 685 comments (clear)

  1. Yes by mfos.org · · Score: 2, Informative

    FORTRAN is used in high performance scientific computing. The language allows for high parrelelization.

    1. Re:Yes by Chundra · · Score: 5, Informative

      "FORTRAN: "The infantile disorder", by now nearly twenty years old, is hopelessly inadequate for whatever computer application you have in mind today: it is now too clumsy, too risky, and too expensive to use." (1982).

      "In the good old days physicists repeated each others experiments, just to be sure. Today, they stick to FORTRAN, so that they can share each others programs. And bugs."

      --Edsger Dijkstra
      (Interestingly enough, Dijkstra died today.)

    2. Re:Yes by prefect42 · · Score: 5, Informative

      This shows absolutely no understanding of the language. Sit down if you're not in the field.

      I used to teach "Practical Parallel Programminh" at the Univesity of Leeds and this is just crap. Fortran is typically used with OpenMP / MPI to do parallel programming. Older freaks might use PVM. They're all available for C/C++.

      And it's not that I'm no longer in the field, I currently work on Grid/Globus applications.

      Fortran is no more safe or fast to program in I'd argue it's a less safe myself. The performance difference between an optimal fortran program and an optimal C program I'd argue is nearly nil. Show me different, and explain why. Go on, try it.

      jh

      --

      jh

    3. Re:Yes by Rasta+Prefect · · Score: 5, Interesting
      FORTRAN is used in high performance scientific computing. The language allows for high parrelelization.

      This is sort of true. Fortran isn't nessecarily all that much more inherently parallelizable than other languages, but because it is the language of scientific computing quite a bit of effort has been expended on compilers that automatically parallelize for vector computers. For non vector computers, it really doesn't matter what language you use - You'll be using MPI to do it anyway, so as long as you have a set of language bindings, you're ok. (Although as far as I can tell these only exist for C and Fortran...)

      The real reason that FORTRAN continues to persist in scientific computing is twofold - First, there is a huge Fortran code base. Both in terms of things like Numerical Recipies and completed code. For example, I spent my summer integrating a Weather Model with a fluid dynamics model. The Weather Model, MM5 decends from the early 1970's (Pre FORTRAN 77). It's in Fortran. It's large. It would take a hell of a lot of effort to rewrite it, and nobody is going to do it. Theres a quite a bit of this stuff around, and the effort to rewrite it would enourmous, and frankly not worth it.

      Second, most people programming in scientific computing are not CompSci's. They Computaional Chemists, and Electrical Engineers and Meteorologists and who knows what else - but not programmers. They learned FORTRAN and as long as they can get their stuff done in FORTRAN, they're not gonna learn C so they can track down a segfault when their pointers wander off an array. The new PhD's probably learned C and will use it if starting from scratch(After all, even in FORTRAN 90 Dynamic allocation and pointers are really, really limited, often requiring recompiles whne your problem size changes), but 40-50 year old computational chemists are not gonna learn C. Period. So FORTRAN continues to get upgraded. At least they got rid of the @#$% Hollerith-punch card column layout...

      --
      Why?
    4. Re:Yes by joto · · Score: 4, Insightful
      Is there any language Dijkstra actually liked? I quote:

      PL/I, "the fatal disease", belongs more to the problem set than to the solution set.

      The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence.

      APL is a mistake, carried through to perfection. It is the language of the future for programming techniques of the past: it creates a new generation of coding bums.

      It is practically impossible to teach good programming style to students that have had prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

      Well, I think I might have heard somewhere that he actually said something nice about Algol, but I can't find a quote anywhere.

      Anyway, I wouldn't bother too much about what Dijkstra said 10-20 years ago about programming languages long dead. Both FORTRAN, COBOL and PL/1 has clearly proven themselves useful in numerous real-world applications. And contemporary Basic, like Visual Basic shares almost nothing but the name with the kind of BASIC Dijkstra was talking about.

      Of course, being a computer scientist, I certainly agree with him, but even I am not doing what I preach. C++ is certainly a large pile of shit, and C isn't much better. Java could almost make it, if it wasn't already so braindamaged by the C/C++ infection. Perl is certainly an offense to anyones aestethics (if people have that these days). Python could almost have made it if it weren't for the completely braindamaged scoping rules, and various other twarts.

      Well, guess what languages I use at my workplace? Do I violently disagree? No, because these are the languages that actually do the job, they have fine implementations you can trust, they have lots of available libraries for almost any task, and most people already know them, meaning anyone can pick up where the last person left.

      I am not a numeric analyst, so I've never had the use for Fortran, but if that was what I was mostly doing, I would certainly learn it. Learning to speak the lingua franca of numerical analysis will certainly be helpful if that's what you are going to do, even if you don't intend to use it yourself (but you will, trust me - I use C myself for the same reason). And I highly doubt that Fortran 9x is not much nicer than FORTRAN or Fortran 77, numerical people doesn't seem stupid to me, and certainly not as stupid that they would have invented it otherwise.

    5. Re:Yes by the+eric+conspiracy · · Score: 4, Informative

      Perl has become popular among non-programming scientists

      I'm a scientist who cut his teeth on FORTRAN, and still use it for a variety of reasons, including the richness an quality of the numeric code available for use with the language, and the most excellent optimizing compilers that can be used.

      Perl has none of that.

      Perl is fine for weeding through a lot of data that has been generated using automated D/A systems, but that is text processing which Perl is very strong at.

      But for computationally intensive tasks, Perl is just wrong.

    6. Re:Yes by mjprobst · · Score: 3, Insightful

      Keep your eyes on the progression of Python. They haven't fixed all the braindead scoping rules, but there appears to be an underground movement to move them towards something remotely more sane. Lots of work being done on Python between 2.0 and 2.2 . . .

    7. Re:Yes by Rasta+Prefect · · Score: 2
      Anybody remember FORTH

      Actually, FORTH still finds usage in various firmware Applications. I believe(but could very easily be wrong) that its generally used in firmware of most PCI boards...

      --
      Why?
    8. Re:Yes by Rasta+Prefect · · Score: 2
      I am not a scientist, but I know a few. My observations are that much new scientific programming is done in Perl. It seems to me that Perl has become popular among non-programming scientists for the same reason that FORTRAN became popular 30 years ago: It is easy to get stuff done. I don't think this trend has anything to do with computation speed or available libraries. It is strictly about the ease of use for "pragmatic" users.

      This if course depends on your definition of scientific computing. If you're just sorting data, Perl is an excellent choice - thats exactly what its designed to do. However, you wouldn't exactly want to write large scale flow solver in it...

      --
      Why?
    9. Re:Yes by PinkHeadedBug · · Score: 3, Insightful

      (My apologies for the repost... wasn't logged in... argh!)

      The performance difference between an optimal fortran program and an optimal C program I'd argue is nearly nil. Show me different, and explain why. Go on, try it.

      Pointer aliasing.

      The effort required to generate the "optimal" C/C++ program working with matrices or greater multidimensional arrays is nontrivially higher than the effort needed in FORTRAN.

      Look, I'm not pro-FORTRAN. But credit where credit's due, people. C/C++ compilers worry about things that FORTRAN compilers don't, mostly because of the semantics of multidimensional arrays in each language (one should say the lack of multidimensional array semantics in C/C++). Why do you think Blitz is such a hit? Why do you think so many compilers have all sorts of non-standard ways of letting the user indicate that there's no aliasing on a given pointer in memory (remember noalias? what about those ugly restrict and unlikely_alias hacks?)?

      You can make your number-crunching C/C++ code as fast as the FORTRAN folks' code, but it typically requires knowing more about your language tools than the aforementioned FORTRAN programmer worries about.

      So, give them the nod on this one. You've got them beat on any number of other fronts.

    10. Re:Yes by aebrain · · Score: 2
      Modula-2 or Ada or Logo I have not seen a wisper about in years. from what I recall Logo was to be the teaching language of the future ( back in the mid 80's ), Ada was to be the next big thing is the 80's, and modula-2 was to replace C

      The first language I programmed in was FORTRAN II back in the 60's, when I was under 10. The code had to be run at the Nuclear Research Establishment at Harwell in the UK. Remember, there weren't as many computers around back then, maybe 10 in the country. It made being a pre-teen 31337 haX0r difficult. :-)

      The last time I programmed in FORTRAN - FORTRAN 77 in fact - was for the communications facilities for the State Electricity Commission of Victoria, a system to help restore power in case of emergency. That was in 1987.

      I still use Ada - recently for the spaceflight avionics for a scientific research satellite, and will be teaching a course in it to some people doing the avionics for a helicopter in a couple of weeks. Though the use of Ada has shrunk, it's making a strong comeback in the field of avionics, where a crash in the program could mean the crash of an aircraft.

      My advice to the original poster - by all means learn FORTRAN as a fifth- or sixth- language. Even the 95% Godawful languages(VB..) can teach you something. There are times I use Java and think "why the HECK can't it have feature X of Ada-95?". There are times with Ada-95 that I say "Damn, feature Y is so clumsy compared with Java." FWIW Matlab seems to be the way of the future for non-software engineers to quickly do calculations and display the results graphically, it's a pretty good FORTRAN replacement. What EXCEL is to accountants, Matlab is to scientists.

      --
      Zoe Brain - Rocket Scientist
    11. Re:Yes by The+Grey+Mouser · · Score: 2, Informative
      I'm a scientist who cut his teeth on FORTRAN, and still use it for a variety of reasons, including the richness an quality of the numeric code available for use with the language, and the most excellent optimizing compilers that can be used.

      Perl has none of that.

      Perl is fine for weeding through a lot of data that has been generated using automated D/A systems, but that is text processing which Perl is very strong at.

      But for computationally intensive tasks, Perl is just wrong.

      This may be changing soon. Check out the Perl Data Language, which is designed to allow rapid calculations on large matrices using Perl syntax (and, of course, allowing use of Perl's text manipulation facilities directly). I don't imagine it's as fast as Fortran, most especially if you're using HPF or the like, but it's fast enough for a large array of applications. I'm an astronomer and use it fairly regularly for image analysis, statistical and visualisation tasks. Not yet as mature as IDL, but that seems to be where it's headed.

      Cheers,

      Michael

    12. Re:Yes by Rasta+Prefect · · Score: 2
      In fact, there is a massive effort underway to do essentially that. Since MM5 and RAMS are so archaic and lack certain critical features for the newer models, a newer model called WRF is being created as a potential replacement for these two older systems. And FORTRAN is the expected language of choice even for this newer atmospheric model.

      Hmmm...I wasn't aware of this. But let my take this opportunity to say thank god. Archaic just begins to cover it...Think they'll do something about the redundant bloody awful output format?

      --
      Why?
    13. Re:Yes by the+gnat · · Score: 2

      Part of the point of F90 is that you can multiply arrays with a single command (or operator?). This is then parallelized by the compiler. It's a nifty shortcut, if you need to do this kind of thing a lot- not something that can be done with C/C++. Of course, Matlab can do this too, and for tasks that don't take lots of time it may be better. (I read on comp.lang.fortran that some of the modules for Matlab were equivalent to what you'd get writing optimized assembly. . . pretty cool. and expensive.)

      There may be a few reasons to use F77 for new software, but I'm not aware of any. The problem is that people hang on to it longer than they should. Far too much of the software I use is written in F77, and the flaws in this are exasperating. I hate having to use the same amount of memory whether I'm dealing with peptide fragments or large protein complexes. . . sure, it's fast, but it's a bitch to try to extend.

    14. Re:Yes by jovlinger · · Score: 2

      Interesting.

      What's your take on the two level approach: things like NEPL or Python + NumPy?

      The idea being that you write the complicated bits in a high-level language that can be debugged and understood by mortals, and the really hairy parallel bits in a low-level language. The assumption being that the complicated bits tend to take relatively little CPU time, but alot of programmer time.

      The punchline is that the low level bits tend to always be matrix ops, so you just wrap BLAS or some other hyper-optimized code (heh! Fastest FF in the West perhaps) in a suitable foreign function interface and call that directly from the high-level language. So you don't need to write low level code ever...

      This always seemed to me to be the most appealing way to write numerical programs, but since I _never_ need numerical code, what do I know?

    15. Re:Yes by sbaker · · Score: 2

      > Is there any language Dijkstra actually liked?

      In the 1980's, he wrote a lot about a language called SAASL - which is a varient of Lambda Calculus...obscure stuff to be sure.

      He wrote his algorithms in a language of his own invention - for which a compiler did not exist and which is hard even to type because it uses a lot of non-ASCII characters.

      Dunno what he actually programmed in though.

      --
      www.sjbaker.org
    16. Re:Yes by PythonOrRuby · · Score: 2

      If you're interested in PDL, you shoud also be keeping an eye on Perl6 and Parrot, which frm what I've seen look to be incorporating PDL ideas into the base implementation.

  2. Use Fortran 90 by Lally+Singh · · Score: 5, Informative

    Fortran 90 has plenty of structured programming features to make maintainable code. Equally, if not more important, is that Fortran code can be much better optimized than C/C++ code for numerics. IBM did a good job on Fortran, and it's still a major player today.

    --
    Care about electronic freedom? Consider donating to the EFF!
    1. Re:Use Fortran 90 by rsilva · · Score: 3, Informative

      Yes, I completely agree. I have already posted a message about this in Slashdot foruns where I described some of the Fortran 95 characteristics:

      http://slashdot.org/comments.pl?sid=3041&cid=145 39 90

      Something that changed from that time is that now we have a free compiler for non-commercial use (linux, i386):

      http://www.intel.com/software/products/compilers /f 60l/noncom.htm

    2. Re:Use Fortran 90 by L0C0loco · · Score: 5, Informative

      Here at NASA we still use fortran (F90) for our processing of satellite remote sensing data. For brute strength and optimized speed it is hard to beat. F90 makes the code easier to work with. I like to use the AbSoft F90 compiler on my linux cluster. There are only a few differences from the DEC (HP - Compaq - whatever) fortran for thier Unix and Digital Fortran for Windoze. Using some good F90 rules adherance tools to keep you from including propriatary extensions smooths the process of assuring portable code.

      If you need to develop number crunching code that has a limited lifetime (disposable code) you might consider RSI's Interactive Data Language. This IDL is wonderful for developing code fast and is very powerful with its built-in graphics. It is also vector/matrix oriented and few loops are really necessary once you get used to the language. Bad part about IDL is the cost unless you can qualify for the student version ($75 last time I checked). Best part is that is comes with an extensive library of high level functions.
      Check it out at http://www.rsinc.com/ .

      Enjoy! Z

      --
      -- Instant Karma's gonna get you! [320848 = 2*2*2*2*11*1823]
    3. Re:Use Fortran 90 by norwoodites · · Score: 2

      The only aliasing issues is because they do not use the allowed aliasing rules from ISO C90.

      In fact in gcc 3.0 and above, the aliasing rules work for c but the aliasing rules are turned off in the c++ front-end of gcc.

    4. Re:Use Fortran 90 by Milalwi · · Score: 2

      Fortran 90 has plenty of structured programming features to make maintainable code. Equally, if not more important, is that Fortran code can be much better optimized than C/C++ code for numerics.
      Agreed on both points.

      We have "ported" a number of programs from F77 to F90 and they are much more maintainable as F90 programs.

      There still are enormous Fortran code bases in the engineering and scientific fields. A vendor of a major (in my field anyway) application program started moving their code base from F77 to F90 a few years ago. That program suit is about 1.2M lines of code.

      Milalwi
    5. Re:Use Fortran 90 by the+eric+conspiracy · · Score: 3, Funny

      I remember when we thought we could do anything with FORTRAN 4.

      Well, it is Turing Complete.

    6. Re:Use Fortran 90 by silentbozo · · Score: 2

      Any IDL programmer who has tried to eke out decent performance out of the TV routine would agree with me... And the fact that only the Windows version has a supported visual toolkit builder is really annoying.

      And what the hell is with drag events not being supported on Macs and PCs? Someone please explain that to me!

    7. Re:Use Fortran 90 by srslif16 · · Score: 2, Interesting

      Yes, use f90. It is much better than f77, and it has many good features, such as the possibility to require certain precision of variables. In a study of performance of f77, f90, C, and C++ on a CRAY T3E, a few years back, there was no performance difference between f77 and f90, C was 10% slower than f77/90, and C++ was 100% slower. Of course, the C++ compilers have become better, but so have the fortran compilers. For scientific computations, fortran is still alive, and prodding buttock galore.

    8. Re:Use Fortran 90 by ebbe11 · · Score: 3, Funny
      there was no performance difference between f77 and f90, C was 10% slower than f77/90, and C++ was 100% slower.

      100% slower? That means it didn't run at all!

      What you probaly meant was that Fortran was 100% faster than C++.

      --

      My opinion? See above.
    9. Re:Use Fortran 90 by silentbozo · · Score: 2

      Hmmm... Right now all of our existing code uses Direct Graphics - most of it originated with IDL 4x. I've looked into using Object Graphics, but it's a whole new kettle of fish to learn and implement consistently alongside of the current code (there are a couple of guys who are still into using common blocks), so I was planning to put it off.

      However, if Object Graphics really is that slick, maybe I should look into recoding our display interfaces. Will OpenGL acceleration work for TVing bitmapped images? I had gotten the impression from the docs that it only sped stuff up if you had 3D data...

  3. FORTRAN lives by evilpenguin · · Score: 2

    Yes, FORTRAN is still alive, and many important scientific applications are still written in it and maintained in it.

    Alas, for the rest of the question, I'm not a mathematician/number cruncher. The only floating point numbers I deal with are currency...

    1. Re:FORTRAN lives by catfood · · Score: 2

      Mod parent +1 funny?

      You really, really don't want to use floating point for currency values. Eventually the logarithmic nature of floating point data formats will cause your calculations to be just a penny or two off.

      Much better to use a BCDish class or dedicated decimal type, depending on your programming language. Worst case, do all your calculations in the smallest unit possible, e.g. cents in the US.

    2. Re:FORTRAN lives by catfood · · Score: 2

      You are cool, I don't care what everyone else says about you.

      But why not just use the best tool for the job? At least when you're not out to impress people?

      You can use floats and have to work around their limitations, or you could use BCDish math as it was intended to work.

      Or are we in violent agreement?

    3. Re:FORTRAN lives by TWR · · Score: 2
      You better use a fixed decimal notation for interest calculations, or you are going to end up with highly pissed off customers. Floating point math is too inaccurate to use for financial calculations.

      -jon

      --

      Remember Amalek.

    4. Re:FORTRAN lives by evilpenguin · · Score: 2

      I think we are in violent agreement. Except for your claim that it is "funny" to use floating point for currency. There's no reason (except speed) not to. You have to do it right. You also have to do it right if you use integers. BCD is my choice (read my earlier reply) because it strikes a nice balance between performance and convenience.

      Your original post seemed to assert that one would be foolish to use floating point. I think that was wrong. That said, I think you were absolutely right about what works better and why.

      Oh, and your also wrong about aomething else. Everyone else does think I'm cool. Overwieght 35 year olds who program for a living are the the stuff of all of next year's Hollywood thrillers... ;-)

    5. Re:FORTRAN lives by dvdeug · · Score: 2

      You can most certainly keep all floting point noise below your precision, even when using IEEE floating point numbers.

      Maybe. But if you're doing a job that by law _must_ be done to a certain precision, it's wiser to use tools that are designed to that precision, rather than one's that were designed to lose that precision for other concerns. If you use integers or BCD, that's one less source of error you have to worry about.

    6. Re:FORTRAN lives by TWR · · Score: 2
      This actually happened to a company I worked for. A wretched programmer built this application that calculated costs using floating point. Even though values were tiny, errors in the cents column started appearing. Our client heard about it from one of their customers (unhappy that they were being overcharged), and we heard about it from our unhappy client. Needless to say, crappy programmer guy had long since quit and the problem was left for someone else to fix.

      This was a Java program, back in the days when JDK 1.1 (with its BigDecimal class) were cutting edge and not entirely to be trusted, so we had to write our own fixed place class or licence one from someone else (I forget which we did).

      -jon

      --

      Remember Amalek.

    7. Re:FORTRAN lives by evilpenguin · · Score: 2

      Those numbers also cannot be represented in BCD or in integers. By definition, any irrational number cannot be perfectly represented by a finite number of bits. BCD is great for currency because you are only interested in one more decimal place than you display, and this number of places is always the same. You don't get the rounding error you get with mantissa/exponent representations.

      I never ever claimed using floating point was the best idea, merely that it wasn't an inherently bad idea. Not sure how that makes me a troll (as my first response was modded).

      Depending on the processor and library, there can be distinct advantages to using floating point, like overflow and underflow exceptions, support for infinities and not-a-number values, and so on.

      I also specifically disclaimed special knowledge of this area in my original post, where I specifically stated that my work has me working mostly with OPM, not with scientific and engineering applications.

      The post that suggested my post whould be modded "+1, Funny" seemed to be asserting (and the link he offered also supported this) that it was unreasonable to use floating point in currency applications. It might not be the best design decision, but it is certainly not unreasonable. That was my sole and entire point.

    8. Re:FORTRAN lives by dvdeug · · Score: 3, Informative

      I never ever claimed using floating point was the best idea, merely that it wasn't an inherently bad idea.

      But it is an inherently bad idea. You're better off using strings, for crying out loud. You don't need the sin, sqrt, 1E-100 stuff that floating point offers you. You do need exactness to the cent, no matter how large the numbers are - something floating point doesn't offer you.

      Depending on the processor and library, there can be distinct advantages to using floating point, like overflow and underflow exceptions, support for infinities and not-a-number values, and so on.

      Which are worthless. You don't want infinity or not-a-number - you want it to raise an exception where you screwed up, which integer types in better languages do. You don't want an underflow exception - you want it silently round to zero. And you can get overflow exceptions on integers just as easy as on floats.

    9. Re:FORTRAN lives by evilpenguin · · Score: 2

      We are merely disagreeing by degrees. Can we move on?

    10. Re:FORTRAN lives by markmoss · · Score: 2

      You better use a fixed decimal notation for interest calculations, or you are going to end up with highly pissed off customers. The issue isn't accuracy - double-precision floating point is probably more accurate than the fixed-point decimal calculations most accountants use. But binary floating point results are going to be slightly _different_, and they'll probably even be different from machine to machine. Accountants generally feel that they have to account for even trivially tiny discrepancies - so whenever you throw away the lowest digits at all, it's important to be inaccurate in the exact same way every time.

  4. A beauty all its own by Yoda2 · · Score: 2
    FORTRAN was one of the first languages that I learned and although I don't use it much now it still has a special place in my heart. I always found its simplicity and structure sort of comforting.

    I'm a Java convert now thought.

    1. Re:A beauty all its own by jazman_777 · · Score: 3, Funny
      FORTRAN was one of the first languages that I learned and although I don't use it much now it still has a special place in my heart. I always found its simplicity and structure sort of comforting.

      I always liked how I could define variables on the fly anywhere in the code. Really catered to my total lack of organization and self-discipline. I can do that in Perl, now, too!

      --
      Slashdot: Failed Car Analogies. Amateur Lawyering. Anecdote Battles.
  5. NOAA by OpenSourceRulez · · Score: 4, Insightful

    As a recent CS grad I had to help some of my friends in the Meteorology department with their programming course(of course not taught by a CS prof). To my surprise it was FOTRAN. It seems a lot of the stuff NOAA and other government agenicies program is in FORTRAN so it is compatible with the stuff they stil use from the 70's and 80's.

    --
    "Success is not the result of spontaneous combustion. You must first set yourself on fire." -- Fred Shero
    1. Re:NOAA by GuidoDEV · · Score: 5, Informative

      Speaking of meteorological programming, ALL the major atmospheric models are written in FORTRAN. The ETA, AVN, NGM, MM5, WRF, and scores of lesser-known models...all of them written in FORTRAN (most of them FORTRAN-90 now, but some of the older ones are FORTRAN-77). The MM5 & WRF may be found here and here. The source code to several others is readily available as well if you're so inclined, for instance the ETA and the ARPS. Anyone wanting to run them may do so fairly easily on a PC running Linux (any new PC will be able to run a fairly hi-res model real-time); I do so myself.

    2. Re:NOAA by Jandar0 · · Score: 3, Informative

      Well, I can't speak for other agencies, but here at NASA Glenn Fortran is very much alive. A huge amount of the thermodynamic cycle/turbomachinery analysis that gets done around here is done using legacy Fortran code. Though they are no longer developing new codes in Fortran (at least in my office), it still lives. Rather than rewriting Fortran code, the effort (mine anyways) currently goes into writing generic GUIs for Windows to interface with those programs.

    3. Re:NOAA by GuidoDEV · · Score: 2, Interesting

      > Most of the models were all written during the 60's & 70's...

      Not true, most atmospheric models have been written since 1980, although some of them were an extension of earlier models written in the 60s/70s. The earliest models were written in the mid-60s, and development on them didn't really take off until the mid-late 70s and early 80s, when models began to be introduced in rapid succession. Even today many models are currently being developed anew (the WRF and ARPS, for instance, neither of which existed prior to the 90s--in fact, the 1.0 release of the WRF was in Fall 2000), and new ones are announced quite frequently. They are still all written in FORTRAN, however, as FORTRAN is the standard for large-scale scientific computing.

  6. of course it's still kicking by krog · · Score: 2

    my dad is a physicist. he, and every colleague of his who writes code, writes it in Fortran.

    part of it is that there's 40 years of perfectly good legacy code to keep using. but mostly it's that C's numerical libraries still, after all this time, aren't as fast as a good Fortran's.

    1. Re:of course it's still kicking by ttfkam · · Score: 3, Informative

      C's libraries may not be (and may never be due to compiler pointer aliasing issues), but C++'s are. One in particular is Blitz++.

      Not to take away from Fortran. Language in general means far less to performance than an experienced programmer and good algorithms.

      --

      - I don't need to go outside, my CRT tan'll do me just fine.
    2. Re:of course it's still kicking by brer_rabbit · · Score: 2
      part of it is that there's 40 years of perfectly good legacy code to keep using. but mostly it's that C's numerical libraries still, after all this time, aren't as fast as a good Fortran's.

      I used to accept this as a good argument but I'm starting to question it. C has been around long enough that it's math libraries shouldn't be lacking. What's wrong? Why haven't the C libraries caught up to speed? Are you talking about proprietary libraries or the basic libm.so?

    3. Re:of course it's still kicking by dvdeug · · Score: 2

      C has been around long enough that it's math libraries shouldn't be lacking. What's wrong? Why haven't the C libraries caught up to speed? Are you talking about proprietary libraries or the basic libm.so?

      We're not talking about sin, cos and the other stuff from the C library. We're talking about vector calculations and the like. The reason why Fortran's libraries are better are several fold. First, Fortran's still older; the stable Fortran 77 standard predates the stable C89 standard by ten years. Secondly, all the physicists and engineers are trained only in Fortran, so that's what they use, and when people need to speed up numeric code, that's what they optimize.

      Lastly, the Fortran standard dictates that any two arrays passed to a function do not alias - if they do, it's a error in the program. Since C compilers can't make that assumption, there's points where a Fortran compiler can rearrange actions for greater speed that a C compiler can't.

    4. Re:of course it's still kicking by jaoswald · · Score: 3, Informative

      There are some fundamental weaknesses in the C language that make it less-than-optimal for writing numerical codes.

      1) C arrays are nothing more than pointers in drag. "Aliasing" of multiple pointers pointing into the same region of memory can cause optimizations to introduce bugs. Because all array accesses are done as if by pointer arithmetic, it is hard to deal with multi-dimensional arrays where more than one dimension can vary (think rectangular MxN matrices). There is a bias in the language toward manual pointer movement (*p++, etc.) to efficiently stride through arrays.

      2) C always "wants" to compute with doubles. (E.g. the usual trig libraries all return doubles, and the default function call rules cast float arguments to doubles.) Serious number crunching code may want to use single precision floats to conserve memory and, more importantly these days, cache and memory bandwidth.

      3) No built-in exponentiation operator. (Important so that the compiler can optimize small integer powers as combinations of multiplications.) No built-in, transparent complex number support. E.g. trig functions with complex arguments.

    5. Re:of course it's still kicking by norwoodites · · Score: 2

      It is not because of c pointer aliasing issues, it is because nothing in c was allowed to be inline, this is all mute with C99. The keyword inline works in gcc 3.0 and above.

    6. Re:of course it's still kicking by brer_rabbit · · Score: 2

      I can accept those as valid reasons. The original poster said C's numerical libraries weren't as fast as Fortrains. To me this implies the C libraries themselves could be coded better. But as you explain, it's language design / compiler constraints that differentiate the two.

    7. Re:of course it's still kicking by stux · · Score: 2

      that is soooo not true.

      Doubles are only the same size as ints when ints are the same size as doubles.

      (yes, seems obvious)

      but on most 32 bit architectures doubles are 64 bits and ints are 32 bits. (mind you, the 68k compilers generally used either 16 bit or 32 bit ints... depending)

      on 64 bit architectures, int might be equal to long equal to double.

      BUT YOU CAN NOT ASSUME THIS.

      you can't even assume that long long is 64 bits...

      --

      ---
      Live Long & Prosper \\//_
      CYA STUX =`B^) 'da Captain,
      Jedi & Last *-fytr
  7. FORTRAN is easy by Philippe · · Score: 2, Informative

    You can become a passable FORTRAN programmer in a couple of hours if you already know another language, such as C or Pascal. There are a couple of gotchas (predeclared variables & COMMON statements IMHO).

    If you are going to touch any heavy simulation code (such as statistics, physics & biology) learn FORTRAN. It works very well for those problems. Yes, it is old, but that doesn't mean it's bad. It's not modern, but it works surprisingly well.

    I find myself teaching FORTRAN to budding scientists, and they are able to write complex stuff very quickly because they don't trip all over the language (e.g. '==' vs '=' in C).

  8. It's still kicking... by drudd · · Score: 5, Insightful

    Fortran has several things going for it...

    1) it's been the standard scientific computing language for so long, that every platform has a compiler, and that compiler is likely to be very mature (i.e. stable, and produces fast code).

    2) since it's been a standard for so long, everyone has routines written in it which have been debugged and work, no sense rewriting them and introducing errors.

    3) the language itself lacks complicated constructs, so it is very simple to optimize. This, with (1) makes fortran still outperform c, thanks to the compilers.

    That said, I HATE fortran with a passion, mostly because it's ugly. 6 character variable names are impossible to deal with. Couple this with capitalization and indentation rules left over from the punch card era and you have code which is literally painful to read.

    Doug

    --
    Venn ist das nurnstuck git und Slotermeyer? Ya! Beigerhund das oder die Flipperwaldt gersput!
    1. Re:It's still kicking... by Rasta+Prefect · · Score: 2
      3) the language itself lacks complicated constructs, so it is very simple to optimize. This, with (1) makes fortran still outperform c, thanks to the compilers.

      This really isn't true so much any more. Usually the performance difference comes from having a more mature compiler, which is becoming less and less an issue. In my experience they usually come out fairly similar. This said, you do sometimes have to watch just how you allocate and play with Arrays in C if you really want to squeeze the maximum performance out of it. Of course since dynamic allocation is so primitive in Fortran that you can't do multi dimensional arrays the "wrong" way....

      That said, I HATE fortran with a passion, mostly because it's ugly. 6 character variable names are impossible to deal with. Couple this with capitalization and indentation rules left over from the punch card era and you have code which is literally painful to read.

      You should give Fortran 90 a shot. The more grevious of FORTRAN's punch card related sins have been eliminated or made optional. Although last time I checked FORTRAN had no cap rules. At least _standard_ Fortran has no cap rules...Conventions, but not enforced rules.

      That said, I too, HATE fortran with a passion. Why does it do that stupid little thing when its writing binary data, tacking the extra integer on the beginning and the end? I hate that! Particularly when the specs for the output file don't mention it was written in that weird Fortran mode so you spend all @#$% day trying to figure out why your're getting floating exceptions and your parsing routines are off as you read through the file...

      --
      Why?
    2. Re:It's still kicking... by coats · · Score: 3, Informative
      Wrong about the GNU compiler.

      As a matter of fact, Craig Burley (original author of "g77") had quite a fight with RMS over optimizations that "gcc" did not provide but that are necessary for performance in a language where multi-dimensional arrays are first-class citizens.

      There are still a couple of "compilers" that translate into C (Gnu "fort" which is basically both obsolete and dead from a development point of view, and NAG "f90" that is free and is OK if you are only doing development work that doesn't involve real number crunching.

      Neither is used for serious computational work; having to live within the C aliasing rules doesn't permit the optimizations necessary for high performance computing problems.

      --
      "My opinions are my own, and I've got *lots* of them!"
    3. Re:It's still kicking... by jmv · · Score: 3, Interesting

      I believe that the GNU and at least a few commercial fortran compilers translate the code to C before it compiles.

      While this may be true (although I think both C and FORTRAN are translated to an intermediate form), I'd say that gcc doesn't qualify as a high performance FORTRAN compiler. On the other side, if you look at the compilers provided with super-computers, the FORTRAN compiler is usually much faster than the C compiler. I heard the main reason is because of the C pointers. In fortran, when a function receives two arrays as input, the compiler can assume (it's part of the language) that they are different arrays. In C, for the same function, you are allowed to send it the same array twice (it's called aliasing), so because of that, the compiler is restricted in the optimizations it can perform. This kind of ambiguities happen in other places too. That being said, I HATE FORTRAN and for me, C++ when carefully coded can be nearly as fast (Of course, I'm also using gcc which performance is adequate but not more...).

    4. Re:It's still kicking... by astroboy · · Score: 3, Informative
      I don't think there is anything in the above post which is correct.

      The poster says:

      I believe that the GNU and at least a few commercial fortran compilers translate the code to C before it compiles.

      This isn't true, and I don't think has ever been true. Below is a quote from a g77 page:

      The g77 compiler is a combination of a front end that translates Fortran source programs and a back end that uses the results of the translation to make an object or executable file that performs the actions specified by the source programs when run. The back end is the same back end used by GNU C, C++, and Objective-C, which have their own front ends to translate their respective languages. Other front ends for Pascal and ADA are available or in progress. (Note: g77 does not translate Fortran to C code at any point. It is a native portable compiler, just like gcc. They share the same back end.)

      No commercial compiler I'm aware of does anything similar, either. Obviously, one should be wary of taking language advice from someone who is this ill-informed about compilers.

      As for unrelated bugs, this can be an issue. If all one wants to do is a fourier transform, or a singular-value decomposition, or something similar, on some data, it's clearly ridiculous to have to learn the C++ STL, or similar libraries in other languages, to just mess with some matricies. FORTRAN, for all its problems, Will Just Work as long as you're doing something simple.

      On the other hand, if you're just doing some small stuff and you don't want to deal with more complicated languages, the best bet is probably to use Matlab/IDL/Maple/Mathematica and not worry about computer programming at all. Even if you're planning on doing big calculations at this point, prototyping your algorithm and methods in these interpreted special-purpose tools can be a very good way to get your code up and running.

    5. Re:It's still kicking... by Slak · · Score: 2

      4) MSFT hasn't bastardized it (yet).

      Cheers,
      Slak

    6. Re:It's still kicking... by Ooblek · · Score: 2
      As for unrelated bugs, this can be an issue. If all one wants to do is a fourier transform, or a singular-value decomposition, or something similar, on some data, it's clearly ridiculous to have to learn the C++ STL, or similar libraries in other languages, to just mess with some matricies. FORTRAN, for all its problems, Will Just Work as long as you're doing something simple.

      But that problem falls into the realm of selecting the right tool for the job rather than trying to paint C++ as too difficult to use just for that reason.

      NAG, which you can buy, does translate the code into C. (I believe someone already replied and mentioned this fact.) I had to deal with its inability to transform strings from some Fortran code in a project I was involved with in college just because of this translation. That ill-informed comment was not neccessary.

      FORTRAN, for all its problems, Will Just Work as long as you're doing something simple

      Oh, well, there we go. The defacto standard in what we should all learn next is Fortran because it Will Just Work (well, unless you are doing something thats NOT simple). I can't really recall the last time I did something simple....oh, wait.....here is the last simple program I wrote:

      int main (int argc, char** argv) {
      printf ("Hello, World!\n");
      return 0;}

      Yeah, it was hard to compile an all, but I got it to work finally.

      On the other hand, if you're just doing some small stuff and you don't want to deal with more complicated languages, the best bet is probably to use Matlab/IDL/Maple/Mathematica and not worry about computer programming at all. Even if you're planning on doing big calculations at this point, prototyping your algorithm and methods in these interpreted special-purpose tools can be a very good way to get your code up and running.

      Did you not read the parent post? The poster specifically mentions some reasons why some of these packages don't work for what he is trying to do. It must be the karma.

    7. Re:It's still kicking... by MisterBlister · · Score: 2

      [quote] Neither is used for serious computational work; having to live within the C aliasing rules doesn't permit the optimizations necessary for high performance computing problems. [/quote] Most modern C/C++ compilers have ways of limiting aliasing issues either at the file or even sub-file (using #pragmas) level. Surely these Fortran->C convertors could be modified to use them?

    8. Re:It's still kicking... by jc42 · · Score: 2, Troll

      Some years back, at a university that will remain unnamed (so you might think it's yours ;-), a bunch of us grad students decided to instrument the Fortran compiler that was used for most of the number crunching on the big department monster machine. The hardware handled integer overflows by setting a flag bit, which then had to be tested by a separate opcode, and the Fortran compiler didn't generate this test. (For floating point, there was an interrupt that couldn't be ignored.)

      The instrumentation added a test that recorded the overflow, let the computation continue, and wrote some results to an accounting file.

      What was found was that almost exactly half the Fortran runs produced at least one output number that was wrong due to an undetected overflow.

      When this was publicised, a survey of Fortran users was done. They were asked whether the compiler should test for overflow if such a test would take an extra opcode and slow the program down. around 90% of the users said that such tests should not be done if the program would run slower.

      This taught us an important lesson about the Fortran user community. And note that in the replies here, a lot is made of Fortran's optimizations. Now you know what that means.

      Around the same time, there was one of several analyses of the Fortran runtime libraries on IBM 370 mainframes, which are still in wide use for big number-crunching applications. The analysis showed that the double routines were accurate to only float precision over roughly half the range of their arguments. At the time, these routines had been in widespread use for maybe two decades.

      When a Fortran programmer uses double rather than float, it usually means that the computations needs the extra precision, and float doesn't have good enough precision to give correct output. For users to accept a Fortran that can't do doubles correctly half the time is another good sign of the nature of this user community.

      So in general, Fortran users seem to use it because they consider efficiency more important than correct results.

      I wonder if Enron's accountants use Fortran?

      --
      Those who do study history are doomed to stand helplessly by while everyone else repeats it.
    9. Re:It's still kicking... by jaoswald · · Score: 2

      If F2C converters could understand Fortran and the compiler-specific pragma rules well enough to do this reliably, then they'd have to be as good as a good Fortran compiler, targeted at a C implementation instead of a real machine. I.e., it would be as hard as just writing a Fortran compiler!

      Also, you'd have to depend on the C compiler not only respecting the pragmas but making FULL use of them. Again, just as hard as writing a Fortran optimizer.

      Any conversion step is going to make it difficult to pass on all the available semantic information present in the original source code to the next stage of compilation, and harder for the later stages to recognize the semantic information that would guide the optimization process.

    10. Re:It's still kicking... by Rasta+Prefect · · Score: 2
      Hmmm, You must be using something other than fortran to read those files. While I hate Fortran, I use it when required - just another tool to get the job done. If you have the fortran source code, you can avoid the 'extra integer' problem by using the proper parameters in the OPEN statement on most compilers. I believe that is a hold over from the old days when people used 9-track tapes. Sad thing is that people still use tapes exept they're now 8mm, DAT, QIC, ...

      C in fact... I generally _do_ use Fortran to read files output by Fortran programs, because I'm usually hacking those programs...However in case I had already written a pretty decent amount of code before this annoyance came to light, and the nature of the task made writing the program with Fortrans very limited dynamic allocation abilities something I didn't really care to attempt. It's not really that big a deal once you know it's there, but when you don't...:)

      --
      Why?
    11. Re:It's still kicking... by jmv · · Score: 2

      Fair enough. BTW, have you tried -mfpmath=sse
      (for IA32, of course) ?
      Makes _real_ difference.


      Tried it on two (FPU intensive) programs. On the first one, I got a ~5% performance gain and on the second one, I got NaN's so I'm not too impressed so far (that was gcc 3.1). I have however written some routines with SSE assembly and *that* provided a real gain (3x in the case I remember).

      AFAIK, -mfpmath=sse only makes use of the scalar fp instructions. Any idea when the vector ones will be supported? 3.2?

  9. Fortran is definitely still in use by MarvinMouse · · Score: 2

    I know of a lot of research and development facilities that still use fortran for mathematical modelling, and mathematical programming. Especially mathematical modelling of physical phenomena (ie. nuclear power plants, etc.)

    I didn't find it that hard of a language and I believe it would be worth learning for someone who needs to mathematics on a computer simply and easily without having all of the dongles and doo-dads. :-)

    --
    ~ kjrose
  10. Just link your FORTRAN libs by mocm · · Score: 2, Informative

    to your C code. You just have to know how FORTRAN arrays are held in memory and how long the FORTRAN types are. Then you need to know what standard FORTRAN libs you need to link, so that your numerical libs will work. I did that for lots of my numerical work and it worked fine. You have to test it of course and it takes a while to work out the kinks.

    --
    ***Quis custodiet ipsos custodes***
  11. What else do you want? by khendron · · Score: 2

    What are these modern language features you are looking for?

    FORTRAN is almost perfect for what it is used for: massive number crunching. Very little bells and whistles, which allows the programmer to concentrate on the numerics of the problem at hand and not the picky little programming details.

    --
    Life is like a web application. Sometime you need cookies just to get by.
    1. Re:What else do you want? by SIGFPE · · Score: 3, Insightful
      What features? How about things to make number crunching easier.

      In C++ I can extend the existing functions (such as sin(), exp(), operator+()) to support infinitesimals as well as ordinary floats or doubles. Using that I can automatically differentiate functions written in C++ making it trivial to code things like 2nd order optimisation routines. Try the same in FORTRAN. The nearest thing I can find anyone doing is using preprocessors that differentiate your source code line by line. (1) it's hideous and (2) well it's hardly still FORTRAN if you have to preprocess your code.

      Using C++ it becomes trivial to write code to compute second derivatives in applications where the textbooks say things like "traditionally we make do with first order approximations because evaluation of second order computations are complex to implement". Of course they're hard to evaluate if your ideas of how to program come from the 1960s.

      --
      -- SIGFPE
  12. I used F77 for a while by IPFreely · · Score: 4, Insightful
    ... 20 years ago, (ye gads). It is OK, but not anything special. About the only special feature it has is the builtin COMPLEX type. Beyond that, you're in just another procedural language, and an old one at that.

    The problems you described in C/C++ are probably mostly inherant to C. C is not type strict, so it lets you shoot yourself in the foot (or head) a lot.

    What it sounds like you want is a strongly typed and type safe language. That would catch most of your problems, assuming your're just writing algorithms and not trying to interface to strange API or hardware.

    PASCAL/MODULA-2/-3, or ADA can probably do what you want, and have GCC frontends available. These languages usually have runtime checks for safety, but after debugging, you can usually optomize them out for a production release.

    So over all, go compiled, go type safe, go modern/OO if you can.

    --
    There is nothing so silly as other peoples traditions, and nothing so sacred as our own.
    1. Re:I used F77 for a while by geekoid · · Score: 2

      OO != speed. NUmber crunching must have speed. a 10% degradation in speed add many hours to some fortran calculations.

      --
      The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
    2. Re:I used F77 for a while by IPFreely · · Score: 2
      Very true. True OO can add run time type checking overhead that you don't really want.

      ADA95 has some structures that support most of the type of capabilities that you want in OO, without actually having an OO environment. It is not OO in the same way smalltalk or Java or others are. But it is compiled and can be optimized well enough to match many F77 compilers.
      Of cource, true final speed depends a lot on the specific compiler. GCC has both F77 and ADA and they use the same backend. The end reuslt is probably similar speed for similar code. YMMV with other compilers of either.

      My reference to OO was really more in the idea that you should not limit your language to old constructs such as fortran when modern OO like constructs are available at similar speeds.

      --
      There is nothing so silly as other peoples traditions, and nothing so sacred as our own.
    3. Re:I used F77 for a while by dvdeug · · Score: 2

      ADA95 has some structures that support most of the type of capabilities that you want in OO, without actually having an OO environment. It is not OO in the same way smalltalk or Java or others are.

      Ada95 is not OO in the same way that smalltalk and Java are, but it is OO in the same way that C++. It supports inheritance and dynamic dispatch, the two key elements of OO IIRC. (Ada95 is the first internationally standardized OO language, actually.)

    4. Re:I used F77 for a while by norwoodites · · Score: 2

      C now has a built-in type for complex, look at the ISO C99 standard.
      Also it is Ada not ADA, it is a name of a person and it is now comes with gcc's source, to compile it you need an older version of it. Also gcc comes with a Java compiler which can compile to native code and get rid of some of the runtime checks.

    5. Re:I used F77 for a while by Mt._Honkey · · Score: 2
      the only special feature it has is the builtin COMPLEX type
      Hmmm.. that's odd. I'm sitting in front of a FORTRAN IV manual that lists COMPLEX as a type. Maybe it is a propriatary thing.
      --

      Don't Bogart the fish sticks
    6. Re:I used F77 for a while by rnd() · · Score: 2

      I think (CA)ML would also be a good answer to this question. It's a functional language, can be as strongly typed as you want it to be, and ends up being nearly as fast as C.

      --

      Amazing magic tricks

    7. Re:I used F77 for a while by mangu · · Score: 2
      a 10% degradation in speed add many hours to some fortran calculations


      If your program takes many hours to run, you should consider redoing the inner loop in assembly. Use a profiler to find where most of the CPU time is being used and optimize that. I have found that, by proper use of the "asm" construct most C compilers have, one can have the best of both worlds: quick as in assembly, and easy as in C. Compared to that, the only advantage Fortran has is that it's well known by many old-timers who are not computing experts, but need to use computers for number-crunching.

      My answer to the guy who posted the story is, don't bother with learning Fortran, unless your teacher insists you should use it.

    8. Re:I used F77 for a while by plaa · · Score: 2
      ... 20 years ago, (ye gads). It is OK, but not anything special. About the only special feature it has is the builtin COMPLEX type. Beyond that, you're in just another procedural language, and an old one at that.

      C now has a built-in complex data type. For example:
      #include <stdio.h>
      #include <complex.h>

      int main(void) {
      _Complex float f;

      f=-4;
      printf("N=%f%+fi\n",creal(f),cimag(f));
      f=csqrt(f);
      printf("N=%f%+fi\n",creal(f),cimag(f));
      return 0;
      }
      However, I'm not sure how widely these C99 extensions are supported on some other compilers.
      --

      I doubt, therefore I may be.
    9. Re: I used F77 for a while by Black+Parrot · · Score: 2


      > OO != speed. NUmber crunching must have speed. a 10% degradation in speed add many hours to some fortran calculations.

      True, but with modern CPU speeds the bottleneck for the vast majority of applications is the development and maintenance time. If you're doing supercomputer applications where you need the result in 10 days instead of 9 and you can't run out and buy a supercomputer, then sure, do whatever it takes to get that 10% improvement.

      But don't let speed be the deciding issue in the general case. It's just one of several factors that need to be weighted for a trade-off.

      --
      Sheesh, evil *and* a jerk. -- Jade
    10. Re:I used F77 for a while by Tony-A · · Score: 2

      IIRC, FORTRAN II had COMPLEX as a native type. Probably goes back to the original Formula Translator.
      Variables I through N defaulted to INTEGER.
      Other variables defaulted to REAL.
      DOUBLE PRECISION and COMPLEX had to be specified explicitly.
      Some kind of hack for Holerith strings.
      Outside of Holerith strings, spacing strictly for the benefit of human readers, although I think some compilers didn't like END stretched across continuation cards.

      If you have lots of formulas and very little logic, FORTRAN is probably the optimal language.

  13. Re:Try Common Lisp by ultima · · Score: 3, Informative

    Common Lisp is a very high level language with a tremendous amount of expressiveness, and it is suited towards academia in that in general, functionality is not sacrificed for performance.

    Check out http://www.lisp.org, http://cmucl.cons.org/cmucl for a really good implementation (and there are even Debian packages of it).

    CL is not known for its parallelization abilities, but if you need a language that lets you describe mathematics, CL is useful.

    Lisp is actually based around something called the Lambda Calculus, which is a way of expressing concepts by transforming data into other data using data which is expressed as a "function". Because of this, Lisp has a lot of abilities that other languages lack, such as extremely simple and powerful function composition, even at run-time. CL also has a massive core library with OO facilities, basic mathematic primitives, good FFT suppot in most implementations, windowing system support, and good commercial vendors like Franz. Check it out; it's almost as old as Fortran, but has evolved in a much more elegant manner.

  14. On languages and Fortran. by McDoobie · · Score: 5, Informative

    Different languages have different strengths and weaknesses. I use Fortran, C, Ada95, and Ocaml interchangeably for different tasks. Often times linking the object files into a single executable.
    Fortran, designed for mathematics and engineering, obviously excels at that job. You might want to consider writing the "intensive" parts of your application in Fortran and then linking it with modules written in another language such as C or Ada.
    I've found that C is perfect for handling the I/O routines for such apps, but my Ada libs are ideal for doing memory managment and when the code outgrows the practical limitations imposed by Fortran.(Note: Interfaces.C and Interfaces.Fortran).
    Likewise Ocaml tends to fit around anything with a minimum of hassle.
    Of course, this is just a subjective evaluation derived from my own experiences. However I would encourage you to experiment to find the combination that works best for you. As we all should know "Theres more than one way to do it."

    I'm sorry if this post seems somewhat vague, but it would be rather hypocritical of me to outright prescribe a certain language or tool when I personally have a tendency to float around and use whatever tool is most convenient.

    NiCad

    1. Re:On languages and Fortran. by gilroy · · Score: 2
      Blockquoth the poster:
      I use Fortran, C, Ada95, and Ocaml interchangeably for different tasks.
      If you use them for different. distinct tasks, as this and the rest of your comment implies, then you are clearly not using them interchangably. That would mean you don't think that the languages have different strengths and weaknesses.

      Sorry, it's the middle of summer and I haven't had any student papers to fill my vocab-nazi quota. :)

  15. Use Maple by swagr · · Score: 2

    It will export your script as C.

    --

    -... --- .-. . -.. ..--..
    1. Re:Use Maple by swagr · · Score: 2

      It will export your script as C. ...and Java and Fortran.

      From the websites www.maplesoft.com and www.mapleapps.com:

      The new CodeGeneration package provides routines to translate "numeric" Maple procedures and code, such as expressions, lists, arrays, rtables, and lists of equations, to Java code. This new package also contains improved versions of codegen[C] and codegen[fortran]. You now have several options to choose from when translating Maple code to Java, C or Fortran code that provide greater control over how analysis and translation of types are performed. Maple 8 has extended the external linking capability with the ability to link to static Java methods.

      --

      -... --- .-. . -.. ..--..
    2. Re:Use Maple by fireboy1919 · · Score: 2

      Of course, you can do this with the much more powerful matlab...for which you can also buy the maple symbolic evaluation engine, I might add.

      Plus you can do things OTHER than math with it.

      --
      Mod me down and I will become more powerful than you can possibly imagine!
    3. Re:Use Maple by swagr · · Score: 2

      the much more powerful matlab ...
      after you add the Maple symbolic evaluation engine. Without it they're powerful in different ways.

      things OTHER than math
      I can do things other than math with a rubber hose. ;)

      --

      -... --- .-. . -.. ..--..
  16. This is a really ignorant/uninformed question. by Wakko+Warner · · Score: 3, Insightful

    Fortran is used HEAVILY in very specialized industries -- almost any mechanical design or scientific modelling program has some Fortran code in it.

    What do you want to do with it? Model fluid dynamics? Do structural or materials analysis? (Such software already exists.) Or do you simply want to find a better way to encode your DivX files?

    It appears to me as though you are trying to select the proper tool for driving nails into wood, while looking in the screwdriver section of the hardware store. If you need to ask why you should learn Fortran, you probably shouldn't learn it.

    - A.P.

    --
    "Remember when the U.S. had a drug problem, and then we declared a War On Drugs, and now you can't buy drugs anymore?"
  17. Re:Try Common Lisp by bowronch · · Score: 2, Insightful

    I'm a big fan of Lisp... The ability to declare as much or as little as you want about your data types is very nice... And it has the greatest macros of any language I've ever used... Once you get used to the Lisp macro functionality, you will cry when the most you can do is a #define in C...

    When programming in Fortran or C its important to remember Greenspun's Tenth Rule of Programming: "Any sufficient complicated C or Fortran program contains an ad-hoc, informally specified, bug-ridden, slow implementation of half of Common Lisp"

    --
    My Stuff: pspChess and foobar2000 plugins
  18. Re:Welcome to Legacy Land by unicron · · Score: 2

    Because you haven't experienced danger until your run 100+ user production databases on legacy hardware. Suppose I'll go make it safe for another day:

    TAPE OPER RES MKC500
    INIT MKC500 TAP007
    TAPE OPER AVAIL MKC500

    *sob*....

    --
    Finally, math books without any of that base 6 crap in them.
  19. Re:Right Tool for the Job by anonymous_wombat · · Score: 2, Insightful

    You can use CORBA, or XML to communicate between your Fortran application, and any other code that you may write. That way, you can get the best of both worlds. I wouldn't give up so fast on C++/Java though. Investigate those languages more thoroughly before you decide to code in Fortran.

  20. why not C? by 4im · · Score: 2

    A friend of mine is very much into computer simulations of physics and chemistry - he writes his own code in c / c++, and so manages to do on a (heavily optimized) Linux PC what his colleagues using FORTRAN still need Crays to run. All the difference is that he can use custom datastructures that FORTRAN (and the existing libraries) does not offer him.

  21. Matlab and Octave by Vireo · · Score: 2

    If you need to do numerical linear algebra (vectors and matrix), nothing beats Matlab. But as you said, Matlab costs a bunch of money. Maybe you'd be interested in Octave, an open-source, Matlab-like and mostly Matlab-compatible scripting language / interpreter.

    1. Re:Matlab and Octave by Nyh · · Score: 2, Informative

      I agree. Especially for research Matlab is a very powerful tool (in particular with the special purpose toolboxes, Simulink is great!). You will have to think in matrix and vetors to get the speed. I am regularly called by colleagues to fix speed problems with Mathlab applications. Usually it is a for loop that could be vectorised (mostly by the use of boolean array's).

      Why is Matlab so fast? Well, it's nothing more as an easy frontend for the Fortran libraries. That's where the speed is: FORTRAN.

      Cu, Hans

  22. Physics and other legacy code by Soong · · Score: 2

    My dad is a computational physicist. He works with some codes that are k*100,000 lines of FORTRAN. Mostly f77 too.

    Once upon a time, Cray had a really good automatically vectorizing compiler for FORTRAN and a mediocre C compiler. The Killer App stuck.

    The word on the street (from my dad) is that new physics codes are being written in C/C++. So, maybe in 20 years most of the old FORTRAN will be replaced.

    I've tried to get my dad to learn more C/C++, but he plans to retire before that's necessary.

    --
    Start Running Better Polls
  23. Don't use Fortran 90. by Tim · · Score: 5, Informative
    Don't use Fortran 90. It's as messy a language as C++, with the significant disadvantage that it has a much smaller user base.

    Honestly, your objection to C++ is unclear to me...you say you spend more time fixing bugs than approaching the task at hand? Is this because you don't know the language that well? Perhaps because you're not taking advantage of the many excellent libraries available to you? Keep in mind that C++ library design requires a great deal of skill, but using a well-designed library is actually easier than coding in other languages.

    C++ is my own personal choice for anything by the most demanding of high-performance computing applications. Is there an overhead to the language? Debatably, yes. Does it matter, in 99.9% of applications? No. And with only a little bit of forethought, even the "inherent" performance hits can be avoided in the places where it matters. It's just that you have to rely on a profiler to tell you where those places are...

    There is a significant community of researchers and developers working on scientific and high-performance computing in C++. Check out some of these:

    • POOMA - a high-performance mathematics C++ framework
    • Blitz++ - a C++ mathematics library which uses template metaprogramming to achieve FORTRAN-caliber performance.
    • MTL - another example of template metaprogramming.
    • oonumerics.org - a good site for information on high-performance object-oriented code.


    These are just a few good starting points. Do a google search for 'high performance c++' to find many more. Just, please, for the love of Deity, don't code in FORTRAN. ick....

    --
    Let's try not to let fact interfere with our speculation here, OK?
    1. Re:Don't use Fortran 90. by slickwillie · · Score: 2

      Real C programmers who want to use FORTRAN use RATFOR (RATional FORTRAN).

    2. Re:Don't use Fortran 90. by PineGreen · · Score: 2
      Don't use Fortran 90. It's as messy a language as C++, with the significant disadvantage that it has a much smaller user base.

      Not only this, it has two more disadvantages:
      a) The compilers are unbeliveably crash and bad. And I've tried both Sun and SGI f95 compilers... Sucessfully segfaulted them both within a few days of using them... Funnily enough NAG f95 compiler for linux seems to be quite stable.
      b) No GNU f90/f95 compiler. They are making it, but it is not there, yet, and it won't be for a good few years
      c) Surprisingly hard to interoperate with f77 or C, becaused modules get funnly pre/suffixes all over the place...

      I used to hate fortran, but once you get used to type twice the amount of code you need it's actually quite usefull... It's internal rules allows it to paralelise much better. It has well tested implementations of linear algebra (matrices and crap). Two biggest drawbacks are: a) lack of dynamic memory allocation --- plain shit, nothing you can do about, b) everything is passed by reference - no recursion whatsoever, c) shit i/o handling...

    3. Re:Don't use Fortran 90. by FullyIonized · · Score: 4, Informative
      I can't believe the amount of crap being posted here, and this is fairly typical.

      a) lack of dynamic memory allocation --- plain shit, nothing you can do about
      You obviously don't know a thing about f90. Dynamic memory allocation is the first thing everyone converting an f77 code uses. Yes f77 is dated. Go pick up the f90 book by Cooper-Redwine and read the first chapter. Really, f90 is fairly clean.

      b) everything is passed by reference - no recursion whatsoever
      Inconvenient, but it makes for much easier optimization. For recursion, there are tricks in f90 now that allow you to overcome most of the obstacles.

      The compilers are unbeliveably crash and bad. And I've tried both Sun and SGI f95 compilers... Sucessfully segfaulted them both within a few days of using them... Funnily enough NAG f95 compiler for linux seems to be quite stable.
      I agree that Sun's f90 compilers are crap (although there f77 compilers are excellent), but SGI's is quite good. I use every advanced feature of F90 possible (derived types, pointers, allocatable arrays, operator overloading, etc.), and SGI's works quite well.

      c) Surprisingly hard to interoperate with f77 or C, becaused modules get funnly pre/suffixes all over the place...
      I've never had problems with f77 but I agree with about C. A bigger problem with f90 is that the array structure is compiler dependent. This was done to allow the compiler writers more flexibility in optimizing their code, especially for parallelization issues, but given the way high performance computing is moving (in the U.S. anyway), it is a pain.

      If you want to use f90 on Linux, I highly recommend the Lahey-Fujitsu compiler. This produces nice fast code with good error checking. They seem to focus more on Windows than Linux which I dislike, but it is still a solid product.
      Also quite good is Portrand Group

      Here is some recommended links from them that all of the "Fortran sucks" crowd should read: prentice

      In the U.S., the HPC community is clearly moving towards using C/C++ especially for the libraries (such as POOMA, Blitz,... that the parent poster mentioned). I've seen codes that have been POOMAized and they've run much slower than the original f90 versions. The POOMA guys talk about the fact that they will get their libraries further optimized, but it still remains to be seen. I saw a talk by the BLITZ people on how they are TRYING to get C++ as fast as C, which makes me think they should just use f90. My big complaint with these library writers is that they typically work with relatively simple problems -e.g., Poisson's equation- and then think that it will work for everything. I have yet to see a fluid code that uses these libraries and really fly.

      As scientific problems become harder, the associated numerical algorithms become harder, and the codes more sophisticated and flexible. So agree that f77 is inadequate for any modern, real code, but that is hardly news. While the U.S. HPC community seems to be focussing on trying to get C/C++ up to snuff, it seems that Europe and Japan are pushing f90 or high performance fortran. I personally think we (the U.S.) are heading down the wrong path.

      The basic reason why I use F90 is:
      I'm a physicist, not a computer scientist. Yes, I agree that you can have fast code with C, but it is much harder.

      --
      Sigs are bad for you.
    4. Re:Don't use Fortran 90. by mangu · · Score: 2
      Inconvenient, but it makes for much easier optimization


      The point is, exactly *how* much easier? Assume that F90 will get you code that's X% faster than the one you get with C++. How long will it take for CPUs to get X% faster?


      I programmed in Fortran from 1975 until 1985, but, after I learned C in 1985, I never did any new development in Fortran. I still use Lapack, called from C/C++ programs, but I have completely forgotten those FORMAT statements, thank Thor. The time I don't waste truing to do I/O in Fortran more than compensates whatever gain I'm missing in optimization, even considering that most of my programming involves heavy number crunching.

    5. Re:Don't use Fortran 90. by auntfloyd · · Score: 2

      Some posts further down recommend interpreted languages like Python and LISP (jeez!) for such applications. They must be joking.

      Lisp is not an "interpreted language" (if there even is such a thing as a *language* which needs to be interpreted). In fact, most open-source Lisp systems, as well as all commerical Lisps are compiled into native code.

      I find it hard to believe that many people seem to think that after 40+ years of existence, Lisp is still interpreted, as if Lisp users, developers, and researchers were incapable of doing any better.

  24. I still shudder... by Subcarrier · · Score: 4, Funny

    FORTRAN has the same kind of cherubic appeal as a very very large hirsute man wearing a tutu.

    You can leave FORTRAN behind, but you can never forget it. Sometimes, I wake up at night, thinking about it -- wishing I didn't.

    --
    "I have opinions of my own, strong opinions, but I don't always agree with them." -- George H. W. Bush
    1. Re:I still shudder... by EnVisiCrypt · · Score: 2

      yes, and parsing through node trees in XML will *really* help the speed aspect of Fortran. Yep.

      Don't even get me start on CORBA...

      --


      *everything* is Orwellian to cats.
  25. I'm glad I'm not the only one..... by friedmud · · Score: 2

    I'm doing some consulting this summer for a company in my home town, and they have a VERY odd fortran implementation.

    It grew out of an old fortran (formatted type - probably f60 or so) program that was written by some guys in germany for calculating the size and price of heat exchangers. This company I work for has since decided it needed to have a web front end for this program and had a couple of engineers (this is the first problem - NEVER have plain vanilla engineers write code!) come up with a 'solution'.

    What they have now is a mess of ASP pages using VB dll's to call a Fortran 60/77/90 and C++ conglomerate program that ultimately writes ASP (yes! directly out of the fortran). All of this interfaces with multiple databases stored on both an AS400 and a Dell/Windows machine.

    IT IS A HUGE FREAKING MESS!! I was brought in to clean it up - and redo all the pricing. I have done what I can - but short of a total rewrite it is not going to get much better.

    Fortran needs to die a horrible death. It is soooooooooo ugly to look at and decipher (all of this code didn't even have branching statements in it - it just had a TON of GOTO's !!!).

    Just thought I would share my experience......

    Derek

    1. Re:I'm glad I'm not the only one..... by geekoid · · Score: 2

      Nope, fortran is much better then c/c++ for what it does.

      don't blame FORTRAN for the crappy way the "engineers" crated a web front end.

      I saved a company over a million dollars by creating a middle tier for a 3270 systems. It took me a week and 6 perl scripts.
      getting legacy stuff to the web isn't nearly as hard as peple think. Mostly, its done by "webmsaters" who took a course in cold fusion and think they understand programing, and have the gall to call themselfs 'engineers'. That is why people think its expensive and hard to do.

      this is why contractors should be paid 1/2 of there fee and not get the other 1/2 until the program is done and working reasonably well.

      --
      The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  26. Fortran optimizes well because... by coult · · Score: 5, Insightful

    ...of the simple loop structures. In C, you can have a for( ; ; ) statement that does basically all sorts of weird crap in here ( ; ; ), and you can also do things like pointer aliasing (impossible in Fortran since there are no pointers at all).

    Fortran loops, on the other hand, are very very simple - all you can do is increment the loop variable, and repeat. That allows for very heavy loop optimization by the compiler - comparable to what the best assembly programmers might be able to do. Furthermore, a Fortran compiler can more easily generate optimized loop code using vector instruction sets like Altivec or SSE2, whereas C compilers have a much harder time (again, because of the wide variety of loop structures possible in C, and things like pointer aliasing, etc.)

    --

    All is Number -Pythagoras.

    1. Re:Fortran optimizes well because... by Milalwi · · Score: 2

      impossible in Fortran since there are no pointers at all
      Wow, we'd better stop using them in our F90 code, eh?

      One of the biggest problems Fortran has is a PR one. Everyone "knows" things like "Fortran has no pointers". A simple example from the Compaq Visual Fortran help:


      INTEGER, POINTER :: P, N
      INTEGER, TARGET :: M
      INTEGER S
      M = 14
      N => M ! N is associated with M
      P => N ! P is associated with M through N
      S = P + 5

      The value assigned to S is 19 (14 + 5).

      Milalwi
  27. High Performance Fortran by QuantumFTL · · Score: 5, Informative

    It's obvious that the story's poster didn't really look into FORTRAN much past the aging F77.

    I currently use F77 to do research in magneto-hydrodynamics simulations of neutron stars on Cornell's Velocity Cluster (which has been featured on slashdot before). Fortran, due to its lack of things like pointers, etc, is rediculously efficient, and almost completely cross platform (because surprise surprise- it's very difficult to attempt to do anything remotely platform specific). The language is much simpler than something like C with pointers, etc, that must be messed with. Sure it's ugly as hell, but once again the newer versions of Fortran take care of most of these issues.

    I would suggest that anyone interested in high performance computing should check out High Performance Fortran. It's a set of extensions to the F90 language to allow the seemless integration of large-scale parallelization in your code. It also has several other performance advancements.

    I highly disagree with the poster of the story, Fortran 90 is much more modern than F77, including things like objects, safe pointers, better recursion, better array sharing, generic routines (a type of function overloading). The language syntax is also much more lenient than F77 (which was designed to work with punchcards). It also has some really great array operations (things like slices, etc) that are rediculously fast. While I absolutely hate F77, if I was going to write a computationally intensive simulation, I'd probably do so in F90 or HPF.

    A lot of people still use Fortran, especially computational physicists and meteorologists... Many of these people don't have time to learn new programming languages, and Fortran works very well for what they need, better in most situations than almost any other language. It's something to consider.

    Cheers
    Justin

    1. Re:High Performance Fortran by reverse+flow+reactor · · Score: 2
      We still use a lot of Fortran(90) for our computational work. We do a lot of chemical reaction engineering simulations - fluid dynamics, chemical kinetics, heat transfer, reactor design and transient behaviour. When a simulation runs on the order of 100 hours, you want and NEED everything to be optimized. Fortran runs much faster than C++ for our simulations.

      Argueably, Fortran has a terrible user interface. Granted - it is designed to solve math problems, not make a pretty interface. Some people in our research group have developed JAVA interfaces for their code, but the differential equations are stilled solved in Fortran.

      Each language has its strengths and weaknesses. Use C++ or Java for your GUI applications, and use Fortran for solving lots and lots of differential equations.

      --

      The significant problems we face cannot be solved by the same level of thinking that created them. -Einstein

  28. FORTRAN is the common denominator. by james_sorenson · · Score: 2, Informative

    I work as a controls engineer at the NASA Ames Research Center. Most of the nonlinear aircraft simulations are still written in FORTRAN. FORTRAN provides very robust mathematical libraries while making it very easy to parse text files. In other words, FORTRAN is ver good at taking a text document of flight data, and crunching it into a useful simulation. The main thing is that so many compilers and languages talk to FORTRAN. I do a lot of work in Matlab and C, and both can link to my FORTRAN code. I can pull up an old simulator from the early 90s, slap on an s-function or C-wrapper, and use the code in my new code. Of course, the question is: is new FORTRAN code being generated for reasons OTHER than to be compatible with the old code, or because it is the only language the crusty engineer knows? Well, it's a toss-up. Matlab seems to be making a lot of headway, especially since it's code is very C-like and can link to old code. But, the gnu g77 compiler means I can distribute my FORTRAN work to anybody with a Unix box. Not everyone has put out the cash for Matlab. My recommendation is to learn enough FORTRAN to understand the math and logic loop functions. This will be enough to be able to read old code, and to be able to write math subroutines to be linked to more modern code. I still have to write in FORTRAN, but it's uncommon that I ever write a stand-alone FORTRAN program with an interface or anything. It is mostly text-file and math subroutines for Matlab or C.

  29. Tools by Wrexen · · Score: 2

    Can it really be true that the best tool we have for heavy duty computing is a 25 year old language

    Can it really be true that the best tool we have for driving nails is a 3000 year old piece of wood with metal on the end?

    1. Re:Tools by Mad+Marlin · · Score: 2

      Actually, I rather like nail guns myself, they are much faster than a hammer, and you don't end up hitting your thumb.

    2. Re:Tools by belroth · · Score: 2
      On the other hand you can't nail your foot to the floor quite so easily with a hammer... :-)

      Of course I'm trying to tie this analogy to having to use VB at work.

      --
      I hereby inform you that I have NOT been required to provide any decryption keys.
    3. Re:Tools by scrytch · · Score: 2

      > Can it really be true that the best tool we have for driving nails is a 3000 year old piece of wood with metal on the end?

      Or nail guns, as one poster put it. I might note the tremendous variety of nails, not to mention screws, and all the ways to drive them. For the truly heavy duty, we have welding and rivets. Then for the lighter duties, we have glue, velcro, and that tacky blue stuff. Not to mention all the neat movable fasteners out there, there's engineering companies that do nothing but come up with new ones. Draw your own parallels.

      'course, when all you have is a hammer...

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
  30. About to teach a numerical class... by jvmatthe · · Score: 5, Interesting
    I'm teaching "scientific computing" for the second time at my university this fall and we're going to be using FORTRAN with some C (and C++ if that's your cup of tea). The department here is somewhat slanted towards FORTRAN and C instead of scripted environments and there is some outright dislike of Matlab. In this sense, FORTRAN was worth knowing around here and I had to brush up on my skills, since I'd not touched it since spring of 1992.

    The course mainly focusses on solving machine numbers, solving linear systems (direct and iterative methods), solving non-linear systems (mostly Newton-type methods), and solving eigenvalue/vector problems. The codes that students wrote last year started from scratch with early assignments. Then, I allowed them to incorporate Basic Linear Algebra Subprograms (BLAS) into their codes. Then they were allowed to use LAPACK for the rest of the semester. They were free to use the C interface, but most chose to use the FORTRAN examples, probably because of the skeleton code that I provided.

    Given the tremendous amount of code that is already out there, I agree that knowing FORTRAN is an asset. And since it's not hard to learn, why the heck not, right?

    On a side note, they had to use Makefiles, LaTeX their assignments, and send everything to me electronically in a gzipped tarball. They got quite a workout in console tools. For reference, I had some that were quite familiar with the system and some that had had BASIC at some level and that's it. Lots of help was needed as the semester reached the final weeks.

    Matlab was used for visualization and graph creation, but I am considering using GNUPlot this year, if it is up to the task. (I think it probably is.) I may also encourage the use of Octave, where possible.

    For reference, the class website (which will soon be updated for the new semester) is here: Math 224.

    1. Re:About to teach a numerical class... by joib · · Score: 2

      I'll second that. Although R is primarily for statistics (which is not my cup of tea), I use it for plotting because the plotting stuff in R blows gnuplot (and hence octave) out of the water, IMHO. Another useful free plotting tool that is widely used is grace, it has a nice GUI if you happen to like such things.

  31. Well, it's not a nice language, but... by teamonkey · · Score: 2, Interesting
    As many people have pointed out here - it can shift a serious number of uh, numbers.

    The language feels as though it's designed by a committee and has features tacked on left, right and centre. IO sucks arse, so don't expect to write a wonderful user interface for it (but you could always do a wrapper in another language, I suppose).

    I use F90 at uni, and although it's a bit of a messy language it does what it's good at: spewing out tables of numbers. It is expensive for a single licence, however. I wouldn't bother with it if I didn't have access to the university number crunchers.

  32. Err, big deal by Matthew+Weigel · · Score: 3, Interesting

    All we have is this "25 year old" language for numeric tasks, and another language that's about as old for system programming. It's called C.

    --
    --Matthew
  33. Ratfor at least makes it look better by Mr+Slushy · · Score: 2, Informative

    Fortran is truly ugly, if you need to write fortran, at least do it an ratfor (Rational Fortran) described by Kernigan and Plauger in Structured Programming.

    Ratfor adds "normal" structured programming constructs to fortran to make it readable by somebody less than 40 years old.

    You write code that looks like:
    for(i=1;i=100;i=i+1) {
    fortran code here
    }

    Ratfor generates:
    23002 if(.not.(i.le.100))goto 23004
    fortran code here
    goto 23002
    23004 continue

    I dont know about Linux, but ratfor is included in the FreeBSD ports.

    --

    S.E.S.S.D.E.N.E.E.NW from west end of hall of mists

  34. Languages have very long lives by Ars-Fartsica · · Score: 2
    C will be around for at least another fifty years in some form. Java will be around at least another twenty years.

    With enough production code, you can essentially push a language's lifespan out to infinity.

  35. Try SciPy by drklahn77 · · Score: 3, Interesting

    SciPy is an open source python application that sits on top of quite a few C and Fortran libraries. It is specifically targetted at the scientific computing community, and its performance is quite good, even though it's still a very young product. It supports massively parallel computation, has a number of nice plotting and graphing features, and is completely cross platform. It also includes weave, which allows you to produce native C code from python.

    Best of all, it's python, which means the learning curve isn't as punishing as C++, for instance.

    The website for SciPy is:

    http://www.scipy.org/

  36. Re:Fortran vs. C/C++ by binaryDigit · · Score: 2

    Learning a new language isn't going to help you avoid debugging

    Right but his point was that with C/C++ he spends a lot of time dealing with programming issues unrelated to solving his problem. This is a common occurance in C/C++. In C the most obvious example that is near and dear to everyones heart is string handling. It's easy to introduce many bugs into an app that does even simple string manipulation. Vs say a language like VB, where the string handling is fairly straight forward, so you can spend your time dealing with many of the other shortcomings of the language, oops, I meant to say solving your problem.

    If the man wants to do math and not have to worry about memory mangement and pointer arithmitic, then moving to a language like Fortran is not necessarily a bad way to go. He shouldn't get caught up in the age (after all, C aint no spring chicken either). If it's still around and being used, then it probably does the job well (don't know a lick of Fortran so I can't say personally).

  37. The right tool... by sjames · · Score: 2

    FORTRAN is still a useful language for engineering and scientific computing for several reasons.

    A very good one is that FORTRAN isolates the platform much better than C does. a real is a real is a real. At most, it's a matter of finding the appropriate compiler option.

    A great many people in the field know FORTRAN.

    Lack of issues such as pointer aliasing, etc, make automatic optomization and to an extent parallelization go much better in FORTRAN.

    C's history is one of letting the programmer optomize the code, FORTRAN has a stronger history of considering that the compiler's job (good for numerical programming).

    There's a lot of good, well used and tested code out there for FORTRAN.

    If your interests lie programming for scientific or engineering, especially HPC, FORTRAN is still a must.

  38. The right tool for the job. by astroboy · · Score: 4, Insightful
    FORTRAN is an extremely simple language; because of this, optimizers can go nuts, writing extremely tight code. If you're trying to do lots of intense number crunching, and performance is an issue, it really is the right way to go. FORTRAN 90 has some support for modular programming and gets rid of a lot of silly syntactic things which have been mentioned elsewhere (6-char variablenames, strict line formatting, etc.). That's why even Freshmeat has 29 FORTRAN-related projects.

    Having said that, when you're writing a large piece of code, much of the code probably isn't number crunching; its schlepping data back and forth between solvers, doing I/O, etc. For that, FORTRAN is fairly limited; so you use other languages.

    You use the right tool for the part of the code you're writing. We are working on a large simulation code; our numerical solvers are all in FORTRAN, and we have no intention of chaning that; however, we use other things (C, Python) for higher-level tasks. And this is how it should be. People who argue about `Language X rocks!' or `Language Y sucks!' Just Dont Get It. All the languages still in use are still in use for a reason -- they have certain things they're good at. And so you pick the right tool for the job.

  39. F**k is a swear word even in Fortran by 4dGirl · · Score: 2, Funny

    Back when I used to work in a University Maths department we used Fortran almost exclusively. Because its quicker and easier to code up most math problems in Fortran rather than C and because of the extensive numerical libraries available. The compiler we used would tell you off if you used swear words for your variable names. So of course our favourite game was looking for expletives that the compiler didn't know about. Some of them got pretty inventive!!

    --
    No sigs please, I'm British!!
  40. Perl is a good option for this sort of thing by ajs · · Score: 2

    Perl has some handy features in this respect. It's a nice high-level language in its own right, and the Perl Data Language module (PDL) provides access to some very nice numerical and binary data libraries including some that are written in FORTRAN.

    I know Perl seems too high level at first, but give PDL a try. It's well worth the investment of time to get to know it.

    1. Re:Perl is a good option for this sort of thing by ajs · · Score: 2

      Clearly, you've never used PDL. Go try it out, and then we can talk.

  41. the truth hurts by MORTAR_COMBAT! · · Score: 2

    spent 5 years of my life learning software patterns, algorithm analysis, multithreading, etc, etc.

    what do i get to do? technical document reviews. unit test code for ancient C programs.

    it gets better.

    batch scripts. shell scripts. adding layers of kludge to older layers of kludge.

    but at least they pay me the same as if i were doing all the exciting tech i wanted to do. but there's only so much you can take of shell and batch scripting before you go completely insane, and open a new /. account with all caps, based on some computer game...

    --
    MORTAR COMBAT!
  42. Say what you will about old languages... by frank_adrian314159 · · Score: 3, Interesting
    ... but they knew what they were about. COBOL was about records and batch processing, Fortran and APL were about arrays and procedural programming, SNOBOL was for strings, and Lisp was about LISt Processing. These languages, although having expanded their paradigms, are still the best ones for doing those types of tasks. They (Lisp and COBOL, in particular) have seamlessly integrated more paradigms and are fully usable.

    Also, despite what you say, well formatted Fortran code is no more ugly than most other code (and a hell of a lot nicer looking than your average Perl code :-().

    I don't know why people believe that newer languages are automatically better. At the end of the day, you got storage, you got ops screwing around with the storage, and you got a mess of control flow holding the guts together. Just because I'm some hotshot wanting to get my name in the (geek-) papers with my shiny new syntax doesn't mean it's any different. And it certainly doesn't mean it's any better.

    So go ahead and learn Fortran. Learn about the joys of representing linked lists as a set of next indices into an array. Learn about dimension statements and equivalence blocks. Learn how to squeeze down your numeric processing into the nub of a kernel of procedural truth. You'll end up being a better programmer.

    --
    That is all.
    1. Re:Say what you will about old languages... by dvdeug · · Score: 2

      SNOBOL was for strings, and [...]. These languages, although having expanded their paradigms, are still the best ones for doing those types of tasks.

      Is SNOBOL still the best? Ralph Griswold (its creator) no longer thinks so; he created Icon (sort of an advanced SNOBOL with Pascal/C'ish syntax) as a replacement.

  43. Give Sisal a look... by jejones · · Score: 2

    Check out Sisal.

  44. Still in widespread use for MonteCarlo simulations by Imabug · · Score: 2

    FORTRAN is still very much in use by people I know that do lots of Monte Carlo simulations. Lots of people also write most of their code in C, but end up linking to FORTRAN libraries that contain routines that do the computations.

    EGS (Electron Gamma Shower) in particular uses it's own variant called MORTRAN, which gets interpreted and converted to FORTRAN code for execution. MORTRAN is basically a high level set of routines that encapsulates the routines that do all the work.

    --
    "For I am a Bear of Very Little Brain, and Long Words Bother Me"
  45. Just when you thought it was safe... by jalefkowit · · Score: 2

    Is FORTRAN still alive? Check this out and learn the meaning of Fear:

    (Yes, you read that right. FORTRAN.NET. Flee! The Seventh Seal has been opened!)

    1. Re:Just when you thought it was safe... by geekoid · · Score: 2

      "Flee! The Seventh Seal has been opened!) "
      exactly, where would one flee to?

      --
      The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  46. Forgive the old timer. by FreeLinux · · Score: 5, Insightful

    I see these annoying questions all the time. "Don't tell me that a 30 year old whatever is the best we have!" Alright, I won't tell you. But, I'll tell everyone else, Fortran is sometimes the best language for the job, even after 30 years. It is simple, fast as hell and very robust. What's wrong with that? Oh, you can't write a gui in it or you can't have derived object classes? Tough, that's not what it was designed for.

    Why is it that the age of a language or tool is associated with it being inferior? Do you feel that everything that was created prior to your birth is inadequate or inferior? It is in fact, very common for the earliest versions of many things to be far superior to newer ones. This is true, not just for for languages but also for many other things. Most often, the "improvements" and "advances" that are made cheapen, dilute, complicate and destabilize the original product. This is, at least partly to blame for the disposable society that we live in today. Better, or smaller faster cheaper, usually also means less reliable and durable.

    To answer your question, yes. Fortran is still a very viable language and is still, after 30+ years, the best language for heavy number crunching. If you need to create a gui and have derived oject classes as well, just link to the fortran libs. But, I'm sure that some snot nosed whippersnapper will suggest that Perl is the only solution. Puhleez!

    1. Re:Forgive the old timer. by Vortran · · Score: 2

      Actually, I think what was created BEFORE Fortran is superior. It's called machine language. That's right folks, straight binary. One bit at a time, baby! I remember programming a Dyna 8080A processor with a row of toggle switches.

      Seriously, though.. there is a philosophy that says anyone should be able to write programs and that there should be tools available for ordinary folks to create computer programs. The other philosophy is that "ordinary folks" have no business writing software and that if you can't hack it in assembler or C, you should get a real programmer to write the code.

      Which philosophy are you inclined toward?

      Quite frankly, I like C. I like it because:

      - People still learn it. Folks that have programmed for 20 years as well as the snot nosed whippersnappers know C. I don't hear people saying, "C is dead" like I do other languages (e.g. FoxPro, Progress, Fortran, Actor, COBOL, JCL, RPG, PASCAL, LOGO, Rexx, Ada, Lisp, SmallTalk)

      - It is typically compiled to native processor code instead of interpretted, and therefore typically faster.

      - I can usually find a free-as-in-beer compiler for whatever platform I need to write for

      - I don't need to deliver a pile of runtime code or expect the user to have the x.x.x.x build nnnn version of the libraries or VM to run my software. I simply deliver a machine native executable, and it runs. (Of course .Net and the M$ clr will see to it that I can no longer do this.)

      - C is C. C code that is 20 years old compiles and runs without modification.

      - Lastly and most importantly, with C I can do absolutely anything. There are no obstacles whatsoever. There is nothing "unsupported" in C. If I can think it, I can use C to implement it.

      Java is starting to look good, actually.. especially with the business world's love affair with everything Microsoft on the desktop and Microsoft doing everything in its power to make sure no one can write a program that runs in their OS without buying additional licenses.

      Bottom line: if you like Fortran use it for yourself, but don't expect to find a cadre of readily available people with the skills to maintain it. Fortran is wonderful for the original poster's use. The problem is when his little Fortran ditty becomes a mission critical application that has grown into a many-thousand-line monstrosity and he quits, retires, or dies.

      I know of a 66 yr old RPG programmer that is making 6 figures maintaining AS/400 code. Why? Because there aren't any snot nosed whippersnappers that want to learn it.

      Vortran out

      --
      Knowledge is like ignorance.. too much can be just as bad as not enough.
  47. Right Tool for the Job by 4of12 · · Score: 3, Interesting

    I've known FORTRAN since...well...for longer than many slashdot readers have been alive. Done big, numerically intensive projects in it for many years in the 1980s.

    I've also done C (1990s) and C++ (2000s).

    Ten years ago the criticism about speed was true - that compiled FORTRAN would beat C++ to pieces. Not anymore, unless you're committing newbie mistakes in C++.

    If I were you I'd make the best of all worlds. I'd use Python for upper level logic in a clean syntax, in a quick scripting environment.

    Then, if there's numerically intensive loops in the lower reaches of your code that get executed billions of times, go ahead and use FORTRAN. Especially when you're doing something like computing eigenvalues for specially shaped matrices, etc., where chances are someone has already written a FORTRAN subroutien to do it well.

    Finally, use something like SIP or SWIG to connect the upper level Python to the lower level FORTRAN. Look, too, at Numerical Python and SciPy for others that have been down this road.

    There's a lot to be gained from all those netlib routines that have withstood the test of time and been optimized to such an extent that even the FORTRAN programmers surrender, and drop down to call BLAS routines that are best written in assembler.

    Using FORTRAN for the whole project is asking for pain once you start looking at things like parsing character input, connecting to network, linking into system libraries written in C. Been there, done that, have the scars.

    --
    "Provided by the management for your protection."
  48. Fortran and Open Source for a big project by imr · · Score: 2

    Here you can find a project of the french compagny of electricity (state monopoly) that went open source for every one to use and contribute to.
    And it's not a dead project that they would kinda release, it's alive and already interresting a lot of less rich countries specialists.
    Some dig it.

  49. Fortran 90 by ErfC · · Score: 2
    I don't know much about optimization for various languages, but I can attest that Fortran 90 has everything you'd really need in a language. It's not object oriented, but I've never needed that. It does do structures nicely, and it has nice looping features (like the ability to name loops) that help things to be clear. And it's got functions and subroutines and modules and things. Of course it's still possible to write illegible code, but it's actually possible to write good clean code, too.

    (This is unlike Fortran 77, where for example there are certain tasks that cannot be performed without GOTO's. Ugh. It's got many other problems, too, even leaving aside the 6 character name restriction (since most compilers allow long variable names anyway).)

    I couldn't tell you whether it'd be worth your while learning Fortran as compared to using other languages. I do know that there seems to be no (reliable) free Fortran 90 compiler for Linux (g77 does a good job with Fortran77, though, with a few exceptions). We're using a compiler from Absoft here at work, and it seems to work well.

    My main point, though, is that Fortran 90 is not a bad language to use. It's not any more hideous than any other language, as near as I can tell; I've seen terrifying code in any language, and I've seen (and written) good code in F90.

    --

    -Erf C.
    Cthulu always calls collect...

  50. GCC doesn't translate to C by Trepidity · · Score: 2

    GCC now has a very flexible front-end and back-end model. The front-ends translate the language into an internal sort of meta-language, and the back-ends output assembler. Even C code goes through this translation process, via the C front-end to GCC.

    Besides, even if it did translate to C, it could still be faster than most C code, as it'd likely be translating to a subset of C.

  51. Dijkstra by 4of12 · · Score: 3

    Edsger Dijkstra (Interestingly enough, Dijkstra died today.)

    Yeah, I saw that. Sad, losing a luminary like that.

    And pointedly relevent to this discussion, since FORTRAN used to use GOTO statements for branching.

    If you're considering FORTRAN, then beware the GOTO as Edsger pointed out in this classic.

    --
    "Provided by the management for your protection."
    1. Re:Dijkstra by Chundra · · Score: 3, Informative

      Yeah I don't think it's a troll as it seems to be coming from reliable sources. Apparently his family sent an email to the faculty at cs.utexas.edu which has been forwarded around. I would imagine it would show up in the news within a day. Here's a link to the email, on the perl5-porters list.

    2. Re:Dijkstra by VP · · Score: 3, Informative

      UT-Austin has an obituary.

  52. Is it really worth it? by photon317 · · Score: 2


    I've never touched Fortran in my life, and I have no desire to. I hear all the time about how fortran code is faster than language_x for math, but I have a hard time buying it.

    In most cases, does a given numerical algorithm well-coded in C underperform the same algorithm well-coded in Fortan? Assume of course there are better and more expensive optimizing C compilers, as there are for Fortran.

    If so, by how much? if it's 10%, or even 20-30%, I would think it's not worth the trouble of using a nonstandard language. Your next hardware upgrade will make C just as fast if not faster.

    If Fortran wins - I would assume the win is because the restrictiveness and explicitness of the language make it easier for an optimizer to *really* know what's going and how to optimize things away safely. In this case I have to ask - can't you still code 90% in C and the rest in assembler - or be careful about your C code's semantics to make sure optimizations are obvious to the compiler? And wouldn't eitherof those still be preferable to supporting a klunky old language?

    --
    11*43+456^2
    1. Re:Is it really worth it? by geekoid · · Score: 2

      10% reductio in speed can ad days to some FORTRAN programs.

      A hardware upgrade will make fortran faster as well. assembler gets you nothing, and is way to costly.
      Then there is parallization.

      I would go on, but since you started by saying you never looked at, and then went on to say why something else is better, tells me your mind is already shut.

      --
      The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
    2. Re:Is it really worth it? by dvdeug · · Score: 2

      I would think it's not worth the trouble of using a nonstandard language.

      It's easy to argue that in this field, C is the nonstandard language.

      can't you still code 90% in C and the rest in assembler

      Why does a engineer want to learn assembly? Part of the advantage of Fortran is that my college professor who was in grad school when it first came out can still use it. Even 386 assembly is only 15 years old, and really ought to be rewritten for the most recent chips to be fast. Worse, it does you no good when you need to move the code to the Alphas or the Crays in your department.

    3. Re:Is it really worth it? by photon317 · · Score: 2


      Yes but 10% is 10%. If 10% is two days to you, it's two out of twenty - was it worth it? Given the whole Moore's law shebang, is 10% at any given time worth it when the 100% increases in underlying hardware come so fast?

      --
      11*43+456^2
    4. Re:Is it really worth it? by photon317 · · Score: 2


      You're rude, obnoxious, and uninformed. I'm not talking about PCs either you uneducated fuckwit. But let's digress for a minute:

      1) the "10% is 10%" argument applies to money, time, and power - so your point is moot.

      2) If you're paying people for cpu horsepower per hour, you're living in the stone age and you need to get with it. I bet I could take a month of your fees and purchase all the compute power you need permanently, and it would probably remain fast enough for you for at least a year or so before needing upgrade.

      --
      11*43+456^2
  53. problems with loops? by spongebobsquarepants · · Score: 2, Informative

    I hate to sound trollish, but Python seems to handle loops quite well, and I find them intuitively easier to implement than in C/C++. The next time the author uses Numeric Python maybe he should give for or while a try. Plus there are other modules such as sci.py and scientific python that offer other tools, and Python integrates well with R, gnuplot, GRASS, and other computational tools. And I find C++ to be pretty zippy speed-wise.

    1. Re:problems with loops? by Ian+Bicking · · Score: 3, Insightful
      I think we was talking about "inner loops" -- a classic speed problem for languages like Python. For example, Python is very bad at something like:

      i = 1
      for j in xrange(1000): i = i + some_func(j)

      Dumb example, but it more or less shows the issue... when you are dealing with data structures the overhead of the loop isn't that significant (e.g., doing list manipulation). But when you are dealing with numbers there's the potential to be much more efficient, and Python's for loop overhead will be very significant.

      Of course Numeric Python can solve many of these problems, as can SciPy's weave and Pyrex, which compiles psuedo-Python to C. You can also program your inner loops directly in C, and make a Python module out of it. Or even write the module in Fortran.

      Python clearly isn't a good language to write number crunching algorithms. But it's great for using those algorithms -- and it makes it possible (and relatively easy) to mix in other languages that are good for those algorithms.

  54. Re:Right Tool for the Job by GlobalEcho · · Score: 2

    I want to second the advice to parcel your project out into different languages. You would be a masochist to do your I/O routines in FORTRAN (file numbers, anyone?). But try, for example, finding decent optimization algorithms, linear algebra routines (Cholesky decomposition, etc.), and other serious code in C. [Num. Recipes, BTW, is not serious]

    Sure, there are CBLAS and CLAPACK -- both hideous automatic translations of the FORTRAN code!

    So in addition writing to your own code, you'll be able to scrounge *and adapt* useful routines from the literature.

  55. Re:MatLab is the shit... don't hate. by dukethug · · Score: 2

    I agree completely- Matlab is the bomb, and if you have to use loops in a Matlab program, you're a twit- it's a MATRIX based language. Use the matrices.

  56. Re:think about Scheme by Vengie · · Score: 2

    After having taken yale's cs 201 and taught it twice...i have developed an intense love-hate relationship with scheme -- suffice it to say, it does _NOT_ solve the problem in the orig. post.

    --
    When in doubt, parenthesize. At the very least it will let some poor schmuck bounce on the % key in vi. (Larry Wall)
  57. Is FORTRAN still kicking? by Quixadhal · · Score: 2

    Yes, much like the chicken who's been decapitated some time ago. It doesn't make it any less dead.

  58. Matlab? by gcondon · · Score: 3, Insightful

    While I certainly agree with your observation that Matlab is pricey, I don't understand your complaint that it is "inadequate as soon as it is necessary to use loops to describe a problem".

    Heck, one of Matlab's greatest advantages is that every numeric variable is represented as a matrix and that many loops can be dispensed with completely with a little judicious linear algebra.

    If you want to rip on Matlab, you'd be better off scorning its poor memory management or its byzantine handle graphics.

    However, it does provide a nice development environment for computationally intensive problems. Scripting is a lot nicer than compile-link-debug-repeat when you're still trying to figure out the problem. Plus you can always farm out the most intensive processes to external code modules - which you can write in C/C++, Java or (gasp!) FORTRAN.

    If price is the sticking point - why not take a look at GNU Octave. It is free as in beer (not GPL despite the name) and offers much of the same functionality as Matlab. Unfortunately, it shares most of the weaknesses of Matlab as well - and they are usually worse.

  59. Learn COBOL instead by DeadBugs · · Score: 2

    FORTRAN looks modern and up to date compared to COBOL. I actually had to take COBOL in college and I miss every minute of time I lost learning it.

    --
    http://www.kubuntu.org/
  60. One significant disadvantage to FORTRAN by Tim · · Score: 4, Insightful

    While the first two of the three points listed in the parent post are somewhat true, they are usually mitigated, depending on the languages you consider (e.g., you can find good compilers and well-optimized routines for C++ that will perform on par with FORTRAN, but maybe you can't for, say, Java).

    However, the third point is actually a disadvantage in my mind: the overwhelming simplicity to FORTRAN leads to simple-minded implementations that are often less efficient (in time and especially in space) than a good implementation in a more modern language.

    Case in point: Check out the sorting chapter of Numerical Recipes, and you'll find that their "ultimate" sorting algorithm -- and hence the algorithm that a whole generation of FORTRAN coders think is the fastest -- is heapsort. Now, heapsort is a fine algorithm, but it has some significant disadvantages over quicksort (the algorithm used in the C/C++ standard library. well, almost, anyway.) Of course, you can't implement quicksort properly in FORTRAN because the language isn't recursive! So, I guess it makes sense that they skip over it in Numerical Recipes.

    These sorts of issues abound in FORTRAN programming. A lot of (older) engineers and scientists still insist that FORTRAN is the best language for high-performance mathematics, and to some extent, they're correct. As long as your mathematics are limited to those problems that can be solved with gobs of iteration, FORTRAN is your tool. But the minute you step into a realm where a more advanced data structure would be more important to performance (think hashes, heaps, trees, linked lists, etc. Places where algorithms actually matter.), FORTRAN falls flat on it's face. And don't even get started on space efficiency -- any modern language will beat FORTRAN 77 on this, hands down. Pre-allocation of arrays tends to kill an application's memory footprint...

    Some of these issues are addressed in FORTRAN 90, but really, if you're going to use that language, you might as well use a language like C++, which is more common, and just as efficient, with proper care.

    --
    Let's try not to let fact interfere with our speculation here, OK?
    1. Re:One significant disadvantage to FORTRAN by Tim · · Score: 2

      Consider two identical algorythms written in F77 and C++...

      Ok. It depends on the algorithm, actually. C++ can actually be faster. But that wasn't the original point. The point is, that algorithms are often more important than sheer loop-iterating speed, and for this, FORTRAN comes up short.

      NR writes for both FORTRAN and C. The shortcomming isn't the language.

      Sorry, but no. Look at the code in the versions of NR. The C version is basically a rehashed version of the FORTRAN version (almost, but not quite, an f2c of the original book). The algorithms are the same, with minor exceptions. And frankly, it is a language isssue. FORTRAN doesn't have recursion. You can't properly implement quicksort in a non-recursive language. And quicksort outperforms heapsort in most cases.

      --
      Let's try not to let fact interfere with our speculation here, OK?
    2. Re:One significant disadvantage to FORTRAN by jaoswald · · Score: 2

      You are right about naturally recursive applications in Fortran. But I would hesitate to use Numerical Recipes as evidence. The code generally blows for both Fortran and C, and the numerical methods are mostly out-of-date.

      Good numerical code is found in places like Netlib, or by having your institution license good numerical packages from reputable vendors.

    3. Re:One significant disadvantage to FORTRAN by hawk · · Score: 2
      >FORTRAN doesn't have recursion.

      Boy, I'm sure glad you didn't tell my committee this before they approved my degree . . . they never would have approved my recursive algorithm in fortran.

      Fortran 77 and earlier don't have recursion. Claiming that Fortran doesn't is as silly as basing criticisms of c and c++ on K&R or the assumption that c++ is handled by a c pre-processor. (However, all thinking people bash Pascal--even if you're wrong when you bash, it deserved it for something else! :)

      hawk

    4. Re:One significant disadvantage to FORTRAN by mikec · · Score: 2

      Be very careful of Numerical Recipes. It is full of nasty traps and outright mistakes. See http://math.jpl.nasa.gov/nr/ for examples.

    5. Re:One significant disadvantage to FORTRAN by Tim · · Score: 2

      It is absurd. What's the advantage gained by the hand-coded stack approach? Smaller stack frame, you say? Why does that affect execution speed in this context? You do some hand-waving by mentioning "cache and TLB misses," but this is almost pure crap, given that the context in a recursive function is going to be local anyway, and thus, the issue of cache misses will rarely, if ever, arise during function body excecution.

      Granted, you might run into this problem at the unwinding phase of the stack at the end of the recursion, but at this point, the performance impact is negligible anyway.

      Pile on top of this the fact that the NR stack makes it harder for a C/C++ compiler to properly optimize call dispaches in a sensible way, and the fact that, most likely, the compiler is going to do a better job of optimizing the stack code of a particular architecture than the authors of NR, and you end up with a smelly implementation of a good algorithm. And it isn't the only one. The code in NR is positively awful.

      --
      Let's try not to let fact interfere with our speculation here, OK?
    6. Re:One significant disadvantage to FORTRAN by Claudius · · Score: 2

      "Don't drive a Ford. Fords suck because my 2003 Caddy has way more features than a Model A." Let's compare apples and apples, shall we? It is unfair to compare Fortran 77 with modern languages such as C++. Either you compare Fortran 77 on its own merits with C++ circa 1977 (i.e. nothing) or else you should consider the most modern incarnation of Fortran (Fortran 95) with C++.

      Fortran 95 has pointers; I have implemented essentially all "modern" data structures--hashes, heaps, tress, linked lists--with it. You can program object oriented F90/F95 (with one caveat--see "*" below). If you are averse to the ugly language features of F77 and its predecessors and their inclusion in modern Fortran for backwards compatability reasons, then you are welcome and encouraged to program in a beautified and simplified subset of the language such as the language "F" and forget about Holleriths and EQUIVALENCEs and the like.

      As has been commented by others, Fortran is very efficient and relatively simple to optimize for certain kinds of tasks seen frequently by those in the science and engineering fields. Fortran 95 has nice array syntax that is dead easy for compilers to detect and optimize. Fortran also allows for a fairly rapid development cycle--the language doesn't have as much capacity for "being cute." You may hate the simplemindedness, but in the real world people have to read, understand, and maintain other people's code. All those cute syntactic tricks one feels obliged to play in C or C++ just add to the time it takes for someone to read over your code and figure out what the heck it is supposed to be doing. In my experience other peoples' Fortran 90 is so much easier to human-parse than other peoples' C or C++ that that alone would be enough to justify the language on any kind of nontrivial project. (That, and you don't have to piss away your time worrying about whether a method should be virtual or pure virtual, but I digress...).

      As for your slam of heapsort in Numerical Recipes, in my recollection Press et al. identified many specific technical reasons for suggesting heapsort for many numerical applications over quicksort: it is an "in-place" sort, it has the same computational complexity as quicksort, the worst case scenario is only about 20-30% slower than the best case scenario, and, yes, its implementation in some languages is more transparent. (People who use numerical algorithms that they don't take time to understand should be forced to take the maiden ride in the airplanes or drive over the bridges they design). In many numerical applications one needs to sort large "nearly sorted" datasets; naked quicksort without some kind of shuffling dies a painful N-squared death on these cases.

      (*) To be fair, I should comment that "object oriented" F95 doesn't support runtime polymorphism, but I've yet to encounter a numerical analysis task that would benefit in any significant way from this language feature.

    7. Re:One significant disadvantage to FORTRAN by Tim · · Score: 2

      "Either you compare Fortran 77 on its own merits with C++ circa 1977 (i.e. nothing) or else you should consider the most modern incarnation of Fortran (Fortran 95) with C++."

      Who are you to decide what can and can't be compared? A language is a language, and I can compare and contrast the features of languages as I please. Note that I talked about FORTRAN 77 in my post, not F90 or F95. It was a fair comparison - F77 is deficient when compared to a modern language such as C++.

      As for F9x, look around for my other post on the topic. Yeah, the language adds some desperately needed features, but all in all, it's as messy as C++, has fewer features than C++, and has a smaller user community! I personally wouldn't even consider F90, unless I had a big chunk of F77 code that I didn't want to port, and a good reason not to link it into a C or C++ application.

      "You may hate the simplemindedness, but in the real world people have to read, understand, and maintain other people's code. All those cute syntactic tricks one feels obliged to play in C or C++ just add to the time it takes for someone to read over your code and figure out what the heck it is supposed to be doing."

      These issues have been so well debated that I'm not even going to go into them here. You're wrong. Time and experience have shown this to be true. The "cute" features that bother you are important to writing large, maintainable projects. Can they be misused? Yes. Sure. But to programmers skilled with the language, they provide valuable tools that FORTRAN just doesn't offer.

      "As for your slam of heapsort in Numerical Recipes, in my recollection Press et al. identified many specific technical reasons for suggesting heapsort for many numerical applications over quicksort: it is an "in-place" sort, it has the same computational complexity as quicksort, the worst case scenario is only about 20-30% slower than the best case scenario, and, yes, its implementation in some languages is more transparent."

      Gee, it'd be interesting to see the date of the paper you cite, given that the introsort variant of quicksort guarantees O(n log n) performance, and has a lower constant than heapsort for most inputs (and, BTW, this is the std::sort in the C++ standard library). To be fair, introsort wasn't around when the original version of NR was published, but the authors haven't bothered to include or even mention it in any subsequent volume. Wonder why that is....(my own personal opinion is that the other versions of NR are simple-minded translations of the original FORTRAN code...)

      "To be fair, I should comment that "object oriented" F95 doesn't support runtime polymorphism, but I've yet to encounter a numerical analysis task that would benefit in any significant way from this language feature."

      I work in molecular simulation, and it's easy for me to come up with numeric tasks that benefit from polymorphism. Consider this: geometrically "building" a molecule is essentially nothing more than linear algebra, but polymorphism allows you to write the build code once, and re-use it on whatever particular molecule type you desire. Incredibly convenient....

      --
      Let's try not to let fact interfere with our speculation here, OK?
    8. Re:One significant disadvantage to FORTRAN by Claudius · · Score: 2

      Who are you to decide what can and can't be compared? A language is a language, and I can compare and contrast the features of languages as I please. Note that I talked about FORTRAN 77 in my post, not F90 or F95. It was a fair comparison - F77 is deficient when compared to a modern language such as C++.

      Read my comment on comparing modern automobiles with the Model A. Fine by me if you want to make the comparison--you just look a bit silly is all. Shall we dismiss C++ out of hand because pre-ANSI/ISO-Standard C++ had no convergence on template functionality? (In practice, compiler vendors still often don't implement the language standard fully, but I digress...).

      These issues have been so well debated that I'm not even going to go into them here. You're wrong. Time and experience have shown this to be true. The "cute" features that bother you are important to writing large, maintainable projects. Can they be misused? Yes. Sure. But to programmers skilled with the language, they provide valuable tools that FORTRAN just doesn't offer.

      Two obvious comments: First, language selection is entirely subordinate to design and planning of a project. A skilled programmer with an understanding of modern data structures and algorithms can, with very few exceptions, implement any of them in any sufficiently powerful language. You don't need C++ to do linked lists or hash tables or to have OO structure, or even to design large maintainable software projects. I have seen many large C++ projects fail because of poor design, and I have seen many large F90/F95 projects succeed because of superior design. The design decision on what language to use for a given project should be based solely on technical criteria and not kneejerk prejudices.

      Second comment: Those "skilled programmers" you refer to rarely seem to end up writing the code I have to read and maintain. I myself don't work in a software house--I am a scientist and I work with scientists, people who, unlike me, often don't have formal computer science training or any compelling inclination to learn to write beautiful, well-structured C++. We're not talking about people who have read, understood, and know how not to abuse the information in Design Patterns--we're talking people with PhDs in physics or engineering who have taken a 1-week "How to get stuff to compile with a C++ compiler" syntax course who suddenly feel qualified to code up the world only to end up, more often than not, reinventing (badly) features already in the STL. They have only a nebulous understanding of the subtle aspects of C++, and they tend to cling to "natural-looking" constructs and idioms that just end up bogging down their code factors of two to ten compared to equivalent Fortran. These people are much less of a hassle if you let them program in Fortran.

      I maintain, and I have considerable experience to back this claim, that because C++ is so large a language, to have any measure of refactorability you have to have programmers who have a solid understanding of the language as well as significant training in software design. Otherwise you get an unmaintainable mess, and the power and flexibility of C++ is overkill. Even if you do have such a team of programmers, it is not clear that C++ is always the language of choice: if you are not leveraging old C++ class libraries, you anticipate no need for refactorability of the current class libraries, if you have specific performance objectives (e.g., heavy array manipulation, which other languages handle better) or design objectives (a deadline that cannot tolerate the longer design cycle of designing/testing C++ class libraries), then C++ is simply not the best choice.

      As for introsort, I concur with your technical assessment of the algorithm. My only reason for broaching the subject was to comment that Press et al. had presented a set of technical reasons for preferring heapsort in many settings (not the least of which is that the algorithm is dead easy to understand) and not some misguided attempt to crown an "ultimate sorting routine" as your original caricature suggested.

  61. Re:Welcome to Legacy Land by grendelkhan · · Score: 2

    That was exactly my point. If you live in, or plan to ever live in Legacy Land, then by all means learn it. There are still plenty of positions and demand for people who know and can debug/edit commentless arcane legacy code. I don't know how many positions I ran across that were looking for MVS experience!

    --
    Wu-Tang Name: Half-Cut Skeleton Get your own Wu-Na
  62. The obligatory fortune... by Jon+Abbott · · Score: 2


    "A computer without COBOL and Fortran is like a piece of chocolate cake without ketchup and mustard."

  63. Re:Stupid question by Laplace · · Score: 2

    Nope, being flamebait is saying that Slashdot is full of wusses who don't like being told that they're stupid.

    --
    The middle mind speaks!
  64. Re:outperform "c" by drudd · · Score: 2

    There are two reasons why fortran generally outperforms c...

    1) Language differences: when you use pointers in c it is always difficult and sometimes impossible for a compiler to know in advance what you are doing, and thus can't necessarily optimize it. Fortran also has constructs which are easily vectorized and parallelized, taking better advantage of the hardware.

    2) the fortran compilers on most platforms are more mature, and the optimizing algorithms for fortran are well documented and have been studied for longer.

    Doug

    --
    Venn ist das nurnstuck git und Slotermeyer? Ya! Beigerhund das oder die Flipperwaldt gersput!
  65. Funny you should ask! by macemoneta · · Score: 2

    I just recently completed a port (a consulting job) of some MSDOS Fortran IV to Linux Fortran 77 (about 65K lines).

    The interesting thing is that I wasn't ever a big fan of Fortran, and never used it much. In fact I haven't written a line of code in Fortran in over 15 years.

    However, it literally took me only a few minutes to "come up to speed". The language is very clean, readable and maintainable. I wonder if anyone will be able to say the same about current languages in 15 years.

    --

    Can You Say Linux? I Knew That You Could.

  66. Talking as a guy who is currently working... by jellisky · · Score: 2

    ... with FORTRAN, I will echo what others have said, plus add a bit.

    Yes, FORTRAN is incredibly nice for what it was designed to do: calculate. It is quite quick at it, and the compilers for the 77 version, as noted by others, are incredibly well optimized for this purpose.

    FORTRAN is the code of choice for anything that requires a huge bit of mathematical calculations. When you're working with weather models, and it takes 20 hours just to run the FORTRAN code, you begin to notice when that extra overhead the other copilers put in when it increases run times by hours.

    That said, if you've programmed before in other languages, be prepared to be sitting there complaining about how terribly FORTRAN is set up. One of my mantras about FORTRAN which keeps me sane is: "The people who made FORTRAN were obviously screwy in the head." Of course, that is said entirely tongue-in-cheek, since the language was "setup" before I was even born. ('Course, not long before, but still before.)

    There's a lot to hate about FORTRAN from modern programming, but if you're willing to bite the bullet and accept it for what it can do, then you probably will find it incredibly useful in the long run. FORTRAN is perfect for long calculations (think hour-long, at least), but it is terrible at many other things.

    As for the 90 version, it has some nice features, but, overall, you can do a lot of what 90 has in 77 with only a few extra lines of code. Plus, from what I understand, the only decent 90 compilers are commercial (i.e. not free), so factor that into your decision.

    So, yes, FORTRAN is ugly code... yes, FORTRAN is terribly constructed given current languages... but, it does its job admirably well. And if anyone wants to complain with me that the difference in running time between C and FORTRAN is only 10%, let me give you a program that'll run for 30 hours in FORTRAN and I'll gladly have those 3 hours extra I just saved.

    -Jellisky

  67. Re:Try Common Lisp by alispguru · · Score: 3, Informative
    The problem with using CL for heavy computing tasks is that Lisp is a linklist-based language.

    Just curious, does all your knowledge about programming languages date from 1975, or just your prejudices about Lisp? Lisp has had arrays since about then, those arrays have the same O(1) access time as anyone else's arrays, and the performance of code using them is tuneable to FORTRAN speed or better. Whoever taught your "survey of programming languages" course did you a real disservice - maybe you should get them brought up on educational malpractice charges.

    That said, FORTRAN can probabaly outrun Lisp on supercomputers, because of the effort put into parallel and vector optimizations on those platforms. I love Lisp, it's my preferred hacking environment, but I wouldn't propose it as the language of choice for big numerical applications unless there was a chance that hairy data structures might improve performance.
    --

    To a Lisp hacker, XML is S-expressions in drag.
  68. Just had a class this summer... by jaaron · · Score: 2

    I just had a grad class this summer in Scientific Computing and it was all Fortran 90. I knew Fortran 77 from a numerical computation course a few years ago. My point is, it is _still_ being taught and it is still *THE* language of choice for high performance scientific programming. Those who count Fortran as "outdated" or no longer significant obviously don't get exposed to this type of programming. While Fortran can seem "odd" to a programmer who grew up on java or C++, it is still a worth while language to learn and use.

    --
    Who said Freedom was Fair?
  69. Re:Bullshit by Mt._Honkey · · Score: 3, Interesting

    I'm a physics student working for an experimental physicist. He uses FORTRAN, so I use FORTRAN (only when I can't avoid it). You are right. Pythia (google search the word, and feel lucky) is a great program for simulating High Energy particle collisions (I'm doing Tevatron simulations in the background as I type), but since it was started a couple of decades ago, it's written in FORTRAN. They're trying to convert to C/C++ (can't remember which), but it's a multi-year project for code that's already written. They've put it off for so long because the FORTRAN code works just fine (for the most part). There are some memory considerations and interface issues that make them want to switch over.

    It will be nice when the finaly do.

    --

    Don't Bogart the fish sticks
  70. Try O'Caml by Tom7 · · Score: 3, Informative

    Try O'Caml (caml.inria.fr); it's a modern language that's compiled very efficiently (independent benchmarks) and is suitable for heavy crunching. O'Caml has lots of features that you won't find in many languages, like algebraic data types, higher order functions, etc., but is intended for real general purpose programming. Most importantly, it's type-safe (statically) so you probably won't spend as much time tracking down bugs unrelated to the problem at hand. (That has certainly been my experience with SML, a language from the same family.)

  71. hear hear for portability by jjtime4sko · · Score: 4, Informative

    I'm not going to wade in on a lame language war, but Fortran IS very portable. I have worked on code that was written in 1967 for a CDC mainframe. It was then ported to a:
    PDP-11, then a
    Vax, then a
    486-class PC. The code ran much faster on the PC then the Vax.

    Then I discovered that I needed a routine from the original CDC implementation, which had not been touched since. So I typed in the routine FROM CDC PUNCH CARDS. Compiled perfectly.

  72. Re:Try Common Lisp by jaoswald · · Score: 5, Interesting

    A caveat about Common Lisp:

    it has a lot of good things that are similar to Fortran in the numerical world.

    * Integers are not a fixed width, but transparently go to multiple precision instead of wrapping around.

    * All of the intrinsics deal with complex numbers transparently.

    * True rational numbers: i.e. ratios of integers.

    * (Better than Fortran): STANDARDIZED parameters to describe the floating point parameters of the machine (e.g. machine epsilon). Also, built-in, portable access to the floating-point encoding in bit form. Very nice bit-bashing intrinsics (I like them better than C).

    * Very flexible arrays. Some nice intrinsics (row-major-aref ...) that allow you to write code to traverse arrays in very convenient ways.

    * Notation is pretty flexible: can add multiple numbers together using (+ a b c d e f g).

    * Lisp macros are amazing. The whole power of the Lisp language is available as a "preprocessor." You can relatively easily write programs that write programs that write programs. As an example, although Lisp has built-in, kick-ass OO (CLOS), you could write your own transparent object-oriented extension to Lisp (i.e., roughly equivalent to what cfront did for C) in about 200 lines of Lisp macros, and it works as well as if it were built-in.

    Some slight "disadvantages"

    * Prefix notation is the default. Add-on macro packages let you also write code that is infix

    (e.g. #I instead (+ (expt a 2) (expt b 2) (expt c 2)))

    but it is not a built-in standard.

    * The standard does not *mandate* the ability to specify extremely large arrays. Not necessarily a real problem unless you want > 1 GB arrays on a typical 32-bit implementation.

    * The notation is sort of verbose. Array references go like (aref array-variable i j k l). This is just notation, so the compiler should optimize this if you ask for it.

    * Variables are not typed. The way around this is declarations. Again, the notation is somewhat verbose. (the double-float (+ (the double-float x) (the double-float y)) or (declare (double-float x y) (+ x y)). Again, this is just notation, so you can "easily" write lisp macros to write either of these as something like (d+ x y)

    * Most high-performance computers have high-quality Fortran compilers. Fewer have high-quality architecture-specific Lisp compilers. Likewise for highly-multiprocessor machines.

    * Most importantly, the bias in the Lisp world has been to optimize things like OO method calls, function calls, recursive function calls, automatic garbage collection. Not much pressure to optimize number-cruching on large arrays. Fortran compiler writers for the last 40 years have been asked to do one thing: optimize number-crunching on large arrays.

    That said, for certain numerical codes, Lisp is a nicer tool than Fortran. For some other numerical codes, a good Lisp compiler (which might not be available for your architecture) given code with sufficient declarations could match a Fortran compiler for code speed, no more than 10% performance loss, sometimes performance gain. For some codes, Fortran is going to win big in execution time.

  73. The obligatory other fortunes... by Jon+Abbott · · Score: 2

    OK, I couldn't resist... Here are the rest:

    "Real programmers don't write in FORTRAN. FORTRAN is for pipe stress freaks and crystallography weenies. FORTRAN is for wimp engineers who wear white socks."

    "The primary purpose of the DATA statement is to give names to constants; instead of referring to pi as 3.141592653589793 at every appearance, the variable PI can be given that value with a DATA statement and used instead of the longer form of the constant. This also simplifies modifying the program, should the value of pi change."
    -- FORTRAN manual for Xerox Computers

    "You can measure a programmer's perspective by noting his attitude on the continuing viability of FORTRAN."
    -- Alan Perlis

    "You can tell how far we have to go, when FORTRAN is the language of supercomputers."
    -- Steven Feiner

    "An engineer is someone who does list processing in FORTRAN."

    "FORTRAN is a good example of a language
    which is easier to parse using ad hoc techniques."
    -- D. Gries
    [What's good about it? Ed.]

    "FORTRAN is not a flower but a weed -- it is hardy, occasionally blooms, and grows in every computer."
    -- A.J. Perlis

    "FORTRAN rots the brain."
    -- John McQuillin

    "FORTRAN, 'the infantile disorder', by now nearly 20 years old, is hopelessly inadequate for whatever computer application you have in mind today: it is too clumsy, too risky, and too expensive to use."
    -- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5

    "[FORTRAN] will persist for some time -- probably for at least the next decade."
    -- T. Cheatham

    "It's multiple choice time...

    What is FORTRAN?

    a: Between thre and fiv tran.
    b: What two computers engage in before they interface.
    c: Ridiculous."

    "On the eighth day, God created FORTRAN."

  74. Extra ints on unformatted writes by TFloore · · Score: 3, Informative

    Your issue with extra ints on unformatted writes of Fortran file io... I've worked on Fortran development on 2 platforms:
    1) DEC/Compaq Alphas running OpenVMS with DEC compilers
    2) Windows NT4/2K with MS Powerstation v4 and Compaq Visual Fortran v6 compilers.

    The DEC compilers on OpenVMS did *not* do those extra ints on unformatted file io. My C code to read the output file worked with no extra steps, and could read data structures with few problems. The MS/Compaq compilers *did* write extra ints on the Windows platform. Drove me buggy when I was trying to port some software from VMS to Windows. (Don't ask why, I was ordered to do it.)

    Incidentally, the MS Powerstation v4 compiler wrote a 16-bit int before and after, and the Compaq Visual Fortran v6 compiler wrote a 32-bit int before and after. That change also drove me nutty. This had some extra issues... an array declared as
    integer(4) MYVAR(1000)
    was *larger* than the 16-bit int could specify... so the compiler broke it up into 128-byte chunks. Yes, a 4000-byte array was written as a series of 31 128-byte chunks (each with its own leading and trailing 16-bit ints), followed by a 32-byte chunk with its own leading and trailing 16-bit ints. Making C code to read this mess hurt my brain. At least switching to the Compaq v6 compiler took that issue away.

    I didn't look up the Fortran language spec to see which one was actually complying with the spec. Having seen all three methods, I decided none were correct.

    Incidentally, when doing unformatted writes of structures where one language is writing, and another language is reading the file... Make sure both compilers are using the same memory/data alignment rules. My Fortran compiler was doing align=byte, and my C compiler was doing align=word, and my structures with some logical*1 and integer*2 variables were messing up my read routines.

    Ahh... the dangers and joys of multi-language development projects.

    --
    This is my sig. There are many like it but this one is... Oops. Frank, I've got your sig again! Where's mine?
    1. Re:Extra ints on unformatted writes by Rasta+Prefect · · Score: 2

      Cray and IBM both put them in..32 bits.

      Make sure both compilers are using the same memory/data alignment rules. My Fortran compiler was doing align=byte, and my C compiler was doing align=word, and my structures with some logical*1 and integer*2 variables were messing up my read routines.

      Don't I know it. As I was attempting to make this software run on both a Linux machine and a Cray T3E, I opted to just read in each array and variable seperately, and that seemed to work. This made things more interesting because Cray likes to word align things, and a Cray word is 64 bits. Also, a Cray int is 64 and a short is 32. Mostly I just kinda fiddled it until things lined up right(fortunately, there were some nicely distinctive tags in the datafile).

      --
      Why?
  75. The real question is... by Glock27 · · Score: 2
    what will replace FORTRAN down the road?

    I vote for high-performance Java, personally (with further extensions for better performance like lightweight objects [no inheritance but very little overhead for things like complex numbers], immortal [static] objects and a good generics implementation). I'd also like to see a very flexible and extensible operator overloading functionality, as well as the ability to use Unicode in Java source as an optional extension, for both variables and operators.

    Also don't forget that gcc 3.x now includes a Java front end...perfect for extending into numerical Java. It's especially appropriate since it is a traditional "ahead of time" compiler permitting full optimization.

    IBM has already provided matrix libraries written in Java with about 80% of the performance of fully optimized FORTRAN. Another interesting library is the Colt Library. It is also possible, using JNI and DirectIO, to use legacy libraries efficiently from Java where appropriate.

    The focal point for numerical Java is Java Grande.

    BTW, I was sorry to miss the Java 3 discussion yesterday, but this post summarizes my desires in that area. Quite a bit different from those of the article's author (what a whiner that guy was!).

    At any rate, FORTRAN is still alive and kicking, and will be for another hundred years I'm sure... ;-)

    I hope new development is mostly being done in Java in the not too distant future, though!

    --
    Galileo: "The Earth revolves around the Sun!"
    Score: -1 100% Flamebait
  76. Design and Structure by Morris+Schneiderman · · Score: 3, Informative

    Fortran does not force you to write spaghetti code, any more than c forces you to generate buffer overflows or perl forces you to write unreadable code.

    Design and structure your application.

    If you are used to objects and methods, just use subroutine modules and entry points to the same effect.

    Fortran was where I learned to use multiple entry points into one sequential file for recursive processing.

  77. Survey Says: FORTRAN Most useful language by guisar · · Score: 2, Interesting

    I was involved in a study by UNM on the choice of language for entry level computer scienctist (aka the weed-out course). We considered all the options (java, c++, pascal, lisp, etc) and I happened to think it might be useful to ask practicing programmer what language they learned and what language they would recommend new developers to cut their teeth on.

    I asked them to consider both the training (aka marketability) and educational aspects of their recommendation. I didn't want the concerns of getting a job to be the overwhelming focus of their recommendation. I wanted them to also think about how much useful experience, insights and language neutral knowledge they gained from the language they first learned.

    Not suprisingly, BASIC was the most common language cited as "first learned" followed closely by PASCAL. FORTRAN, Modula II and SCHEME all placed in statistically close proximity to one another. Don't stop reading yet though- the punch line is to come.

    A more interesting trend came from these same practicing programmers answer to the question of whether they felt their first language was of great help to them or simply a cross to bear. FORTRAN 77 was overwhelmingly cited as the most worthwhile language to learn from. This was almost universal among the FORTRAN first users and statistically relavent among those who'd taken learned other langauges first and come to FORTRAN later on. Please note this was conducted in '94 before FORTRAN 90 had sort of taken over.

    The BASIC developers, once they had a bit of experience under their belt, as the source of many bad habits and of limited income earning and problem solving potential. The PASCAL initiates saw no use for the langauge beyond academia. Modula II was cited as a very educational language but with limited commercial potential. FORTRAN, though, was overwhelmingly cited as a great langauge to learn from.

    It's simplicity gave the semantics a low learning curve but the richness of the constructs and the structure they impose avoided the bad habits picked up within BASIC. The respondents (other than the old hats) were also nearly universally suprised by how widespread FORTRAN was not only for legacy code but as an everyday prototyping and general purpose language. They found FORTRAN knowledge mapped easily into other imperative languages.

    So, from both a practical, resume building point of view and for the holistic education FORTRAN will provide- go for it. 215 programmers can't be wrong.

    vr/
    Justin

  78. Factoring by Eccles · · Score: 2, Insightful

    There are some memory considerations and interface issues that make them want to switch over.

    If it's mainly the interface issues, restructure the Fortran code as a library, factoring out the interface code, and then rewrite the interface in a different language. It's not that hard to call library functions from most languages.

    --
    Ooh, a sarcasm detector. Oh, that's a real useful invention.
  79. Just do it. by JWhitlock · · Score: 2
    I'm beginning to wonder if I should invest the time in learning FORTRAN.

    What investment? It takes a day to learn FORTRAN. Just go learn it, then decide whether you want to use it or not.

    If you know any other programming language (C, C++, Perl, LISP, Visual Basic, Q-BASIC, ANYTHING), then it will take you a day or two to learn FORTRAN, especially if you don't need I/O routines. Give yourself a week if you want to learn I/O, EQUIVALENCEs, and the other details. Type "FORTRAN TUTORIAL" into your local Google search box and start working.

    I wouldn't want to learn it as a first language - I think the I/O is terrible. I can't use it for 30% of my work - I use C for decent I/O, preprocessor macros, simple string manipulation, pointers and casts. For the other 70%, it's just as good as any other procedural language.

    Of course, now someone will say C's I/O is terrible, and FORTRAN's is far easier. But again, it's silly to spend much time listening to debates like that, when you could learn the language in a day or two and decide for yourself. Jeeze, it's not C++ or LISP - it's just FORTRAN. It's like asking if Wordpad or Notepad is better for text editting...

  80. Re:MatLab is the shit... don't hate. by edrugtrader · · Score: 2
    --
    MARIJUANA, SHROOMS, X: ONLINE?! - E
  81. hunting bugs unrelated to the problem at hand? by ebyrob · · Score: 2

    What types of bugs would these be exactly.

    "Compilation" bugs? Those are actually there to help you and will save you many more nasty "logic" bugs in the future. Take some time and learn the language a little better, these will gradually become insignificant and invaluaable at the same time.

    "Logic" bugs? It's hard to see how logic bugs could be unrelated to the "problem at hand" unless it's a lack of libraries and or consistent interface that is your problem. Not sure how Fortran would help in any case.

    Knowing something about these bugs is the first step in trying to avoid them. (whereas switching languages would be one possible last step)

    I'll make some guesses:

    You're experiencing many compilation bugs because you don't understand the C/C++ environment you're working in, or because you're trying to force fit code from one environment to another. This is natural in switching from a specialized high level language to a very general purpose low level language. It takes a lot of time and effort to really master C or C++.

    A nice compromise might be using C or C++ that is callable from Matlab code. This could give you performance where you need it and ease of use when you don't. (Although from what I remember of Matlab the *seems* are no fun...)

    Of course, an even better alternative might be Java. It has wide library support and a great degree of similarity in the API's presented by most libraries. It might not be quite as efficient as C or C++ for some problems, but can be more efficient for others. It's also fairly easy to learn and use, and it's going to beat the pants off Matlab or Maple in computation speed. (It can also call native C when necessary, though the data structures differ greatly between C and Java)

    Hmm, maybe this whole article is just a Java troll...

  82. Bizarre complaints gainst other languages by tswaterman · · Score: 2, Insightful
    The poster makes some really bizarre complaints against other languages:

    any script based language (Matlab, Numeric Python, Scilab) to be inadequate as soon as it is necessary to use loops to describe a problem and using such tools for recursive systems can be a real pain.

    These are exactly the places where these languages excel, especially as compared with fortran! Fortran has only the most basic looping structures, and the lack of complex structures, pointers, and object abstraction makes writing any complex algorithm an excercise in mental anguish.

    Things like Numerical Python were implemented specifically to put the control structures in a language that is readable, writable, portable and understandable. If you really need to, you can code the bit twiddling in C and link from Python/Matlab/whatever, but for god's sake, leave the high-level program structure up where you can read it.

  83. FORTRAN 95 by ChaoticCoyote · · Score: 2

    Always use the right tool for the job... in other words, learn every language you can. I regularly program in C++ (mainstream applications), Fortran 90/95 (scientific number curnching and high-performance cluster apps), Python (scripting and prototypes), Java (portability and network systems), and various other languages as the need arises. Programming is a matter of algorithm, process, and design; syntax is a detail. BTW, your opinion of Fortran 90 is incorrect; indeed, Fortran 90 (and 95) is widely used, especially in the high performance computing (cluster) community. There is an active Fortran 95 project for the GNU compiler collection, and Intel has a "non-commercial" version of the Fortran 95 for Linux. Fortran 200x is in development right now.

    1. Re:FORTRAN 95 by ChaoticCoyote · · Score: 2
      What in the heck happened to my HTML tags? They were there in the preview... oh well, here goes again:

      Always use the right tool for the job... in other words, learn every language you can.

      Rgularly program in C++ (mainstream applications), Fortran 90/95 (scientific number curnching and high-performance cluster apps), Python (scripting and prototypes), Java (portability and network systems), and various other languages as the need arises.

      Programming is a matter of algorithm, process, and design; syntax is a detail.

      BTW, your opinion of Fortran 90 is incorrect; indeed, Fortran 90 (and 95) is widely used, especially in the high performance computing (cluster) community. There is an active Fortran 95 project for the GNU compiler collection, and Intel has a "non-commercial" version of the Fortran 95 for Linux. Fortran 200x is in development right now.

  84. Thoughts on Fortran Non-Obsolescence by coats · · Score: 3, Insightful
    1. Fortran as a language has evolved over the years. Most of the complaints that I see here are really myths about 1960's vintage Fortran-IV, not even about quarter-century-old Fortran-77.

    2. Always use IMPLICIT NONE in your Fortran; making declaration of variables required (as this command does) really can save your butt on large programs.

    3. It is really nice to program in a language where arrays are true "first class citizens". In neither C nor C++ can one conveniently and efficiently do the equivalent of
      Subroutine S( M, N, P, A ) ! arguments: Integer M, N, P Real A( M*N, 13*P, M+N-P ) ! local variables: Real X( M*N, 13*P, M+N-P ) ...

    4. For the current generation of compilers, Fortran is about twice as optimizable as C or C++. There are a number of reasons for this:
      • C compilers generally lack the address-calculation optimizations required for efficient access to run-time-dimensioned multidimensional arrays (stubbornness of the C-compiler writers being an obstacle here ;-()
      • Aliasing (array-overlap) assumptions present in C and C++ but not in Fortran (this may eventually be fixed by strinct-ANSI typing rules and restrict pointers -- provided that the programmer is smart enough to use them correctly.)

    5. A native complex data type is nice to have for many applications domains.

    6. Fortran character-strings frankly are both safer and a lot easier to use than C strings: they're the equivalent of a system-supported
      struct{ int length; char * contents; } foo_string;
      together with built-in (and optimizable!) concatenation operators, and comparison operators that behave sanely for different-length strings.

    7. Fortran-77 and K&R C are "small" languages with simple concepts and therefore are easier to learn and understand. Fortran-90/95 and ANSI C89 are "large" languages with correspondingly more subtleties and difficulty of learning. C++ is a huge language, and almost impossible to learn and understand completely--a fact that has much to do with the popularity of Java.

    8. As a numerical analyst, I find the fact that C -- by explicit wording in the standard -- refuses to respect parentheses, and has ill-defined arithmetic to disqualify that language for serious numerical algorithms. The result of -1/(-1) should not be up to the vendor to define!

    --
    "My opinions are my own, and I've got *lots* of them!"
  85. Will Python take over FORTRAN's niche? by steveha · · Score: 5, Interesting

    I read an article recently about a C extension to Python that very efficiently (and correctly) handled multi-dimensional matrix math. Thus you can write code using the very nice syntax of Python and still get good performance. The author of the article said something like "No one who has tried Python with these extensions ever wants to go back to FORTRAN."

    It made me wonder if, with enough C extensions, Python can take over FORTRAN's niche as a high-performance heavy number-crunching language.

    I don't know enough about the issues to make any predictions; I'm just wondering.

    steveha

    --
    lf(1): it's like ls(1) but sorts filenames by extension, tersely
    1. Re:Will Python take over FORTRAN's niche? by fxj · · Score: 3, Informative

      Eventually it will. Look at www.scipy.org. They have a module called weave. With that module you can mix C-code into Python-code. The C-code is compiled when you run the program the first time and then you have a fast module.
      There are also some modules which allow the linking of FORTRAN subroutines into Python code.

    2. Re:Will Python take over FORTRAN's niche? by sandgroper · · Score: 2, Informative

      Lots of things to like about Python, but NumPy is one of the better ones, IMHO. There is a largish and growing community of numerical jocks coalescing around around Python in scientific computation. NumPy makes Python into an "array language" (like Matlab, S-Plus/R, APL, etc. etc.) where the crunching is heavily optimized C code. Links to LAPACK et al., and Fortran wrappers exist in f2py and PyFort, for that old still-running-after-all-these-years code.

      (Just another enthusiast, dabbling in the religious-war du jour. Flamage to /dev/null ;-)

    3. Re:Will Python take over FORTRAN's niche? by clive_p · · Score: 2, Informative
      For some things, yes. It has the advantage of good exception-handling mechanisms, which won't be in Fortran until F2002 (and then not as good as Python's). And for high-performance applications, where you want to run on parallel hardware, it's not clear that Python can compete with a fully-compiled language.

      But I'm astonished at the range of mis-information on earlier replies in this thread. Most seem to think that Fortran means Fortran77, though just a few mention Fortran90. Most users of the language that I know have switched to Fortran95. It has just about everything C++ has, and more in a few ways: for example in Fortran you can define your own operators, and overload them. In C++ you can only overload an existing operator symbol, which leaves you with a rather small choice. Suppose you want to implement a "like" operator for string matching along the lines of that in SQL: you can define .like. to do it in Fortran, what obscure symbol are you going to choose in C++? Fortran95 isn't fully compatible with object-oriented programming, but for scientific applications that's often irrelevant.

  86. Used for jake brake simulators by danpbrowning · · Score: 2

    I happen to know that fortran is used for:

    * Modeling entire forests (not as easy as it sounds)

    * Modeling Jake Brakes (18 wheelers')

    It is a powerful language, still very much alive. Notice recent changes that allow it to link with Visual Basic code as the UI.

    --
    Daniel
  87. ???huh??? by hawk · · Score: 2
    >Of course, if You know the size of Your matrices
    >in advance, and are able to simulate decent
    >control structures with GOTOs, go ahead...

    ???

    GOTO???? Yes, both C and older version's of Fortran have them, but the last version of Fortran that needed them was the 1966 standard. There is no need for them in 77 (save the strange places you would also need them in c, but those are more thana little rare).

    hawk, trying to figure out how to criticize the 1966 c standard

  88. Skip to page 7 by briansmith · · Score: 2

    http://www.cs.utexas.edu/users/EWD/ewd03xx/EWD340. PDF

    Granted, I don't know if this guy has the necessary credentials to make such statements.

  89. Re:Fortran is NOT turing complete by dbretton · · Score: 2

    wrong.

    f90 does have dynamic memory allocation.

  90. Re: Ok, you are forgiven by anticypher · · Score: 3, Insightful

    A quick search on jobserve turns up 19 current job listings requiring Fortran. Not bad for a 30+ year old language. Several satellite, stress engineering and meteorology jobs.

    Working code just doesn't stop working because some new language has come out. Imagine having the job of converting 5 million lines of fortran code into visual C++ dotNet code. By the end of the week. With no errors. And no overtime... It just doesn't happen, working code doesn't need to be replaced, and thus it isn't.

    I'm still surprised when recruiters ask me about my fortran and cobol skills. I don't list them as skills, because I haven't touched them in more than a decade. But the skillPimps can see I'm an old fart, and the older ones know I started my career with the old languages, because perl and C++ didn't exist in 1972. Hell, Larry Wall was still in diapers when I first touched a computer.

    This goes back to the discussion, here and other places, about the difference between coders and computer scientists. Coders insist the only language they know is the only one for the job, because they are too uneducated to understand a language is just a tool. CompSci gurus will just pick up the best tool for the job, whether something ancient like fortran, or something like a procedural language or even assembler.

    the AC

    --
    Hemos is like...sci-fi fans;he thinks technology is cool, but he hasn't bothered to understand the science it's based on
  91. Real Programmers STILL use FORTRAN by Chris+Y+Taylor · · Score: 2

    http://www.pbm.com/~lindahl/real.programmers.html

  92. Re:Right Tool for the Job by anonymous_wombat · · Score: 2

    The poster wasn't concerned with speed as much as with having the right tools in which to program his application. He does not specify how long these mathematical operations take, but if we assume that they are complex and take at least 10 seconds, or maybe minutes or hours to complete, then the overhead of making a CORBA call isn't going to be a big deal. If his calculations take only a second or two, then the language that he uses is hardly going to matter for speed. He can just get a faster box.

  93. MATLAB & loops by Black+Cardinal · · Score: 2, Interesting

    First of all, let me say that I concur with the many others who've said that FORTRAN is alive and well. For a lot of numerical computing, it is a powerful tool.

    I do not consider MATLAB a replacement for FORTRAN, rather it's a fast-feedback analysis and visualization language. For matrix math it's unsurpassed. But I totally disagree about it being inept at looping--it would be a useless language if it were.

    It's been years since I've used MATLAB extensively, but I remember writing simulation of electro-mechanical systems in MATLAB that used FOR looping, conditional looping, and breaking out of loops. No disrespect meant, but I suspect that the person who asked this question has only a cursory knowledge of MATLAB, the kind you get after having one linear algebra class in college where the most advanced operation you use MATLAB for is to find the eigenvalues of a matrix. If you're a EE, then you don't really get to see what MATLAB can do until you take some advanced control systems or power systems analysis classes.

  94. Re:Fortran isn't so bad by Papineau · · Score: 2

    For having used it (although only in CLI apps) a few years ago (1999-2000), I really really hated working with it. The compiler itself was Digital's, and it caused me and one of my colleagues quite a lot of problems.

    For starters, the optimized version didn't run correctly, but would report that variables weren't declared (implicit declaration triggered a warning). So we had 3 versions: Debug, Release (optimized, but actually used for debugging), and Release-real (not optimized, but doing the right calculations).

    Then, the linker had some problems once in a while, when it replaced the content of some object files/functions by memory filled with 0. Of course, when you ran into that code, the EIP register would, in time, point to some unallocated memory, and a SIGSEV (or whatever is the equivalent on Windows) would be sent. That problem was very visible in the debugger. The solution? Just recompile the whole thing, and you'd have something sane again. No source file needed to be modified. And I thought that compilers were deterministic...

    Other than that, just make sure you know the language (especially when working with 20+ years old code): IF(CONDITION)10,20,30 is completely legal, as well as not declaring all your variables.

    Back to my own experience, instead of making the GUI in Visual Fortran, it was a separate app in VB. I won't enter the details of what we needed to do to communicate between the two.

  95. One reason - buggy C/C++ optimizers by Animats · · Score: 2
    One big reason much number crunching is done in FORTRAN is that FORTRAN compilers are expected to get number-crunching right. Some friends of mine maintain some major numeric codes written in C. These codes are used for structural analysis, and the right answers matter. For each new version of each major C/C++ compiler, they run a big collection of correctness test problems. And they find bugs that give wrong answers. Most new Microsoft compilers do not do optimized number-crunching right as shipped. Nor are the GNU compilers without flaw. They typically use compilers several years old, for which the problems are fixed or known, for serious work.

    In the FORTRAN world, where number-crunching is the main application and optimization is easier, compilers are expected to number-crunch correctly as delivered, or the vendor gets hell. So they do.

  96. Its a real man's language by thogard · · Score: 2

    Your not going to learn about the computed goto? how many other languages allow you to use an expression to evaluate to a three way branch?

    How about redimensioning an array? Or even redimensioning the middle of the array away so you can use its memory for some other bit of code you need to run? Many programs would set up a huge array and then repartition it latter depending on what they were doing and it was common to load compiled code into an unused section of memory and then call it.

    How about vector calculations?

    The fastest machines in the world still use Fortran and ist mostly because there are standard ways of telling fortran to do vector arithmetic while newer languages depend on add on libraries.

    Fortran's history is relected in most languages today as well as the archetecture of the CPUs.

    A language that doesn't affect the way you think about programming, is not worth knowing. --Alan J. Perlis
    Fortran offers new ways to wrap your head around some problems. That makes it worth learning.

  97. For Numerical Fetishists by magicianeer · · Score: 2, Interesting

    I did a bit of FORTRAN in the early 90's. IMO, its great strength is the ability to control the range and accuracy of numerical values as part of the language. No other programming language (that I know of) has comparable abilities. FORTRAN's control of numbers is analogous to the way Perl treats regular expressions as part of the language.

    Sure, you can get a math library for your favorite language that provides similar ability. You can get a regular expression library for other languages that gives you Perl-like abilities. But if you have ever used Perl, you know that the regex libraries of other languages cannot provide the flexibility-- the ease of expression-- the Awesome Power-- that Perl allows with regex. So it goes with numbers in FORTRAN. If you have a fetish for numbers, FORTRAN is for you.

    Yea, FORTRAN code is write-only, like Perl... such is the price of expressive-control.

    --
    You can have it good, fast, or cheap. Pick any two.
  98. Numerical Recipes considered harmful by jaoswald · · Score: 3, Informative

    Sure, the authors NR took on a big task (I wouldn't call it mammoth, because they only skim over things like PDEs), but they weren't up to it.

    The authors are scientists, not specialists in numerical computing. The appearance of "complete" does not equal accurate or correct. Writing robust and accurate numerical codes is difficult work, and there are journals dedicated to the topic.

    Even their code for special functions is pretty lousy, often just taken from Abramowitz & Stegun, which is a source from the 1950s!!!

    I'll freely admit that Netlib is not uniformly good; often, you have to find the most up-to-date solution to your particular problem from among the 3 or 4 solutions you find there. Also "old" does not mean "incorrect," or "untested," although it often does mean "probably inferior to some later work."

    Real production-quality matrix codes, for instance, are not easy-to-read like NR. They are total mazes of special cases and tests and branches, but all of those things were put in for very good reasons, and the stuff that survives in high-quality libraries has been throughly tested and peer-reviewed. Don't expect to read a few pages of chatty prose and a couple pages of Fortran and feel totally informed. Expect it to be a black box that you can use with confidence, but inside is basically incomprehensible without careful study.

    NR is a danger because it is not as good as readers think, and because it causes readers to not look any further for better solutions to their problems.

    1. Re:Numerical Recipes considered harmful by jaoswald · · Score: 4, Informative

      A nice guide to some other sources of mathematical software is NIST's GAMS for Guide to Available Mathematical Software.

  99. Re:Yes, it's still kicking, but should it be? by spiro_killglance · · Score: 2

    Fortran having a goto isn't the problem, the
    problem is in fortran you have to use it, because
    you have got loop altering constructs like break and continue, or basic switches.

    Fortrans other, problem is that its lack of
    pointers or references, makes it very hard to
    do simple datastructs like linked lists, or
    trees without resorting to ugle and wasteful
    int arrays of look up values into other arrays.

  100. PDL as an option by gizmo_mathboy · · Score: 2

    The Perl Data Language (PDL), found here, gives a fast backend for scientific and matrix computing.

    It is a tried and true extension to Perl that has been thoroughly abused by lots of folks.

    I would say FORTRAN is the way to go for scientific computing but PDL is something to give a look.

  101. Old and well aged by u2mr2os2 · · Score: 2, Interesting

    Since most of my job involves maintaining Fortran code, I'm a bit biased. Most points are right: lots of old code that is very debugged by now and too much to port, compilers are well worn and dependable. Many people knock F77 for the limitations of the standard, but no one uses that, they use the common extensions (Vax and Unix) like long variable names, no case sensitivity, include files and some other items. F77 is very flexible since most compilers do F90 as well. I use Compaq Visual Fortran which uses the MS Developer Studio, so there's no lack of a modern development environment.

    I have to personally give it a lot of respect since many Fortran compilers have a switch to toggle F66 syntax rules - as in 1966 - the year I was born! And Fortran was already 9 or 10 by that time.

  102. WATFIV my boy, WATFIV by gelfling · · Score: 2

    It's like FORTRAN but it whips around character variables like buttah!

  103. What about R + dynamic linking? by biostatman · · Score: 2, Interesting

    You mention something like Matlab as an alternative if it did not have poor performance. There is a very high quality free (beer, speech) program for Windows/Linux/OSX called R that is a matrix oriented language based on the S language, whose commercial analog is S-Plus. One of the really nice features is that you can write iteration or computation heavy routines in C or Fortran and dynamically load them into your R program/script.. The benefits are that you can take advantage of the high-level nature and easy scriptability of R (not to mention publication quality graphing capabilities), while taking advantage of the speed of Fortran/C.

    I am always shocked at how little attention R gets considering how good it is.

    --
    For the love of $DEITY, loose != not win!!!!!
  104. Any examples besides Quicksort? by Christopher+Thomas · · Score: 2

    And frankly, it is a language isssue. FORTRAN doesn't have recursion. You can't properly implement quicksort in a non-recursive language. And quicksort outperforms heapsort in most cases.

    If Quicksort is the most relevant example you can think of, then I'm afraid you're not making a very strong case.

    Both are O(n log n) in the best case, and I'll be extremely surprised if there's more than about a factor of two difference in running time for comparable best-case inputs. And yes, I've done the analysis.

    Quicksort, however, has a nasty habit of not guaranteeing anything better than O(n^2), which can be triggered by a variety of pathological cases (admittedly less likely for large sets being sorted). What you wind up with in practice, working through the analysis assuming randomly-distributed lists, is O(log n) average-case behavior with a nastier coefficient, degrading performance to a level closer to than of heapsort.

    You can use clever methods for selecting the pivot to reduce this problem, but this bites you back with the extra operations you have to perform. You don't gain a whole lot for the average case (though you make the pathological case far less likely).

    In summary, the quicksort-vs-heapsort argument is a red herring.

    Yes, there are problems for which recursive formulations are very elegant, but the majority of scientific problems that require brute force seem to be implemented adequately in Fortran-77. Do you have examples of important, computation-intensive problems for which the recursive formulation is far better than an iterative formulation?

    1. Re:Any examples besides Quicksort? by TMB · · Score: 2
      Do you have examples of important, computation-intensive problems for which the recursive formulation is far better than an iterative formulation?

      N-body tree codes leap to mind... admittedly, because that's what I do, but the idea of trying to implement one in FORTRAN would give me nightmares for years.

      [TMB]

    2. Re:Any examples besides Quicksort? by Christopher+Thomas · · Score: 2

      "In summary, the quicksort-vs-heapsort argument is a red herring."

      No, it isn't. It is an example of something that cannot be implemented properly in FORTRAN.

      Yes, it is, because it is something that does not need to be implemented, because heapsort works perfectly well for practical purposes.

      Pick another -- let's talk about space-efficent random list insertion or deletion, or implementation of a balanced tree, or any of a number of other areas where data structures are critical to algorithm performance. FORTRAN is not made for these things. Unfortunately, not every scientific problem is so cleanly decomposed into the tight little loopy segments that FORTRAN is good at computing.

      However, the majority of scientific computations _are_, as is demonstrated by the fact that FORTRAN remains so popular in the scientific community.

      By all means use C or some other language if that suits your problem best. But arguing that FORTRAN is bad because it doesn't work for a number of problems that aren't in its major workload is silly. It would be like, oh, saying that Perl is evil because it can't do matrix transformations as fast as C. In order for this to stick, I'd have to explain why people would be doing matrix transformations in Perl in the first place.

    3. Re:Any examples besides Quicksort? by Tim · · Score: 2

      "Yes, it is, because it is something that does not need to be implemented, because heapsort works perfectly well for practical purposes."

      Beautiful. You made my original point, proving the classic FORTRAN programmer mentality: "I can't implement something because my language is missing a feature necessary to do so. But, rather than admit that this is the case, I'll avoid the issue by pretending that another approach is better anyway." This doesn't make my argument a red herring, it makes your argument a straw man.

      "arguing that FORTRAN is bad because it doesn't work for a number of problems that aren't in its major workload is silly. It would be like, oh, saying that Perl is evil because it can't do matrix transformations as fast as C.

      Are you reading what I write? FORTRAN is good at what it does well -- loop iteration algorithms. However, when all you have is FORTRAN, everything starts to look like a loop iteration problem! This is the core of my argument; you're getting too caught up in the details to notice.

      --
      Let's try not to let fact interfere with our speculation here, OK?
  105. Re:ADA? by dvdeug · · Score: 3, Insightful

    Looking at ADA is painful. It looks like a language developed by a very large committee that wanted a language to do everything well. It acheives this, at the cost of being next to impossible to learn.

    What do you think of C++, then? Almost every feature maps one to one between C++ and Ada, except for threading, which Ada has and C++ doesn't, and various knobs and dials on templates and object orientation (template specialization, multiple inheritance) which C++ has and Ada doesn't. Furthermore, Ada doesn't have redundant funtions, like struct and class, or multiple ways to cast a value.

    Ada's not dead. There is considerable amount of embedded programming done in it, and some hobbist interest. Personally, I got tired of programming in a language where the first time I ran any program, its output consisted soley of "Segmentation fault". Most those programs, written in Ada, wouldn't pass the compiler; the other half would at least give me an exception with a line number for the problem.

  106. Comment removed by account_deleted · · Score: 2, Insightful

    Comment removed based on user account deletion

  107. CERNLIB by bmfs · · Score: 2, Informative

    Fortran is still alive and well in the high energy physics (HEP) community... though it is fading away slowly (not as slowly as some people would like though). Up until very recently, FORTRAN was *THE* language for data analysis but is slowly being replaced by C++ in newer experiments such as BaBar at SLAC and is replacing FORTRAN for data analysis at a few older experiments such as H1 at DESY. The reason why FORTRAN is fading away so slowly is mainly because of CERNLIB which is a FORTRAN library that contains many useful functions (random numbers, matrix manipulation, data fitting etc...) As most particle physicists "grew up" using CERNLIB, it will be a while yet before FORTRAN well and truly disappears (in the HEP community anyway). Also of note, CERNLIB has now been released under the GPL, so anyone can use it. Nice.

  108. Reduce bugs by switching to fortran? No way! by rew · · Score: 2

    Whatever "bugs" you're chasing, fortran is not going to make you stop making those mistakes.

    Switching languages once or twice would allow you to combine the practises that one compiler enforces on the other language. However, switching to fortran is not going to have that effect.

    Fortran is a bit simpler than C. This allows the compiler to make more assumptions about what you're doing. This allows the compiler for example to find paralellism. A for-next loop that goes over 100 thousand elements can be split in fortran into two loops over 50 thousand elements, each of your two processors doing half the work. However, after this one loop that the compiler happened to optimize, the second CPU will become idle again until anohter optimization opportunity occurs.

    Humans are much better at finding parallelism than compilers. Thus if an optimizing compiler can find 50% "things to do" for a second CPU you should be able to find almost 100%.

    Thus if you have an OLD, debugged, program that you want to run on the new parallel machine, a fortran compiler can boost your performance better than a C compiler. But you shouldn't learn fortran just because it's often used in high perofrmance computing. It's just that those guys happen to have large patches of code lying around, they have the fortrna experience, and lack the incentive to learn anything else.

    Roger.

  109. You can have pointer aliasing in FORTRAN by James+Youngman · · Score: 2

    ...but to do it you have to use EQUIVALENCE statements.

  110. Another visualisation option is ROOT by James+Youngman · · Score: 2

    ROOT is another option for visualisation (along with Octave and GNUPLOT). Interestingly, the ROOT system also includes a C++ interpreter (yes, interpreter!).

  111. Learn it, then do it by mnordstr · · Score: 2

    "C/C++ does not cut it for me - it is simply too easy to make mistakes and I find myself using half of my time hunting bugs unrelated to the problem at hand."

    If you know the language, you might maybe write code that isn't full of simple code related bugs. If you want simple, go with Visual Basic...

  112. Only 25 years? Pah! Youngster! by Simon+Brooke · · Score: 2
    Can it really be true that the best tool we have for heavy duty computing is a 25 year old language, or have you found anything better - free or non-free?"

    Actually, the the best tool we have for heavy duty computing is a forty-seven year old language which, among other things, handles arbitrary size and arbitrary precision numbers transparently, handles memory allocation automatically, handles recursive functions naturally as a key part of the language. As for efficiency, I can code factorial in three lines (70 bytes) of code, and compute the factorial of 10000 in 2.08 seconds:

    * (defun fact (n)
    (cond ((= n 1) 1)
    (t (* n (fact (- n 1))))))

    FACT
    * (time (progn (fact 10000) nil))
    Evaluation took:
    2.08 seconds of real time
    1.91 seconds of user run time
    0.16 seconds of system run time
    [Run times include 1.66 seconds GC run time]
    0 page faults and
    70756080 bytes consed.
    NIL
    *

    Beat that in any language. Note: only core features of the language used, no special libraries, no special constructs. Note also: I didn't declare n as an integer, I didn't have to. I didn't declare n a bignum, I din't have to. The language handles all that sort of detail automatically, and if I wanted the imaginary part of the factorial of 1000 all I'd have to do is ask for (imagpart (fact 1000)). Not only are complex numbers supported in the core language, they're supported transparently too.

    People get put off by the fact that LISP looks different and has a slightly different vocabulary from the ALGOL-derived languages they're used to. Once you're over the initial hurdles it's a very natural and extremely powerful language to use.

    --
    I'm old enough to remember when discussions on Slashdot were well informed.
    1. Re:Only 25 years? Pah! Youngster! by hding · · Score: 2

      I love Common Lisp and do most of my heavy lifting in it, but let's not get _too_ carried away. In Lispworks for Windows 4.2.6, your example (or rather either a tail-recursive version of it that doesn't cause the stack to overflow or a natural direct iterative version such as by using loop) takes about 2.6s to run on my box. An equivalent program in Dolphin Smalltalk takes .629s on the same box, and as you can see, there are no special tricks and the code is as simple.

      Integer<<factorialIterative
      | factorial |
      factorial := 1.
      2 to: self asInteger do: [:i | factorial := i * factorial].
      ^factorial
  113. Re:Try Common Lisp by alispguru · · Score: 2

    I apologize for my tone, but this kind of misinformation is understandably a sore point with Lisp people. Paul Graham's On Lisp is a great book for explaining modern Lisp style, as well as dispelling Lisp myths. The dead trees version is out-of-print, but the ps/pdf versions are available for download. Also check out his Articles page.

    --

    To a Lisp hacker, XML is S-expressions in drag.
  114. Sorry, My Bad by gcondon · · Score: 2

    I was thinking of gnuplot which is almost always used with Octave but which, despite the "gnu" in the name, is not associated with the GNU project or the FSF and is not GPL'd.

    You are absolutely correct, Octave is GPL'd. My most sincere apologies to the Octave team for my inadvertent slander.

  115. Re:In the Smithsonian by Yunzil · · Score: 2

    Dang, it's old, and so am I!

    Pfft. They also have a Commodore 64. Ask me how depressed I was when I saw that. :-b

  116. Re: ADA? by Black+Parrot · · Score: 2


    > Looking at ADA is painful.

    Much of beauty is in the eye of the beholder. I think Ada [sic] is much easier on the eyes than most of the other languages that are popular this week.

    > It looks like a language developed by a very large committee

    It was in fact designed by a team as part of a language-design competition. Is design by a team, or even a committee, a bad thing? I prefer to look at the resulting design rather than at the number of people involved. When I go shopping for a new car I don't give the least thought to how many people may have had a finger in the pie.

    > that wanted a language to do everything well.

    Sounds to me like a reasonable thing to want.

    > It acheives this, at the cost of being next to impossible to learn.

    Actually, it's really easy to learn because you only need to learn a small subset of it before you can start writing "real" programs. Then you can add knowledge (and use) of the sophisto stuff as you get more comfortable with it. (I would guess that 10% of the language does 90% of the work.)

    Just my experience. I think the biggest issue when evaluating new languages is the "not what I'm used to" effect.

    --
    Sheesh, evil *and* a jerk. -- Jade
  117. Re:ADA? by ccoakley · · Score: 2

    Don't give up on the code.

    You may want to look for some hard core CS students to hire. I have a student who wrote a reverse compiler for microsoft .net (because he could) that outputs C# code. He also wrote a .Net compiler for brainf*ck (because he could). He basically views it all as source code transformations, and while I agree with him at a conceptual level, I do not have the patience nor his expertice at writing such code to make any recommendations to him. The guy can write a parser for a language faster than anyone I've ever met. And he's an undergraduate.

    --
    Network Security: It always comes down to a big guy with a gun.
  118. Re: ADA? by Black+Parrot · · Score: 2


    > The argument that you can learn a small subset to be productive tends to bite you when you start trying to ramp up to multi-developer projects.

    Presumably anyone iterested in learning the language will go ahead and learn the rest of it, or at least most of it, after mastering the subset. My point was simply that you can bootstrap yourself into an admittedly "big" language by learning an easy Pascal-like subset, and then start mastering the additional features as time and motivation allow. The ability to learn a simple subset greatly reduces the frustration it would present you otherwise.

    No one wants to learn a language that requires you to read a thick book before writing your first Hello World program, but if you can master Hello World at your first sitting, and write at least some types of useful programs after a few days of playing with it, and then learn the more exotic properties of the language later, then even a big language will not scare you off.

    --
    Sheesh, evil *and* a jerk. -- Jade
  119. Re:Yes, it's still kicking, but should it be? by Tony-A · · Score: 2

    Should I learn FORTRAN?
    Should I use FORTRAN?
    Different questions, and not as related as one might think.
    From long ago, an observation that it is better to learn Pascal and use FORTRAN. Learning FORTRAN and using Pascal doesn't work.
    FORTRAN (I'm thinking FORTRAN-IV (1966 standard, I think)) is in some sense an optimal substitute for raw machine language. It can be very machine/architecture independent. There are things expressible in the language which would be better if they were illegal, but that would break the language. With Fortran77 they had an opportunity to make it a programming language. Instead they left it Fortran. I'd be surprised if Fortran90 were any different. If I had to use Fortan, I'd tend to stick to the basics and not victimize myself into thinking the language would take care of me.
    If the validity of your results is important, and you are willing to pay the price, Ada should be a good choice. There's stuff in Ada that turns "semantic" errors into "syntactic" errors. This is to avoid cases where a program can give correct results on one architecture and wrong results on a different architecture.

  120. I've done RPG too by billstewart · · Score: 2
    and believe me, you'd have to pay me six figures to maintain that cruft, and the high-order figure wouldn't be a "1" or "0".... The best thing to do with almost anything written for that brain-limited environment is to reverse engineer it and replace it with a very small Perl script, or a medium-sized C/C++/Java program. It was essentially a set of input/ouput format statements with the ability to do primitive arithmetic (no expression parsing - one operation per line) and simple looping control structures. Our main projects would crunch a bunch of data through an RPG system, then feed that through a sorter because you couldn't possibly do decent sorting in RPG, then post-process in RPG.

    I've also done Fortran - easy to learn, a few really ugly contructs like array overlaps, lousy I/O and character handling, funky bug opportunities in call-by-reference, but f77 and newer versions could interact well enough with C, so you could do the complicated parts in C and hand off any big array-crynching jobs to Fortran subroutines.

    --

    Bill Stewart
    New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
  121. Re: ADA? by Black+Parrot · · Score: 2


    > Excuse me, but why the "[sic]"? It actually is Ada. It is not ADA.

    That's why I used "[sic]". I was responding to someone who used "ADA", and I wanted to indicate that my change to "Ada" was deliberate.

    > And it is a wonderful language, despite all the "designed by committee" crap floating around, posted by people who have never programmed with it.

    Such as ESR.

    Yes, I agree that it's a wonderful language. I use it for almost everything I do, when the choice is up to me.

    --
    Sheesh, evil *and* a jerk. -- Jade