I learned in my HPC class that for languages such as C/C++ and Fortran, invoking automatic compiler optimizations using the (gcc
) -On
flag could lead to unintended behaviors when compiling multithreaded programs; something along the lines of
The compiler will automatically optimize out a piece of code that would be unnecessary or sub-optimal for a single-threaded program, but necessary for multithreaded programs.
I really haven’t seen anything on the usage of Julia’s automatic compiler optimizations, but I’m curious how Julia’s JIT (or PackageCompiler.jl
’s AOT) compilation process handles multithreaded programs compared to the others. If I didn’t know any better, I’d just assume it’s the same, but since Julia is created from the ground up with parallelism in mind, I assume it’s better tailored? Or are these things handled by the underlying LLVM and less customizable?
The only resources I could find is from the dev/JIT docs and this Discourse post from 2020.