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

Does not respect JULIA_CPU_TARGET #15

Open
jakobnissen opened this issue Jul 1, 2023 · 5 comments
Open

Does not respect JULIA_CPU_TARGET #15

jakobnissen opened this issue Jul 1, 2023 · 5 comments

Comments

@jakobnissen
Copy link

MWE:

$ export JULIA_CPU_TARGET=generic
$ julia --startup-file=no -q

julia> using HostCPUFeatures

julia> has_feature(Val{:x86_64_avx2}())
static(true)

This cause issues during precompilation with pkgimages on Julia 1.9, e.g. BioJulia/FASTX.jl#101.

Without knowing many of the details, I think this should be relatively easy to fix. Setting JULIA_CPU_FEATURES forces precompilation of all packages, so HostCPUFeatures can simply check at precompile time if the env variable is set, and then adjust its compile time results accordingly.

@chriselrod
Copy link
Member

target = Base.unsafe_string(Base.JLOptions().cpu_target)
occursin("native", target) || return make_generic(target)

Is where it is supposed to check for this.

@jakobnissen
Copy link
Author

This does not work, because:

$ export JULIA_CPU_TARGET=generic
$ julia --startup-file=no -q --project=.
julia> Base.unsafe_string(Base.JLOptions().cpu_target)
"native"

In other words, even though the pkgimages respect the env var JULIA_CPU_TARGET, it is not reflected in Base.JLOptions()

@jakobnissen
Copy link
Author

@chriselrod
Copy link
Member

Ah, okay, that makes sense. Want to prepare a PR?
Having it simply fallback to generic is probably fine.

Long term, of course, the plan is to drop this from the ecosystem because it does not integrate well.

@jakobnissen
Copy link
Author

I'll give it a go!

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