Live data from Hacker News

Why physicists still use Fortran (2015)

moreisdifferent.com

261–270 of 300 posts

Re: Why physicists still use Fortran (2015)

#261

Earlier quoted context omitted.

Trusting legacy code with few users is a dangerous proposition. My roommate was given some "state-of-the-art" code and told to run simulations with it. The only graphical output was postscript (for some reason), so every frame was 150 MiB and took minutes to dump - so usually, this was only done at the end to show the result. I managed to hack in a step which just dumped the memory of resulting frame to a file, and t…

They where not back checking against real word experiments?

I've heard horror stories of supposedly quite serious software modelling programs behaving quite differently when their input problem was rotated a few degrees.

Re: Why physicists still use Fortran (2015)

#262

Earlier quoted context omitted.

I worked as a programmer in a molecular dynamics research group for a while. I was asked to work in Python because it was what the boss was familiar with - so there's some of the same inertia happening again, just with a new(er) language, I guess. Speed is not a huge issue if you're happy to leave your simulation running overnight anyway, or if you have the option to just throw more and more cores at the problem (or…

> Speed is not a huge issue if you're happy to leave your simulation running overnight anyway, or if you have the option to just throw more and more cores at the problem What about those cases that it's the matter between throwing at 1000 core cluster and wether we can have results before next conference in a couple months. That is what really defines the scientific programming -- it's about feasible and infeasible.…

Depends not all scientific programming is at universities

when I worked for BHR group (a Hydro dynamics research organisation) some times we had emergency projects that had < 24 hour turn around. I recall one where a clinet had had a serious issue at a plant and we ran the simulation and produced a report in a single day

Re: Why physicists still use Fortran (2015)

#263
post #224

Earlier quoted context omitted.

Did you write your own libc and libm? Compiler? We are ALL using code we didn't write.

Daniel J. Bernstein did that for all of his projects (qmail, daemontools, etc) and I don't see him getting a ton of flack over doing that.

He certainly used to back when qmail vs postfix as the better sendmail replacement was a real debate 'we' where regularly having. If he's not getting any flack today it's most likely because he's fallen more or less into irrelevance when it comes to practical day to day operations.

Re: Why physicists still use Fortran (2015)

#264

Earlier quoted context omitted.

Another problem is that most people who wrote this code aren't programmers - they don't write clean code, no tests, etc. They don't really know those are important. Sometimes the code that is used and updated for years looks like a dirty prototype. I don't know what can be done about it except hiring programmers to write code, which wouldn't be either easy or cheap

Well, I guess one moral of the story is that doing image manipulation is easier in Python than Fortran, so it's again using the right tool for the job. And I think the push for Physicists to use Python if possible is good, as the learning curve is less steep. And once you have that tool at your disposal, you might use it more often (instead of Excel). I can see many projects being improved by providing a Python pre-p…

If you don't have clean code and tests, vsc would allow you to switch between old and new bad, probably non working code. That's nice, but probably not what you'd want. If I'd need to choose one out of all, I'd choose tests. From my experience, it's nearly impossible to implement big system without tests. Maybe I'm just not good enough as a programmer

Re: Why physicists still use Fortran (2015)

#265
post #229

Earlier quoted context omitted.

And the full text in the article is: "However, the two benchmarks where Fortran wins (n-body simulation and calculation of spectra) are the most physics-y. The results vary somewhat depending on whether one compares a single core or quad core machine with Fortran lagging a bit more behind C++ on the quad core." Though I don't see how the single core version is measured. As far as I can tell, the spectra calculations…

And the article was "Posted on July 16, 2015". Back-then a second set of measurements were shown with the programs forced to run on one-core, using set-affinity.

Ahh, I missed the 2015 part. Thanks!

Re: Why physicists still use Fortran (2015)

#266

"Professors usually have this legacy code on hand (often code they wrote themselves decades ago) and pass this code on to their students. This saves their students time, and also takes uncertainty out of the debugging process." This is so true. I'm a PhD student in physics using Fortran for pretty much that reason. At the start of my PhD, in response to my supervisor telling me I should learn Fortran to modify our cu…

I recall that a local aerospace outfit was looking for C++ programmers to re do a metric F%^K ton of Fortran into c++. I actually rang the recruiter to query why would not be simpler to train your existing staff to use Fortran - the add stayed up for years and years I always wonder if it ever got ported.

Did you get an answer about why not just train them to use Fortran?

Re: Why physicists still use Fortran (2015)

#267

Earlier quoted context omitted.

They where not back checking against real word experiments?

I've heard horror stories of supposedly quite serious software modelling programs behaving quite differently when their input problem was rotated a few degrees.

Ugh - I remember spending a lot of time checking our pump simulator module against real word experiments back when I worked in technical computing

Re: Why physicists still use Fortran (2015)

#268
post #50

Speaking from a government contracting point of view: Nobody is going to pay you to rewrite existing code that's already working. Nobody. The customer doesn't give a flying shit about the implementation. He'd be happy with a box of diodes as an implementation, as long as it worked and came in on time and on budget. When you're writing up your proposal for a contract or a grant, the theme should always be that you're…

As with any sort of big transition (changing e-mail, using a new password manager, changing programming language), the solution is always to do it incrementally. For e-mail, I generally create a new one, and over a year or two, I create new accounts with the new e-mail and gradually move accounts until the old one is seldom used. Similarly here, it may be a bit tricky, and it really depends on how intertwined it all…

This gradual approach is what Mozilla is doing with transitioning Firefox to Rust. Parts of Firefox are already written in Rust.

Re: Why physicists still use Fortran (2015)

#269
post #26

Earlier quoted context omitted.

Yep. Most of my programming classes were either in pascal or c when I was in undergrad, but in my physics courses, all the way through my graduate education, I used FORTRAN. It's because physics doesn't change that much over the years, FORTRAN code that is time-tested and that works exists and there's no need to re-invent the wheel in another language when more interesting and important problems exist to solve.

David Baker's Rosetta code, which made him a pile of money, is IMO a spectacular example of craptastic C++ written by people who really didn't understand C++ but didn't let that deter them from using every single feature of the language, badly. Some years back we tried to port it to CUDA but there were so many levels of indirection, dereferencing, and virtual functions that it was nearly impossible to make any progre…

Maybe it's simply the fact that the C++ code was object-oriented?

OO allows you to make a much worse mess than procedural programming in my experience.

Re: Why physicists still use Fortran (2015)

#270

Earlier quoted context omitted.

They where not back checking against real word experiments?

I've heard horror stories of supposedly quite serious software modelling programs behaving quite differently when their input problem was rotated a few degrees.

I've heard horror stories of supposedly quite serious software modelling programs behaving quite differently when their input problem was rotated a few degrees.

Sounds perfectly normal :)

The standard advice here at work for one of our modelling packages is: if it crashes try rotating your input model by one degree and try again. Most of the time that will fix it. If it doesn't fix it try one degree in the other direction.

Post reply on HN