I recently received a copy of “Numerical Computing with Modern Fortran”, by Richard Hanson and Tim Hopkins, and noted how many books on Fortran are being published recently with “Modern Fortran” in the titles. It turns out this is not a new phenomenon – a search on Amazon.com shows that this phrase has been used for books on Fortran 90 and even Fortran 77! I chatted about this with two of the newer books’ authors, asking why they felt it necessary to qualify Fortran that way. The answer was generally that many programmers’ view of Fortran is stuck in the F77 or even F66 days and that it was helpful to prod them into thinking of Fortran as modern, which of course it is. A side benefit, I guess, is that they can reuse the title when the standard changes!
Anyway, I decided to take this space to list the current set of “modern” books on the market, some of which I have read and some I haven’t. They’re all different and appeal to different audiences and needs.
Numerical Computing with Modern Fortran – Richard J Hanson and Tim Hopkins – SIAM, 2013, ISBN 978-1-611973-1-2
I’ve known Dr. Hanson professionally for a number of years – he was formerly the chief mathematician at Visual Numerics, Inc. (now Rogue Wave Software), developers of the IMSL library. Dr. Hanson was the first customer to ever ask me what Intel’s plans were for coarrays, which at that time was still a proposal for Fortran 2008. When he sent me a copy of his book, I was expecting a text heavy on mathematical formulae, but that’s not what we have here.
The audience Hanson and Hopkins have in mind is the Fortran programmer who is well versed in older versions of the language, but is unfamiliar with Fortran 2003/2008 or isn’t sure how the new features would be beneficial. This is not a reference book nor a “learn Fortran from scratch” text. The authors methodically work their way through sets of features that are new: free-form source, modules, derived types, generic procedures, polymorphism and recursion. Each chapter introduces the concepts in an incremental fashion, showing how they are applicable to things often found in numerical programming.
But there’s more… After a couple of “case study” chapters, Hanson and Hopkins devote chapters to parallelism (OpenMP, MPI and coarrays), the IEEE Floating Point intrinsic modules and C interoperability. Finally there are chapters on cleaning up obsolete code, software testing, compilers and other useful tools.
I liked this book a lot and recommend it to anyone who thinks their Fortran skills are “rusty”. The writing style is very approachable and it’s useful even for those not doing numerical computing.
Modern Fortran in Practice – Arjen Markus – Cambridge University Press, 2012, ISBN 978-1-107-60347-9
I have never met Arjen Markus, but he has been a frequent contributor to the Intel Fortran user forums and we’ve corresponded a lot. His book has a similar approach to that of the Hanson/Hopkins work above in that it assumes you know the fundamentals of at least Fortran 77 and walks you through things that have been added to the language since then. Markus focuses more on practical examples, and covers topics such as memory allocation, C interoperability and takes a useful diversion into adding graphics, GUI and Internet communication to Fortran code. He also spends some time on writing robust code and how to test it properly, topics that are extremely valuable. Markus also has a chapter on parallelism, again covering OpenMP, MPI and coarrays. There’s a lot of good advice in this book.
Modern Fortran – Norman Clerman and Walter Spector – Cambridge University Press, 2012, ISBN 978-0521514538
While I had not met Norm Clerman in person until just a year or two ago, he’s been a customer for perhaps 15 years. His optical modeling program brought out the worst in Digital Visual Fortran, and it took several years of bug fixing before we could even compile his whole program. His code was elegant, but it made heavy use of Fortran 90 modules, public/private attributes, USE renaming and more. Over the years, the number of bug reports dropped and he continued to use the Digital, Compaq and then Intel compilers. Clerman was tickled to hear that we had an entire test suite composed of only his sources.
I have not read Clerman and Spector’s book, but like the others I discuss above it seeks to bring a Fortran programmer up to speed with what the current language offers, with a dose of style recommendations that I am sure are worthwhile.
Modern Fortran Explained – Michael Metcalf, John Reid and Malcolm Cohen, Oxford University Press, 2011, ISBN 978-0199601417
This is the book that most everyone who is learning Fortran has on their desk. I don’t think I’ve met Mike Metcalf, but John Reid and Malcolm Cohen I know well through the Fortran standards committee. Reid is the ISO Fortran Working Group chair and Cohen has been the editor of the standard for many years. Unlike the books above, this is a complete reference for the language and is one of the first places our developers turn when they want to better understand a feature they’re implementing. It’s much more readable than the Fortran standard itself and has lots of explanatory text and examples.
There’s yet another “Modern Fortran” book in the works by Damian Rouson, who currently teaches at Stanford University. I’ve met Damian a few times and we’ve had extended conversations over email and telephone. He already has one book out, Scientific Software Design: The Object-Oriented Way, which can give you a hint as to where his interests lie. This one probably won’t be published until 2015, he tells me.
(Originally posted at Intel Developer Zone, copied with permission)