12 comments

  • thatjoeoverthr10 minutes ago
    I actually had a fantastic experience with Fortran lately. I ported a compute kernel from python&#x2F;numpy to Fortran 2018, partially due to the GIL and partly so I could use Intel&#x27;s compiler. The performance improvement was tremendous. Several times faster per core, then multiplying further because I could take advantage of threading. In all, the 3 day project increased actual throughput 450x.<p>(I considered JAX, but the code in question was not amenable to a compute graph. Another option was to thread by fork, and use IPC.)<p>I liked the language itself more than expected. You have something like &quot;generics&quot; with tensors. Suppose you pass a parameter, N, and you also would like to pass a tensor, and you would like to specify the tensor&#x27;s shape (N, N). You can do this; the parameter type constraints can reference other parameters.<p>Tensors and various operations are first-class types, so the compiler can optimise operations easily for the system you&#x27;re building on. In my case, I got 80% improvement from ifx over gfortran.<p>Invocation from Python was basically the same as a C library. Both Python and Fortran have facilities for C interop, and Numpy can be asked to lay out tensors in a Fortran compatible way.<p>Part of what eased the port was that Numpy seems to be a kind of &quot;Fortran wrapper&quot;. The ergonomics on tensor addressing, slicing and views is identical.
  • atrettel1 hour ago
    The article did not discuss this, but to me, one of the bigger differences between Fortran and more modern languages is the difference between functions and subroutines. Yes, they are not synonyms in Fortran and serve different purposes. I think this would trip up more people initially than the clunky syntax.<p>It is also a bit funny that the author complains about older Fortran programs requiring SCREAMING_CASE, when if anything this is an improvement over previous and current practices. Too many Fortran codes have overly terse variable names that often were just single characters or impenetrable abbreviations for obscure terms. I have had to create cheat sheets for each program to figure out what each variable was.<p>Sun Microsystems had a great quote about this back in the day [1]:<p>&gt; Consistently separating words by spaces became a general custom about the tenth century A.D., and lasted until about 1957, when FORTRAN 77 abandoned the practice.<p>[1] <a href="https:&#x2F;&#x2F;docs.oracle.com&#x2F;cd&#x2F;E19957-01&#x2F;802-2998&#x2F;802-2998.pdf" rel="nofollow">https:&#x2F;&#x2F;docs.oracle.com&#x2F;cd&#x2F;E19957-01&#x2F;802-2998&#x2F;802-2998.pdf</a>
    • pklausler1 hour ago
      Spaces don&#x27;t matter in fixed-form Fortran source files, so I don&#x27;t get that at all. And case doesn&#x27;t matter in either source form.
      • atrettel8 minutes ago
        Yes, sorry for the confusion. To be clear, the quote is directly about spaces not being significant in the source code in general, but I was commenting more about how this mindset affects variable names in practice. At least in my experience, many codes would benefit from variables names that use underscores.
  • jleyank1 hour ago
    If you&#x27;re interested in safer code when working with older versions of Fortran, add &#x27;implicit none&#x27; at the top. This will eliminate the integer vs. float automatic assignment and make variable definition much tighter. Back when I mucked about with Fortran (previous century really), we tried to do the memory allocation and I&#x2F;O in C and the compute in Fortran. That would play well with both superscalar and vector machines.
    • layer824 minutes ago
      You didn’t read the article?
      • jleyank17 minutes ago
        All of it, no. But I never used Fortran 90 yet used implicit none. Might have been an extension from SGI or a mini super but I recall using it.
  • 555562444 minutes ago
    This makes me feel old. I learned Fortran on the Dartmouth Time-Sharing System back in 1980. While I think of Fortran now and again and think about re-learning, I haven&#x27;t thought of DTSS in years.
  • Hizonner25 minutes ago
    I&#x27;m not sure one line of that would compile in FORTRAN 66, even if you indented it properly. Been so long I&#x27;m not sure...
  • vzaliva1 hour ago
    This is an excellent idea. But I wold go with Fortran 4 if you looking at authenticity.
  • aj756 minutes ago
    Arrays that actually make sense!
  • dizzant5 hours ago
    &gt; a quick introduction to a few modern Fortran features: declaring variables, printing and reading to and from the terminal, if and select case, and stop<p>Pretty much sums up this one. Can&#x27;t say that I agree if&#x2F;select&#x2F;stop are &quot;modern&quot; features.
  • self_awareness38 minutes ago
    Why not COBOL?
    • layer821 minutes ago
      Plankalkül or bust.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Plankalk%C3%BCl" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Plankalk%C3%BCl</a>
    • kps35 minutes ago
      COBOL is some five years newer than Fortran. You could try FLOW-MATIC.
  • turing_complete5 hours ago
    I was expecting Plankalkül: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Plankalk%C3%BCl" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Plankalk%C3%BCl</a>
  • ginko5 hours ago
    I expected this to be about Plankalkül or something devised by Babbage.
    • riskassessment49 minutes ago
      I was expecting a system like Leibniz notation, Boolean Algebra, Begriffsschrift, or the notation system in Principia Mathematica