Cxx.jl icon indicating copy to clipboard operation
Cxx.jl copied to clipboard

Add env variable JULIA_CXX_CPU to explicitly set LLVM CPU

Open oschulz opened this issue 6 years ago • 2 comments

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.

oschulz avatar May 08 '18 08:05 oschulz

Gentle bump.

oschulz avatar Jun 19 '18 19:06 oschulz

Hi @oschulz, do you still want this? Please let me know if there is anything I can help with.

Gnimuc avatar Dec 29 '19 07:12 Gnimuc