Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I suggest that OP drops the attitude that Fortran is something nasty to be endured in high-performance scientific computing and dives into it enthusiastically. If OP retains that rather dismissive mindset then his/her entire Fortran coding career is going to be a struggle. And really, there's nothing you can do with Fortran that you can't do with C++ so why bother if you really don't want to ?</p> <p>There is nothing in OP's list of bullets that a lot of us who have been working with Fortran for the last 30 years haven't been doing (since the widespread availability of Fortran 90 compilers but some of it before then too). Yes, there are computational scientists, and scientific software engineers, who understand pointers, know that a lot of (misguided) people start counting at 0 and that global variables are A BAD THING.</p> <p>Like @MSB I'd recommend Metcalf <em>et al</em>'s book as a source of information on the capabilities and features of modern Fortran. And, like @MSB, I raise an eyebrow at the idea of using C or C++ to wrap libraries for which there are either Fortran equivalents or better approaches entirely. The 2003 standard's interoperability with C features, which are implemented in Intel Fortran, make it easier than ever to call C libraries directly.</p> <p>I'd take issue with OP that having modular code is a goal in its own right. The goals are, I suggest, correct, verifiable and validatable, robust, reliable code. Modularity is one way of supporting the achievement of those goals but it's a tactic, not an end point. If I thought that we could write good (in the foregoing senses) programs comprising 10^6 lines of code without modularity, I wouldn't bother with modularity.</p> <p>OK, now some concrete tips to add to what OP already intends to do or has been told:</p> <ul> <li>use KINDs on variable declarations to enforce the precision you require; don't leave this to compiler options or guesses about what this compiler might do on that processor;</li> <li>use array operations wherever possible rather than explicit loops; this helps to make code safer -- sometimes at the expense of performance but you need to check this on a case-by-case basis;</li> <li>write PURE functions;</li> <li>don't depend on pre-processors or other non-Fortran approaches to code correctness (etc), write your assertions and preconditions (etc) in Fortran; the pre-processors (etc) will not survive as long as well-written Fortran programs and will be a major barrier to portability now and in the future;</li> <li>if you have access to Intel Fortran get access to Intel MKL (and IPP) and use those libraries rather than writing your own code;</li> <li>plan to tackle OpenMP and MPI for parallelisation, they both fit Fortran very well; oh, and plan to go parallel as soon as possible, it's a lot more fun than serial programming;</li> <li>this set of <a href="http://research.metoffice.gov.uk/research/nwp/numerical/fortran90/f90_standards.html" rel="noreferrer">Fortran Coding Standards</a> is a good start, but probably no more than that; the 1st edition of <em>Code Complete</em> had a lot more about Fortran (77) programming than the current edition, but most of its advice can be applied whatever language you write in.</li> </ul> <p>And, finally, these days I think that Fortran programs and programmers are better informed by ideas from functional programming than ideas from object-oriented programming.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload