Skip to content

Commit 2294722

Browse files
gbaraldiKristofferC
authored andcommitted
Respect JULIA_CPU_TARGET when doing trimming (#57373)
We could make this have a nicer API but for now lets just do what we've done for pkgimages/sysimages and use the envar (cherry picked from commit 17fff87)
1 parent ef270a4 commit 2294722

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

contrib/juliac.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ module JuliaConfig
66
end
77

88
julia_cmd = `$(Base.julia_cmd()) --startup-file=no --history-file=no`
9+
cpu_target = get(ENV, "JULIA_CPU_TARGET", nothing)
10+
julia_cmd_target = `$(Base.julia_cmd(;cpu_target)) --startup-file=no --history-file=no`
911
output_type = nothing # exe, sharedlib, sysimage
1012
outname = nothing
1113
file = nothing
@@ -102,7 +104,7 @@ end
102104

103105
function compile_products()
104106
# Compile the Julia code
105-
cmd = addenv(`$julia_cmd --project=$(Base.active_project()) --output-o $img_path --output-incremental=no --strip-ir --strip-metadata $julia_args $(joinpath(@__DIR__,"juliac-buildscript.jl")) $absfile $output_type $add_ccallables`, "OPENBLAS_NUM_THREADS" => 1, "JULIA_NUM_THREADS" => 1)
107+
cmd = addenv(`$julia_cmd_target --project=$(Base.active_project()) --output-o $img_path --output-incremental=no --strip-ir --strip-metadata $julia_args $(joinpath(@__DIR__,"juliac-buildscript.jl")) $absfile $output_type $add_ccallables`, "OPENBLAS_NUM_THREADS" => 1, "JULIA_NUM_THREADS" => 1)
106108
verbose && println("Running: $cmd")
107109
if !success(pipeline(cmd; stdout, stderr))
108110
println(stderr, "\nFailed to compile $file")

0 commit comments

Comments
 (0)