« All posts

Differentiable Fortran Applications with LFortran and Enzyme

Exploring methods for automatic differentiation from Fortran simulation code using LFortran and Enzyme.

It is now possible to backpropagate through Fortran, C, or C++ simulation code, integrating it into JAX and PyTorch as a high-performance differentiable physics engine. Enzyme enables automatic differentiation at the LLVM IR level, allowing gradients to be derived from existing source code without rewriting legacy physics simulations. This method provides a critical solution for optimizing nonlinear systems without the need for extensive rewrites.