Why use Julia to build an Earth System Model?

Thanks for starting this thread! Definitely agree that it would be good for this discussion to not get swallowed up by Slack.


Just some personal thoughts for why Julia > C/C++/Fortran/Python from using Julia for the past ~2 years for HPC climate work (mostly Oceananigans.jl development which is separate from ClimateMachine.jl but still under the CliMA project):

  1. Pure Julia loop-based code can be fast, easy-to-read, and executes readily on CPUs (multithreaded) and GPUs with KernelAbstractions.jl and CUDA.jl. Possible counter-example could be Python + Numba but I think to get maximum efficiency you still need to write some low-level code in C/Cython?
  2. Pure Julia code means you can interface with a rapidly-growing scientific machine learning software stack: Flux.jl for machine learning, DifferentialEquations.jl for time stepping and sensitivity analysis, Turing.jl for Bayesian inference and uncertainty quantification, etc. and they work well together so Flux.jl + DifferentialEquations.jl = neural differential equations can be trained and embedded in your Julia Earth system model.
  3. Julia is functional so you can pass around functions, use them to specify boundary conditions, forcing functions, etc. which makes scripts look more like math and easier to read. Similar setups in Fortran + namelists can be quite painful: e.g. generate arrays in MATLAB/Python, dump binary data, tell Fortran model to read binary file via namelist.
  4. Script-based approach to simulation setup allows for very flexible setups that would either be very complicated to setup with Fortran models + namelist files. This is more a criticism of rigid namelist files though.
  5. It seems to be much easier to engage and excite new users and contributors with Julia as opposed to Fortran and C/C++. New young students and postdocs seem more likely to learn and use high-level languages like Julia/Python rather than C/C++/Fortran.
  6. Some C/C++/Fortran models are a complete pain to set up and compile, which can be a high barrier for new users. Julia + CUDA + MPI setup hasn’t failed on me yet (it’s really plug and play) and it’s getting better (e.g. CUDA.jl now downloads and installs the CUDA library for you).
  7. Development in Julia (or really any high-level language) feels faster since the code is concise. Once I was familiar with Julia and we had a barebones model up and running, adding new features was quick.
9 Likes