VectorizationBase.jl
VectorizationBase.jl copied to clipboard
Precompilation breaks for non-native target
Hi. I'm trying to do something weird, not really sure how it works, but it seems this package is the only one where an issue appears, so I'm hoping I might at least learn a bit more about how things work.
I have a Julia application that runs in the cloud. My local development machine is not the exact same Sys.CUP_NAME as the remote machine. I believe that as a result, even thought I have my app pre-compiled in a Docker container, it needs to be pre-compiled again when it gets deployed.
I was hoping that setting julia -C core-avx2 or something like that might allow me to easily circumvent the issue. When I try doing that, though, I run into this error during pre-compilation. Is there any work around that, or is it not really reasonable?
ERROR: LoadError: InitError: Evaluation into the closed module `HostCPUFeatures` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `HostCPUFeatures` with `eval` during precompilation - don't do this.
Stacktrace:
[1] eval
@ ./boot.jl:370 [inlined]
[2] setfeaturefalse(s::Symbol)
@ HostCPUFeatures ~/.julia/packages/HostCPUFeatures/9sAqs/src/cpu_info_x86.jl:36
[3] make_generic(target::String)
@ HostCPUFeatures ~/.julia/packages/HostCPUFeatures/9sAqs/src/cpu_info_x86.jl:73
[4] __init__()
@ HostCPUFeatures ~/.julia/packages/HostCPUFeatures/9sAqs/src/HostCPUFeatures.jl:45
[5] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1074
[6] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
@ Base ./loading.jl:1020
[7] _tryrequire_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String)
@ Base ./loading.jl:1407
[8] _require(pkg::Base.PkgId, env::String)
@ Base ./loading.jl:1781
[9] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base ./loading.jl:1625
[10] macro expansion
@ ./loading.jl:1613 [inlined]
[11] macro expansion
@ ./lock.jl:267 [inlined]
[12] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1576
[13] include
@ ./Base.jl:457 [inlined]
[14] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)
@ Base ./loading.jl:2010
[15] top-level scope
@ stdin:2
during initialization of module HostCPUFeatures
in expression starting at /home/user/.julia/packages/VectorizationBase/e4FnQ/src/VectorizationBase.jl:1
in expression starting at stdin:2
ERROR: LoadError: Failed to precompile VectorizationBase [3d5dd08c-fd9d-11e8-17fa-ed2836048c2f] to "/home/user/.julia/compiled/v1.9/VectorizationBase/jl_JLOYjx".
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base ./loading.jl:2260
[3] compilecache
@ ./loading.jl:2127 [inlined]
[4] _require(pkg::Base.PkgId, env::String)
@ Base ./loading.jl:1770
[5] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base ./loading.jl:1625
[6] macro expansion
@ ./loading.jl:1613 [inlined]
[7] macro expansion
@ ./lock.jl:267 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1576
[9] include
@ ./Base.jl:457 [inlined]
[10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)
@ Base ./loading.jl:2010
[11] top-level scope
@ stdin:2
in expression starting at /home/user/.julia/packages/LoopVectorization/DDH6Z/src/LoopVectorization.jl:1
in expression starting at stdin:2
ERROR: LoadError: Failed to precompile LoopVectorization [bdcacae8-1622-11e9-2a5c-532679323890] to "/home/user/.julia/compiled/v1.9/LoopVectorization/jl_gmjndJ".
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
...
PRs that fixes this would be welcome. You could look into using Preferences in CPUsummary and especially HostCPUFeatures.