Fortran for Researchers
Aims
Sign up
This course is being run again on the 25th of September 2023.
If you want to attend this course for SkillsForge credit then please sign up for course RSE/7 on SkillsForge. Otherwise, please fill in this form.
Session Details for 25th September 2023
If you are signed up you should have now (19/9/23) received an email with details of when and where this course will run. Please contact us if you have not.
If you are attending remotely, or want to review the live stream, here is the link again: https://youtube.com/live/GXRmEnbiafcLink opens in a new window
Slides
Part 1 - Fortran BasicsLink opens in a new window
Part 2 - ArraysLink opens in a new window
Part 3 - Last EssentialsLink opens in a new window
Part 4 - Other Parts of FortranLink opens in a new window This briefly covers almost all the rest of Fortran you might want to use. We don't talk through this, but we do demonstrate it all in the Model codes linked below.
Example Code
All of the example code from the slides, and suggestions and model solutions for programs from Hello World up to almost useful codes are available on Github here.
Other Useful Links and Material
Documentation Tools
HereLink opens in a new window is our Github repo demonstrating how to use the Doxygen documentation tool to make good Fortran docs.
Books Etc
Some "cheatsheet" summaries of the fiddlier parts of Fortran are here along with a description of "Old" (pre 90) Fortran, which you might still come across "in the wild".
Our recommended book for Fortran is Introduction to programming with Fortran : with coverage of Fortran 90, 95, 2003, 2008 and 77 by Ian D. Chivers, Jane Sleightholme. You can find the Springer e-Book in the library (ISBN 9783319177014).
This is a really nice "self-study" guide to Fortran 95 (reproduced w. thanks to Dr Padman)
Online Resources
Doctor Fortran - Steve Lionel worked on Intel's Fortran compiler team for years, and knows Fortran as well as anybody possibly can. He has a series of blog posts, and pops up on Stack Overflow, Intel's developer zone and elsewhere.
Learn X in Y minutes is a handy site for just the syntax and ideas of a new language. Written like a program listing, these go through the basics. They can be a bit intense in a language you've never seen before though.
Rosetta Code is an attempt to compile lots of people's approaches in lots of languages. BEWARE though - nobody reviews these for style. They mostly work as expected, but can suffer from being too clever by half, especially in Fortran, in which you also have to watch out for FORTRAN77 and what are now "bad habits" engrained by it.
The Computer Language Benchmark game has some good examples of how the Fortran you would write as your first solution can actually be almost optimally performant already. In particular, the Fortran examples tend to be much simpler than the hand-optimised C, while getting 90% or more of the performance in the numerical problems. The String problems do not suit Fortran and for some reason the Binary Trees problem also works poorly (possibly the recursion is troublesome?).
Videos
We have some videos on a few of the fiddlier bits of Fortran:
Creating a module, step by step
The Application Binary Interface. Can compilers talk to each other? What about languages? How?
What interfaces are and why they're used
Reading the Fortran Standard document - what does x = func1() * func2() do?