Fortran And WebAssembly: Bringing Zippy Linear Algebra To NodeJS & Browsers

With the rise of WebAssembly (wasm) it’s become easier than ever to run native code in a browser. As mostly just another platform to target, it would be remiss if Fortran was not a part of this effort, which is why a number of projects have sought to get Fortran supported on wasm.

For the ‘why’, [George Stagg] makes the point that software packages like BLAS and LAPACK for Fortran are still great for scientific computing, while the ‘how’ is a bit more hairy, but getting better courtesy of the still-in-development LLVM front-end for Fortran (flang-new). Using it for wasm is not straightforward yet, due to the lack of a wasm32 target, but as [George] demonstrates, this is easily patched around.

We reported on Fortran and wasm back in 2016, with things having changed somewhat in the intervening eight years (yes, that long). The Fortran-to-C translator utility (f2c) is effectively EOL, while LFortran is coming along but still missing many features. The Dragonegg GCC-frontend-for-LLVM project was the best shot in 2020 for Fortran and WebAssembly, but obsolete now. Classic Flang has been in LLVM for a while, but is to be replaced with what is now called flang-new. The wish by [George] is now to find a way to get his patched flang-new code for wasm support into the project.

In the article, the diff for patching the flang-new toolchain to target wasm is provided. During compilation of the standard Fortran runtime it was then found that the flang-new code assumes that target system sizeof() results are identical to those of the host system, which of course falls flat for wasm32. One more patch (or hardcoded hack, rather) later the ‘Hello World’ example in Fortran was up and running, clearing the way to build the BLAS (Basic Linear Algebra Subprograms) and LAPACK (Linear Algebra Package) libraries and create a few example projects in Fortran-for-wasm32 which uses them.

The advantage of being able to use extremely well-optimized software packages like these when limited to a browser environment should be obvious, in addition to the benefit of using existing codebases. It is certainly [George]’s hope that flang-new will soon officially support wasm (32 and 64-bit) as targets, and he actively seeks help with making this a reality.

Looking At Fortran In 100 Seconds

Usually, when we are talking about old computers, we are thinking of BASIC interpreters. But [Fireship] reminds us that it was originally Fortran and promises to give you the essentials in 100 seconds. We didn’t think you could do much in that short amount of time, but we have to admit that they did a pretty good job.

Of course, it doesn’t hurt that we know Fortran — you probably aren’t going to be able to put it on your resume after watching this video. On the other hand, we were impressed with how much they did squeeze in. If you haven’t touched Fortran since the 1960s and 1970s, you should know that it has changed. Pointers, dynamic memory allocation, and even objects are all possible. It is still a very capable language and very adept at crunching large sets of numbers. Besides, there are many sophisticated algorithms you can borrow from decades of Fortran development.

If you decide you want to have a go, there is, of course, GNU Fortran. Honestly, as much time as we spent writing Fortran in years past, we don’t recommend it for new job prospects. But if you have some period hardware and want an authentic experience, it might just be the way to go. Or, just fire up a browser if you want to play.

Not everyone agrees, though, that Fortran is on the wane. There are efforts to bring it even more up to date. You can even use it for web development.

Continue reading “Looking At Fortran In 100 Seconds”

Frances Allen Optimised Your Code Without You Even Knowing

In 2020, our digital world and the software we use to create it are a towering structure, built upon countless layers of abstraction and building blocks — just think about all the translations and interactions that occur from loading a webpage. Whilst abstraction is undoubtedly a great thing, it only works if we’re building on solid ground; if the lower levels are stable and fast. What does that mean in practice? It means low-level, compiled languages, which can be heavily optimised and leveraged to make the most of computer hardware. One of the giants in this area was Frances Allen, who recently passed away in early August. Described by IBM as “a pioneer in compiler organization and optimization algorithms,” she made numerous significant contributions to the field. Continue reading “Frances Allen Optimised Your Code Without You Even Knowing”

Tony Brooker And Autocode – The First High-level Language

The field of computer science has undeniably changed the world for virtually every single person by now. Certainly for you as Hackaday reader, but also for everyone around you, whether they’re working in the field themselves, or are simply enjoying the fruits of convenience it bears. What was once a highly specialized niche field for a few chosen people has since grown into a discipline that not only created one of the biggest industry in modern times, but also revolutionized every other industry, some a few times over.

The fascinating part about all this is the relatively short time span it took to get here, and with that the privilege to live in an era where some of the pioneers and innovators, the proverbial giants whose shoulders every one of us is standing on, are still among us. Sadly, one of them, [Tony Brooker], a pioneer of the early programming language concept known as Autocode, passed away in November. Reaching the remarkable age of 94, the truly sad part however is that this might be the first time you hear his name, and there’s a fair chance you never heard of Autocode either.

But Autocode was probably the first high-level computer language, and as such played a fundamental role in the development of whatever you’re coding in today. So to honor the memory of [Tony Brooker], let’s remember the work he did with Autocode, and the leap in computer science history that it represented.

Continue reading “Tony Brooker And Autocode – The First High-level Language”

Fortran Goes Interactive

When you think of Fortran you probably think of punched cards and green bar paper. While it is true that Fortran isn’t the go-to language it used to be — pun unintentional — it still has a vibrant community of people who do serious number crunching. However, many members of that community have been seduced away by interactive tools that are also good at number crunching like MATLAB, Julian, and Python with special libraries. The LFortran project aims to create a Fortran environment with interactivity like Python, but retaining the speed that Fortran is known for.

The resulting tool is impressive. You can use it from Jupyter, can parse code targeting existing Fortran compilers, and supports Linux, Mac, and Windows. There is development to make the code fully interoperable with other languages like C or Python as well as take advantage of GPUs and other specialized hardware. They are also zeroing in on full Fortran 2018 support.

Continue reading “Fortran Goes Interactive”

Beatrice Tinsley And The Evolution Of Galaxies

It seems almost absurd now, but cosmologists once assumed that galaxies of a given type were all the same and didn’t change. Because of this assumption, galaxies were used as a redshift or light-based yardstick to measure distances in the universe. But what if some galaxies were intrinsically redder than others? Little to no thought was given to their origins, compositions, or evolution until Beatrice Tinsley came along.

Beatrice saw galaxies as changing bodies of stars. She believed that they grew, evolved, and died because they’re made of stars, and that’s what their star populations did. To lump all galaxies together and use them as a standard candle was an oversimplification. Beatrice created the first computer model of a galaxy to prove her point and in doing so, she founded the field of galaxy evolution.

If you’ve never heard of Beatrice, don’t feel bad. Just as her career was really beginning to take off, she developed cancer and died shortly after her 40th birthday. Though her life was short, her influence on cosmology is long-reaching. Continue reading “Beatrice Tinsley And The Evolution Of Galaxies”


There’s an old saying: “I don’t know what programming language scientists and engineers will use in the 22nd century, but I know it will be called FORTRAN.” FORTRAN was among the first real programming languages and, along with LISP, one of the oldest still in common use. If you are one of those that still loves FORTRAN, you no longer have to be left out of the Web development craze thanks to

Naturally, the site is served by — what else — FORTRAN. The system allows for Jade templates, SQLite databases, and other features aimed at serving up web pages. The code is hosted on GitHub, and you can find several examples there, as well.

If you’ve ever wanted to do formatted I/O to a web page, here’s your chance. Come to think of it, why not? We’ve seen servers in BASIC¬†and even in Linux shell script. Of course, today’s FORTRAN isn’t the one we learned back in the 1970’s (we assume if you didn’t learn about FORTRAN in the 1970’s, you quit reading this post a while back… prove us wrong and show us your FORTRAN projects).