[Beowulf] Fortran is Awesome
Gus Correa
gus at ldeo.columbia.edu
Thu Nov 29 12:04:33 PST 2018
On Thu, Nov 29, 2018 at 10:52 AM mark somers <m.somers at chem.leidenuniv.nl>
wrote:
> Try this:
>
>
>
>
> program test
> implicit none
>
> real, dimension(2,2,2,2,2,2,2,2,2,2,2,2,2) :: Array1
>
Hmmm ... with rank > 7?
My recollection is that 7 is the maximum (at least up to Fortran 95, maybe
2003, not sure afterwards).
But there are relatively simple workarounds using one-dimensional arrays
and index arithmetic,
to get as many dimensions as one needs.
Keeping arrays in contiguous memory is a good thing, and Fortran compilers
normally do this.
Since Fortran90, the "Matlab-like" notation for array sections, etc, the
'where' command,
allocatable arrays, etc, simplified and made array computations very
efficient (obviating nested loops, etc),
and (array) dynamic memory allocation very easy.
Modules made code organization much cleaner.
For the O-O afficcionados, operator and procedure overlays, structures,
interfaces, etc.
The features abound, most are simple to use.
I still miss a good Fortran90-to-2008 book, where the features come to life
in clean examples.
Metcalf's book is OK to learn legal syntax, but it is terse and very poor
in practical examples.
Here we do Earth Sciences: lots of Fortran code in
Atmospheric/Ocean/Climate, Seismology, Geodynamics,
etc, many codes in public domain, many being currently developed and
expanded -
code that is not going away any time soon.
I'd guess the Astrophysics, Computational Chemistry, Fluid Dynamics,
Structural Mechanics,
Electrical Engineering, etc, are in similar situation,
inheriting a huge mostly high quality Fortran code base.
Students unfortunately have been evangelized to put all their eggs in the
Python's nest,
often times narrowed to Jupyter Notebooks (with religious blind faith on
it), conda/anaconda, and so on.
Nothing agains Python; all against narrow thinking that puts fashion ahead
of content.
Students used to be fluent in Matlab (/Octave) up to a few years ago, which
enabled them to pick up Fortran more
easily. That's no longer so.
However, they would benefit a lot of a basic knowledge of Fortran, along
with
basic elements of data structures, structured programming -
sounds old? still very useful, and sorely missed -
rudiments of O-O programming, and insights of good programming style.
That all can be bundled in a Numerical Analysis/Numerical Modeling type of
course, as it was already mentioned.
Minimally this would make them able to read, understand, modify, and verify
the codes they may use for their
entire careers.
> Array1 = 0.0
>
> print *, "hello world", Array1
>
> stop
>
> end program test
>
>
> --
> mark somers
> tel: +31715274437
> mail: m.somers at chem.leidenuniv.nl
> web: https://www.universiteitleiden.nl/en/staffmembers/mark-somers
> _______________________________________________
> Beowulf mailing list, Beowulf at beowulf.org sponsored by Penguin Computing
> To change your subscription (digest mode or unsubscribe) visit
> http://www.beowulf.org/mailman/listinfo/beowulf
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.beowulf.org/pipermail/beowulf/attachments/20181129/76b669ec/attachment.html>
More information about the Beowulf
mailing list