Today I had the pleasure of speaking to Prof. Jeff Terry’s computational physics class at IIT today. The topic was software recovery and was focused on my experience resuscitating the Jeppson pipe network analysis codes. I think this is the third or fourth time I’ve spoken to one of his classes and I always enjoy and appreciate the opportunity.
Recovery and revitalization of legacy scientific code can seem like a daunting task – it doesn’t have to be if you use a phased refactoring strategy. Reduce schedule risk by focusing your efforts with a plan not just to reconstitute a working software build, but to revitalize code so it is testable, maintainable, and ready for enhancement. It may take less effort than you think to get control of your legacy scientific code and change it from being viewed as a liability to the asset it is. Download the Jeppson pipe network flow software recovery white paper.
Today I saw a reference to The new features of Fortran 2018 float past on Twitter. The WG5 standards committee has renamed the forthcoming language revision to Fortran 2018 from Fortran 2015 to reflect a more accurate release date. Many of the changes focus on coarrays and distributed computing but there were several useful clarifications of existing features. I was very happy to see that
FORALL, and arithmetic-
IF have finally been marked as obsolescent and are on their way to the dustbin of computing practice. All but
FORALL are leftovers from FORTRAN 77 and earlier. Modern Fortran provides much better and clearer facilities for persistence, aliasing, and dynamic memory management than
EQUIVALENCEand modern control structures make
DO <label> and arithmetic-
IF redundant. Numeric line IDs seem to attract spaghetti logic so I see the slow deprecation of these features as a welcome change to the language to improve code quality, reliability, and maintainability. When refactoring code, I tend to refactor away all four of these constructs anyway but it is heartening to see the standards committee recognize these features are problematic enough to (eventually) remove them from the language
In the case of
FORALL, the construct never worked up to its potential and has since been replaced with
DO CONCURRENTwhich fits more into the
DO <iteration style> syntax model.
FORALL is rarely used because it never reliably performed any better than a conventional loop. My early experience with modern Fortran led me to experiment with
FORALL; finding that it didn’t offer any advantages on any of the compilers I used at the time led me to abandon it, though I really need to look deeper into the coarray model for concurrent execution.
If you have had experience applying coarray features to legacy code, please let me know in the comments or via email (address listed on the contact page). I’m curious what strategies you’ve found to work.
I work in a number of different languages depending on the project. For rapid prototyping I use Jupyter Notebook with Python 2 or 3 which is then converted to standalone code, documents are written in Markdown or LaTeX and compiled to HTML or PDF, Fortran is used for heavy computation, etc. I also revitalize a lot of legacy FORTRAN IV and FORTRAN77 code so I frequently find myself wishing I had the capabilities found in the standard libraries of more modern languages. I also miss certain language-specific development tools which don’t have a Fortran equivalent.
In the previous post, I lamented the lack of a standard library in Fortran and briefly reviewed the contents of the standard libraries for both C and Python. While these languages serve different roles than Fortran, they are popular and mature and I felt they were worth investigating for inspiration. This post covers two topics: first, I present a brief summary of how a hypothetical Fortran Standard Library could be created and adopted (the “Big Picture“), and second I look at the standard libraries of Julia, R, and Ada.
The Big Picture approach I am taking is to:
- describe the problem (lack of a standard library),
- show how other languages address it,
- set high level policies and goals,
- define & implement an achievable initial library,
- have people use it and provide feedback, and,
- iterate over 4 through 6 until the library is stable, adjusting the policies and goals in 3 to ensure the library is implementable, stable, usable, and meets with community approval.
Following this model, we can define high-level capabilities we want in a standard Fortran library and then get into the details of what functions are necessary. In software engineering terms, that means setting requirements and creating design and functional specifications.
One of Fortran’s major drawbacks is its lack of a standard library, a formally defined set of components outside the language core which are supplied along with the compiler. Recent revisions of the Fortran standard have defined several standard modules (ISO_C_BINDING and ISO_FORTRAN_ENV are the two best known) but these do little more than define constants and data types. As of 2017, there are no standard libraries for (say) operating system or filesystem access, string handling, searching and sorting, or networking.
Since Fortran is primarily used for numerical computing, the lack of a standard network library may not be a great disadvantage. However the lack of filesystem tools and text manipulation and parsing tools severely limit the utility of the language.
Before asking what should be in hypothetical Fortran Standard Library, it might be helpful to review what’s in the standard libraries of other languages such as C and Python.
Hot on the heels of registration, we got our EIN, a bank account, a PO box, and a dedicated phone number today. Big updates to the Contact page are another little victory.
It’s all minor administration but each action is yet another small step forward. It all seems unthinkably fast; really happy to see momentum and progress.
I can’t complain too much. TXSoS got back to me with our Certificate of Filing this afternoon so one more major chunk of paperwork has fallen into place. Very proud of this moment; that’ll fade a little as I get bombarded by cold calls and tax nonsense. For the moment though, I’m incredibly happy. Take time to enjoy important moments, even if they’re only automated messages from the Corporations Section of Texas’ Office of the Secretary of State .
All websites are continuously under construction, this one more so.
It’s a big leap into consulting yet not really a big leap at all. Someone still has to balance the books, handle the administrative overhead, find work, do work, ensure staff is trained and engaged and focused, and keep one eye on the future and one on the present. For the past nine years I’ve done some of these tasks; now I get to do all of them.
Truth is, I love the technical work; understanding problems and finding solutions, helping clients make good evidence-based decisions and reducing uncertainty and cost. There’s satisfaction both in solving a one-of-a-kind technical challenge and in automating a complex process, in creating something completely new and in revitalizing systems to extend their capabilities.
Work should be more than punching a clock, chasing TPS reports, or ticking off items on a checklist. It won’t always be easy or fun but overall it should be satisfying. This satisfaction has kept me going for nine years and, with any luck, will keep me going for many more.