What is the advantage of Julia over Fortran?

There are two sides on where Julia has advantages over other languages, as I see it.

From the programmer’s perspective:

  • Speed benefit - fairly obvious in comparison with interpreted languages, but IMO Julia can be “faster than C”. The speed advantage over C/C++/Fortran comes not necessarily from more efficient machine code for 1:1 translated programs but because high-level languages make it easier to explore alternative, potentially more efficient, computational approaches.
  • Consistency of ecosystem. I don’t know the situation in Fortran, but in C++ there’s a multitude of linear algebra libraries, each with its own data types and interfaces. In Julia, unified array interface makes it much easier to write programs which work with any implementation.
  • JIT and autodifferentiation enabled by it. Might not be a big deal for many, but at some point you might need to find the pressure in a fluid described by PC-SAFT equation of state, and it’s so much more convenient to just use autodiff to get the Helmholtz energy derivative than to deal with it by hand.
  • Type system and dispatch.

From user’s perspective (or why would users care about a language used for software they use)

The use of numerical software in academia today requires creative approaches, as all “simple” problems are already solved. For that, it’d be good to have a way to hook inside the computational process. That is true for simulations, at least, where I as user would like more tools to make steered simulations. If you look at LAMMPS molecular dynamics package, you see that the scripts that define simulations are written in a custom mini-language with conditionals, variables, ability to execute shell scripts. That evolved from initially a simple configuration file structure which only had lines of the form

[option name] [parameters]

HOOMD-Blue developers chose to use Python for simulation control from the start. Interfacing with Python allows users to add arbitrary control elements to the simulation (so they may publish faster :grinning_face_with_smiling_eyes:). But parts written in Python would be slower than the core written in C++ with the emphasis on GPU support. An MD package written in Julia could potentially make user-defined hooks first-class (while still being written in a high-level language). So, I think Julia may gain some popularity in that field if some group writes a reasonably-featured and reasonably-performant simulation package.

11 Likes