Skip to content

Commit

Permalink
set number of openblas threads to 1 while precompiling
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Sep 16, 2022
1 parent 35191ad commit 76b5914
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1683,21 +1683,23 @@ function create_expr_cache(pkg::PkgId, input::String, output::String, concrete_d
end
deps_eltype = sprint(show, eltype(concrete_deps); context = :module=>nothing)
deps = deps_eltype * "[" * join(deps_strs, ",") * "]"
trace = isassigned(PRECOMPILE_TRACE_COMPILE) ? `--trace-compile=$(PRECOMPILE_TRACE_COMPILE[])` : ``
io = open(pipeline(`$(julia_cmd()::Cmd) -O0
--output-ji $output --output-incremental=yes
--startup-file=no --history-file=no --warn-overwrite=yes
--color=$(have_color === nothing ? "auto" : have_color ? "yes" : "no")
$trace
-`, stderr = internal_stderr, stdout = internal_stdout),
"w", stdout)
# write data over stdin to avoid the (unlikely) case of exceeding max command line size
write(io.in, """
Base.include_package_for_output($(pkg_str(pkg)), $(repr(abspath(input))), $(repr(depot_path)), $(repr(dl_load_path)),
withenv("OPENBLAS_NUM_THREADS" => 1) do
trace = isassigned(PRECOMPILE_TRACE_COMPILE) ? `--trace-compile=$(PRECOMPILE_TRACE_COMPILE[])` : ``
io = open(pipeline(`$(julia_cmd()::Cmd) -O0
--output-ji $output --output-incremental=yes
--startup-file=no --history-file=no --warn-overwrite=yes
--color=$(have_color === nothing ? "auto" : have_color ? "yes" : "no")
$trace
-`, stderr = internal_stderr, stdout = internal_stdout),
"w", stdout)
# write data over stdin to avoid the (unlikely) case of exceeding max command line size
write(io.in, """
@time Base.include_package_for_output($(pkg_str(pkg)), $(repr(abspath(input))), $(repr(depot_path)), $(repr(dl_load_path)),
$(repr(load_path)), $deps, $(repr(source_path(nothing))))
""")
close(io.in)
return io
""")
close(io.in)
return io
end
end

function compilecache_dir(pkg::PkgId)
Expand Down

0 comments on commit 76b5914

Please sign in to comment.