TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why are most climate models in Fortran?

119 点作者 JohannMac大约 4 年前

25 条评论

cbkeller大约 4 年前
High performance scientific computing is very much still a FORTRAN, C, and C++ game. And of those, FORTRAN has some compelling advantages in terms of first-class built-in support for multidimensional arrays, and quite excellent compilers. And, as others have noted, until the `restrict` keyword in C99, there were optimizations in FORTRAN that were not even possible in C.<p>I mostly used C for my (small-scale) HPC work in grad school because it’s what I knew best, but at several points I wished I had learned Fortran instead.<p>Probably one of the only “higher level” languages that’s ever been used for serious petascale scientific computing is Julia (first with Celeste on the astro side, possibly soon with CliMA for climate modeling), which not coincidentally follows similar array indexing conventions as FORTRAN. And while that’s what I mostly use now, I don’t see Fortran going away any time soon.<p>If anything, with cool new projects like LFortran [1] making it possible to use Fortran more interactively, it’s probably quite a good time to learn modern Fortran!<p>[1] <a href="https:&#x2F;&#x2F;lfortran.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;lfortran.org&#x2F;</a>
评论 #26456765 未加载
评论 #26456258 未加载
hilbert42大约 4 年前
1. There are thousands of scientific subroutines written in Fortran that are stable and well tested - in fact, there are well established formal libraries of them that go back over 60 years. The researchers know and trust them.<p>2. Despite the sneers and derision that Fortran has been subjected to from non-Fortran programmers over recent decades, Fortran is an excellent language to do intensive scientific and mathematics work. Compilers are optimized for calculation&#x2F;math speed and large intensive calculations. From the outset, it could handle complex numbers, double precision, etc., etc. natively without having to resort to calling libraries&#x2F;special routines as other languages had to do back then.<p>3. Scientific enterprise alongside mainframes and supercomputers have well established and stable ways of working including program and data exchange etc. Essentially, a well established computing ecosystem&#x2F;infrastructure surrounds scientific computing that researchers know and understand well. There is no need to change it as it works well. Moreover, it&#x27;s a stable and reliable environment when compared to other computing environments - Fortran was introduced long before the cowboys entered the computing field, back then the programming&#x2F;computing environment was more formal and structured, this contributed to that stability.<p><i>For the record, Fortran was the first language I learned, and my programming back then was done on an IBM-360 using KP-26 and KP-29 keypunches and 80-column Hollerith cards.</i>
评论 #26456788 未加载
评论 #26457482 未加载
评论 #26455216 未加载
评论 #26454695 未加载
评论 #26454821 未加载
评论 #26454785 未加载
dwheeler大约 4 年前
The actual title is, &quot;Why are Climate models written in programming languages from 1950?&quot;.<p>I think the assumption that &quot;old is bad&quot; is the cause of many, many, many foolish decisions. Useless code rewrites, company reorganizations that are not significant improvements, and many other bad ideas hinge on this Worship Of The New. Why are we using an alphabetic system originally developed c. 1800BC? It&#x27;s old, we should switch to new writing systems every 10 years because they&#x27;re new, right :-)?<p>Older is not better. Newer is not better. Better is better. There&#x27;s no point in switching something if the destination isn&#x27;t better, and even if it&#x27;s clearly better, it needs to be so much better that it&#x27;s worth the switching cost.
评论 #26456997 未加载
评论 #26459243 未加载
colllectorof大约 4 年前
Engineers are horrified to learn that mathematical modeling is done in a language created in the 50s, but aren&#x27;t bothered by the fact that the dominant computer interaction model used in the field <i>right now</i> dates back to pre-WW2 teleprinters. Someone is lacking in self- and historic awareness.<p>What <i>practical problems</i> does Fortran cause when used for numerical computing?
评论 #26455897 未加载
评论 #26456015 未加载
评论 #26456099 未加载
sampo大约 4 年前
Hint for commenters: Since Fortran 90, it&#x27;s spelled Fortran, not FORTRAN. By using the latter you signal that your experience on the topic is from 30 years ago.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fortran#Fortran_90" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fortran#Fortran_90</a>
评论 #26455996 未加载
评论 #26456546 未加载
评论 #26461123 未加载
评论 #26456054 未加载
hatmatrix大约 4 年前
C and C++ are definitely the competitors to Fortran; not Chapel or Python. In the life sciences, large amounts of Fortran code has been rewritten in C&#x2F;C++. But they have orders of magnitude more funding than climate science and teams of professional programmers to maintain the code.<p>Fortran is a domain-specific language for scientists, and excels at array arithmetic (for graph-based problems though, maybe look elsewhere). Even badly-written code can run reasonably fast, which is not the same for C&#x2F;C++. There is also the decades of concerted hardware and compiler optimizations that make Fortran hard to beat on HPC systems.<p>It&#x27;s not as readable as Python, but it&#x27;s more readable than C&#x2F;C++ written by a professional programmer.
评论 #26460960 未加载
Hankenstein2大约 4 年前
I work at one of the labs mentioned and get paid for running not only the climate models but mesoscale models as well, which are also written in Fortran.<p>The premise of the article is that Fortran, 70 years later is still an appropriate tool to use for crunching numbers which it absolutely is but it neglects one major problem.<p>Like the COBOL issue that was all the rage 20 years ago, it is difficult to hire younger generation programmers that want to and are excited to develop in Fortran.
评论 #26456665 未加载
评论 #26455939 未加载
评论 #26456699 未加载
评论 #26457368 未加载
enriquto大约 4 年前
Not only &quot;climate models&quot;... a large chunk of scipy is just a thin Python layer over decades-old Fortran code. That many physicists chose to use the real thing instead of the fisher-price interface speaks in favor of them.
评论 #26455987 未加载
评论 #26455270 未加载
评论 #26460948 未加载
waynesonfire大约 4 年前
Something really strange happens when an industry sector is highly populated. Thinking, fortran vs javascript or freebsd vs linux.<p>Seems like a sector with high population and low barrier to entry is prone to illusory superiority that lowers the quality of the system.
m463大约 4 年前
Has anyone LOOKED at fortran recently?<p>Some excerpts from <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fortran" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fortran</a><p>Fortran 90:<p>- Ability to operate on arrays (or array sections) as a whole, thus greatly simplifying math and engineering computations.<p>- whole, partial and masked array assignment statements and array expressions, such as X(1:N)=R(1:N)*COS(A(1:N))<p>Fortran 2003:<p>- Object-oriented programming support: type extension and inheritance, polymorphism, dynamic type allocation, and type-bound procedures, providing complete support for abstract data types<p>Fortran 2008:<p>- Sub-modules—additional structuring facilities for modules; supersedes ISO&#x2F;IEC TR 19767:2005<p>- Coarray Fortran—a parallel execution model<p>- The DO CONCURRENT construct—for loop iterations with no interdependencies<p>- The BLOCK construct—can contain declarations of objects with construct scope<p>Fortran 2018:<p>- Further interoperability with C
CookieMon大约 4 年前
How is Fortran coming along with GPUs? (last I looked it was being done with proprietary compiler language extensions, but that was a while ago)<p>Are modern supercomputers faster than a cluster of consumer-grade GPU cards?
评论 #26456076 未加载
评论 #26455627 未加载
simplicio大约 4 年前
Another advantage to Fortran in academic settings, at least the older version of Fortran, is that there isn&#x27;t much to the language. Someone already familiar with programming can pick it up in a day or two.<p>So if your a Prof with a large code-base that you want to have a stream of Grad-students, undergrad research assistants, assoc. Profs etc. contribute to before they move on, having a language that doesn&#x27;t require squandering half a semester on learning to code before you can start doing actual science is a big bonus.
airhead969大约 4 年前
Fortran will always be around because there&#x27;s too much investment in it.<p>A nuclear reactor simulator I ported from UNIX to Win32 in 1998 was several million lines of code written by nuclear engineers (not software engineers) and physicists. It&#x27;s over 60 years old now.
spartee大约 4 年前
Author here - Thanks for reading!! Lots of great comments here. Happy Pi day!
complex_pi大约 4 年前
Fortran is hot at the moment :-) See &quot;Resurrecting Fortran&quot; (blog post by Ondřej Čertík <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26445438" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26445438</a> <a href="https:&#x2F;&#x2F;ondrejcertik.com&#x2F;blog&#x2F;2021&#x2F;03&#x2F;resurrecting-fortran&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ondrejcertik.com&#x2F;blog&#x2F;2021&#x2F;03&#x2F;resurrecting-fortran&#x2F;</a> ) about the promising Fortran &quot;standard lib&quot; and the Fortran community in general (see the related website <a href="https:&#x2F;&#x2F;fortran-lang.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;fortran-lang.org&#x2F;</a> ). The story here is interesting but lacks a bit about this wider context.
jessaustin大约 4 年前
TFA would seem more reliable if it didn&#x27;t have such a needlessly obscurantist Fortran-python code comparison. Nothing about the two languages calls for different base case logic! That is, in order to prevent confusion, the &quot;Python3&quot; code should have been this:<p><pre><code> def fibonacci(n): if n &lt; 2: return n else: return fibonacci(n-1) + fibonacci(n-2)</code></pre>
评论 #26457052 未加载
pjmlp大约 4 年前
Why doing the examples in Fortran 90 in 2021 blog post, when 2018 is the most recent standard revison?
评论 #26456068 未加载
评论 #26456072 未加载
chris_va大约 4 年前
(disclaimer: I work in a Climate&amp;Energy R&amp;D Lab)<p>I don&#x27;t entirely agree with the overall assertion of this article. The author has some valid points, but I think it misses the forest for the trees.<p>TLDR: I think Fortran tooling and HPC clusters are a self-reinforcing local maximum. They are heavily optimized for each other, but at the cost of innovation and extensibility.<p>For example, we&#x27;ll never get a fully differentiable climate model in Fortran. The tooling does not exist, and there are not enough Fortran developers to make a serious dent in the tooling progress made outside of the HPC world. The MPI stacks these codes rely on are not great for hardware outside of a supercomputer, and Fortran codes basically are built around full interconnect. I have many PFLOPs at my disposal that I cannot use because these codes are too brittle without being entirely rewritten.<p>At the end of the day, everything is a Turing machine, so you can technically do whatever you want in Fortran or any other language (or mix and match), but strategically staying in Fortran leaves a lot of resources on the table.
评论 #26457960 未加载
TheRealKing大约 4 年前
For heavens sake, let&#x27;s stop the discussion of Fortran array index starting at 1. In Fortran the starting index can be anything. A(-10:-5) is valid, A(-10:10) is valid, A(1:10) is valid, A(0:10) is valid. Choose what you want and do not complain about it again, please. No other language has this amazing capability.
tianlong大约 4 年前
These considerations are valid also in another fields such as in computational quantum physics&#x2F;chemistry. Major software are written in Fortan and in C++. I work in the ML community now, after many years of quantum chemistry and when I say that I know Fortran people usually laugh :).
dgellow大约 4 年前
I&#x27;m not familiar at all with the world of high performance scientific computing. Are C++, Rust, Nim, Zig, &amp; co. even remotely considered as potential candidates in the future, or is it really only C and Fortran with no expectation to see much changes? Just curious.
评论 #26458367 未加载
评论 #26456236 未加载
评论 #26456177 未加载
评论 #26458140 未加载
JustSomeNobody大约 4 年前
Because there is absolutely nothing wrong with using Fortran for what Fortran is very good at.
anthk大约 4 年前
BLAS uses Fortran I think, and Lapack.<p>Good luck calling that slow.<p>Another clueless JS hipster, maybe.
评论 #26460528 未加载
person_of_color大约 4 年前
Anyone doing gen-art in Fortran?
crb002大约 4 年前
The tooling is stable so when you link to FORTRAN binaries the ABI tends not to bitrot. IMHO FORTRAN might get a borrow checker before C&#x2F;C++ to be on parity with Rust for memory safety.