Add env variable JULIA_CXX_CPU to explicitly set LLVM CPU #380
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, precompilation of Cxx.jl results in a PCH-file compiled for the CPU on the current host. This poses a serious problem in environments with multiple CPU types, but shared files (e.g. using different hosts with an NFS home directory). For example, if Cxx.jl is precompiled on a Broadwell CPU, it won't run when logging in to a host with a Skylake CPU, and vice-versa.
I frequently find myself running into this problem, both when switching between workstations of different age, and when running on a compute cluster with two partitions of different CPU type. A workaround is to delete the "Cxx.ji" file every time, but that's not really a viable long-term solution.
A similar problematic situations are read-only software container images with baked-in precompiled Julia packages (we use Singularity containers, a lot).
This PR introduces a new enviroment variable JULIA_CXX_CPU that allows the user to specify the CPU type to be used by Cxx.jl. For example,
export JULIA_CXX_CPU="corei7-avx"
will allow a shared Cxx.jl installation to be used on a wide range of current (and slightly older) systems.