9 ms·
Fortran is still a thing (2017)
- PredictorY 8y agoOf course FORTRAN still matters. Somebody has to write real neural network code. We can't all be Python script kiddies!
- natalyarostova 8y agoH...hey. :(
- PredictorY 8y agoCome on... Using Python doesn't mean you can't have a sense of humor, too!
- sidlls 8y agoWhen I was in academia (physics) I basically lived and breathed Fortran. I find tensorflow in python quite nice to work with and undeserving of your derogatory comment.
- asdsa5325 8y agoHe's being sarcastic...
- CuriouslyC 8y agoWhat you call being a script kiddie I call working at a higher level of abstraction.
- Koshkin 8y agoI don't know about that. Fortran is no less abstracted from hardware than any other programming language (including Python).
- workinthehead 8y agoSheesh, does using Python also mean you don't understand good-natured teasing?
- eigenspace 8y agoIf you look at julia, it's done some amazing work at being a very high level flexible language thats also crazy fast. On the side of neural networks, theres some really exciting stuff in flux.jl: https://github.com/FluxML/Flux.jl https://github.com/FluxML/Flux.jl whhich provides a beautiful high level interface to a fast neural network written in pure julia. Here's an example of how simple it as at the core: http://fluxml.ai/Flux.jl/stable/models/basics.html http://fluxml.ai/Flux.jl/stable/models/basics.html
- jnaiz 8y agoBesides convenient syntax for numerical computing, Fortran also contains quite some functionality for writing safe code, e.g., bounds checking for arrays, strict typing of function arguments (unlike C) and 'pure' methods.
- Koshkin 8y ago> bounds checking Wouldn't this incur a performance penalty? > (unlike C) C is also strict in this respect.
- romwell 8y agoI'm writing this comment while compiling OpenMP Fortran code that models photoresist behavior in chip lithography. Could've written the same in C++, but for things like that, Fortran is more natural (its math syntax is Matlab-ish, although, of course, it's more correct to say that Matlab's syntax is Fortran-ish). Anecdote: I'm starting to learn Rust, and just for fun, wrote a dumb single-loop Riemann sum to compute pi in Rust and Fortran (as the area of the circle) - and Fortran code ran 2x faster. When the computation time is measured in days, this kind of difference matters.
- electricslpnsld 8y ago> Anecdote: I'm starting to learn Rust, and just for fun, wrote a dumb single-loop Riemann sum to compute pi in Rust and Fortran (as the area of the circle) - and Fortran code ran 2x faster. When the computation time is measured in days, this kind of difference matters. I'd love to use Rust for numerical heavy code, like Fortran Rust is no-aliasing out of the box which is great for code gen, but Rust also has many of the niceties of C++. Still no integer generics in Rust though. :(
- romwell 8y agoWell, the standard is still developing. I have high hopes for when more numeric computing people jump on the bandwagon.
- steveklabnik 8y agoThey should be in nightly later in the year, and stable early next year. We were only recently able to turn those no aliasing optimizations back on, so you were probably using a version of Rust that wasn’t even making use of them.
- philipkglass 8y agoMost people I know who use Fortran for long-running HPC jobs compile it with Intel's ifort. Are you using ifort (or another high-performance commercial compiler)? I ask because Intel's compilers can produce binaries with significantly better runtime performance than GNU or LLVM. AFAIK Rust relies exclusively on LLVM. I'm wondering if the slowdown is mostly about the very mature optimizing compilers available for Fortran or if it's intrinsic to Rust's language design. (I've never written any Rust myself.)
- hprotagonist 8y agoConsidering how much scientific code I write in python, I probably should drop a month or so on rewriting the slow bits in fortran to learn the language.
- marmaduke 8y agoLearning Numba will likely be a better pay off.
- twic 8y agoMaybe. But basic Fortran is pretty easy to learn - it's a somewhat warty but very simple language. It might well be the case that spending three days learning it lets you spend two days writing some straightforward but really fast code.
- Something1234 8y agoIt's very warty. The errors about formatting is unhelpful at best, if you're trying to do something it doesn't like, like having numbers together and separated by underscores.
- marmaduke 8y agoFor those already working in Python, Numba is a 2 hour investment, that pays off with similar speed as Fortran code except no new syntax, semantics, compiler or FFI to bother with.
- enriquto 8y agodo you think numbaized code written today using most of the features will run correctly on a standard environment in 20 years?
- code_duck 8y agoI know an acquaintance who works at a federal lab here in NM, writing Fortran that runs on a 20,000 CPU super computer to support scientific research. I think he makes something like 200k.
- Koshkin 8y agoForget FORTRAN: http://mmbasic.com/ http://mmbasic.com/
- romwell 8y agoAnd this is relevant.. how?
- cbcoutinho 8y agoFortran also has an interesting pattern of dealing with memory, in that everything is passed by reference between functions, yet there is no need to manually manage memory like you would need to in C/C++. I've never seen code where you need to deal with malloc et al. You are able to create dynamically allocated arrays or let arrays be sized on evocation, but I've never needed to deallocate or free memory at the end of a function/subroutine.
- gnufx 8y agoThis comes up most times Fortran is mentioned, but it is not true that Fortran passes by reference, and optimizations rely on that fact. The rules around storage association are typically referred to as pass by value-return or copy-in/copy-out. It's misleading to imply you never have to free memory. The NAG compiler runtime includes Boehm's conservative garbage collector (or did, last I checked) for a reason.
- riskneutral 8y ago“After careful deliberation, NASA has decided to cancel the High Performance Fast Computing Challenge competition it announced six weeks ago.“ The canceled competition would have involved running contestants’ code on a NASA supercomputer. The only logical reason I can think of for restricting the language to Fortran would be security concerns. Limiting submissions to one, well-understood and possibly safer language would limit the attack surface. But they canceled the whole thing anyway, again probably due to security concerns. In any case, yes Fortran codes are still around. The BLAS and LAPACK libraries are implemented in Fortran, which means that Fortran code is at the foundations of a ton of numerical software (e.g. MATLAB, NumPy, R, probably Julia, probably a lot of neural net libraries, etc). Any new HPC chip always comes with an optimizing Fortran compiler, we saw this with Nvidia GPUs for example). There are two reasons why Fortran is still used: (1) decades of work has gone into implementing numerical optimizations in these libraries. I am not just talking about machine-oriented optimizations, I am referring to higher level mathematical tricks that require deep domain specific expertise in things like linear algebra as well as a very strong handle on managing floating-point error. Extensive testing has gone into those libraries, and the continued validity of that testing depends on the language standard, compiler implementation, and compiler optimization levels. There is simply no value in rewriting all of this code in another language, given the enormous cost and risk. (2) older professors just prefer Fortran because they know it, and grad students have to use it because their profs use it, and front-line experts have to use it if they want to work on making enhancements to the imoortsnt existing Fortran libraries.
- randyzwitch 8y agoAs long as re-using fast FORTRAN code is better than re-writing it all yourself, people are going to use FORTRAN.
- bigger_cheese 8y agoThis is pretty much the reason at my work there is so much Fortran code already written a lot of it dates back to the '80's. This is mostly fluid dynamics and thermo stuff the math hasn't changed in decades so there is little impetus to rewrite. I am a Materials engineer I work with Chem/mech engineers on process modelling and simulation in an industrial plant. You can kind of tell the vintage of programs around here by looking at the languages used. There are Fortran programs from 80's to 90's. From early to late 90's there are C++ programs. Then from late 90's to mid 2000's there are VB6 programs (for a while our work was big on Microsoft, Visual Basic and Access was everywhere - boy did we get burned by that). From mid 2000's to early 10's there are java programs. Python seems to be goto nowadays.
- Something1234 8y agoDoes anybody here have any advice on reading and understanding old fortran77 code written around the year 2000? We need to make it faster. Any advice on visualizing the flow would also be helpful, as it makes use of goto extensively.
- celias 8y agohttps://stackoverflow.com/questions/3161564/how-can-i-visualize-fortran-90-or-later-source-code-e-g-using-graphviz https://stackoverflow.com/questions/3161564/how-can-i-visual... has some suggestions. I haven't tried any but am thinking of using Doxygen as described for some old Fortran77 code with lots of gotos since Understand is well outside of our budget. You're probably aware of this, but our biggest speed gains in some code we ported from DEC Fortran to gfortran was vectorizing loops. Best of luck.
- gnufx 8y agoIf you want to do performance engineering on computational code, particularly parallel, go to vi-hps.org or the sites for other toolsets like openspeedshop and hpctoolkit; also tools.bsc.es if vi-hps doesn't cover them -- I can't remember.
- aneutron 8y agoThere's a passage in the article that I either misunderstood, or the author is somewhat being agressive/hostile towards computer scientists and engineers: > Its users are scientists and engineers; not computer scientists and software engineers, but the real ones. Software engineers are in fact "real" engineers. Who do you think writes the compilers for Fortran. Edit: Read the article twice. The author is Ukranian. Either it's a linguistic mistake, or he really has some sort of prejudice against Software Engineers, in which case I find that sad.
- ztjio 8y agoIt’s a common, and I believe very fair criticism of the title “Software Engineer” that there is nowhere near the rigor and requirements that “real” engineers (structural engineers, mechanical engineers) must deal with. There’s no licensing. No proof you know what you’re doing. And sure, that’s probably because mostly software isn’t responsible for life or death situations like bridges and buildings are constantly. But honestly, the term “Software Engineer” is a farce at best. So maybe the author is in the camp that worries too much about meaningless titles.
- aneutron 8y agoI respectfully disagree with your point of view. There are certain things that are very ... softwar-y, and only engineers who know how to handle software well can come up with. Google's Percolator, the plethora of Apache data crunshing stacks, whole paradigm shifts like Object Storage, virtualization, and so on. Some of these are the equivalent of Burj Khalifa. Not anyone, or any team for that matter, can build them correctly. Which is why I think the term Software Engineer and the concept of software engineering is very justifiable. Yes, I think it is a form of engineering, in the sense that it a tangible discipline that produces artifacts that are useful to humans and that require very specific scientific knowledge and a minimum of academic background. Just my two cents on the matter.
- andrewflnr 8y ago"Software engineering" is definitely a real thing. The vast majority of people who call themselves "software engineers" aren't doing it. They're doing the equivalent of cabinetry at best.
- King-Aaron 8y agoMy father is a systems engineer with [large multinational company] who primarily does HMI controllers for the oil and gas industry. A lot of their products are written in sturdy languages like Fortran and it surprises me when people dismiss "older" languages like these.
- John_KZ 8y ago>Fortran is simple enough for domain specialist to write bad code and achieve good results with it. I don't understand the idea behind this statement. Nobody but the specialist can produce efficient algorithms to solve a domain-specific problems, and Fortran isn't any simpler than C. If the writer argues that the implementation of the algorithm is bad when written by non-programmers, then you might be surprised to find out that it's usually the opposite. Computers are still incredibly simple in their basic design, so unless you hire a hardware-specialist programmer (like an x86 or CUDA/OpenCL specialist with background knowledge of the chips you'll use), knowing basic latencies in RAM operation, L-cache sizes and the ticks required for executing basic operations like floating point additions and XORs, is enough for the specialist to write better code, because he understand the algorithm, he can tailor it the hardware, and he actually cares, unlike most programmers/software engineers. Knowing how to use hundreds of libraries might be helpful when you're writing long "consumer" applications, but this kind of expertise has nothing to do with scientific and high-performance programming.
- ktaylor 8y agoMy friend (PhD in Physics) runs a small hedge fund in Chicago. A team of about 6 traders and quants. They have been doing all their fairly sophisticated quantitative models in Fortran for the past 15 years. He is currently learning R, though, and so Fortran at this shop may have its days numbered.