Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Precompilation breaks for non-native target #102

Open
nlw0 opened this issue Jun 6, 2023 · 1 comment
Open

Precompilation breaks for non-native target #102

nlw0 opened this issue Jun 6, 2023 · 1 comment

Comments

@nlw0
Copy link

nlw0 commented Jun 6, 2023

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
...
@chriselrod
Copy link
Member

PRs that fixes this would be welcome.
You could look into using Preferences in CPUsummary and especially HostCPUFeatures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants