docker-library / julia

Docker Official Image packaging for julia

Home Page:http://julialang.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

set `JULIA_CPU_TARGET` to avoid compilation overhead

BioTurboNick opened this issue · comments

If someone wishes to use this container and pre-load packages for their own, they may find that every time they run the container remotely, Julia spends time compiling before anything can happen.

This is because on an individual system Julia will just compile code for that specific architecture. A remote system with a slightly different architecture will trigger re-compilation.

To make the compilation that happens during container building stick, the JULIA_CPU_TARGET environment variable needs to be set to the generic string that is used to build Julia in the first place:

ENV JULIA_CPU_TARGET generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)

See: https://docs.julialang.org/en/v1/devdocs/sysimg/#Specifying-multiple-system-image-targets

Oh, that's really interesting, thanks for the useful links!

My biggest question here is whether this is something we should be setting to something sanely generic by default, or whether this is something we should instead document for users to choose for themselves?

(I imagine the default behavior wasn't chosen arbitrarily, but probably also wasn't chosen for the use case of sharing the built results like Docker images enable/encourage. 😅)