From 4ea3f3576e90c342c7376c4e77ab298858caae97 Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Tue, 12 Mar 2024 07:25:18 -0400 Subject: [PATCH 1/2] move threads assignment after precompilation (#3840) (cherry picked from commit 4d73d60aa30dbbb82c52c6858fb05789a5c9c65d) --- src/Operations.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Operations.jl b/src/Operations.jl index 21ff8297f5..4d1127ee95 100644 --- a/src/Operations.jl +++ b/src/Operations.jl @@ -1753,7 +1753,6 @@ function gen_subprocess_flags(source_path::String; coverage, julia_args) --inline=$(Bool(Base.JLOptions().can_inline) ? "yes" : "no") --startup-file=$(Base.JLOptions().startupfile == 1 ? "yes" : "no") --track-allocation=$(("none", "user", "all")[Base.JLOptions().malloc_log + 1]) - --threads=$(get_threads_spec()) $(julia_args) ``` end @@ -2054,7 +2053,7 @@ function test(ctx::Context, pkgs::Vector{PackageSpec}; printpkgstyle(ctx.io, :Testing, "Running tests...") flush(ctx.io) code = gen_test_code(source_path; test_args) - cmd = `$(Base.julia_cmd()) $(flags) --eval $code` + cmd = `$(Base.julia_cmd()) $(flags) --threads=$(get_threads_spec()) --eval $code` p, interrupted = subprocess_handler(cmd, ctx, sandbox_ctx, "Tests interrupted. Exiting the test process") if success(p) printpkgstyle(ctx.io, :Testing, pkg.name * " tests passed ") From 2397020228b54be36ba1eedccecde079635357be Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Tue, 12 Mar 2024 07:26:08 -0400 Subject: [PATCH 2/2] precompile: update kwargs (#3838) (cherry picked from commit 6859d68579e7970daf00720901cf487563dca0da) --- src/API.jl | 5 +++-- src/Operations.jl | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/API.jl b/src/API.jl index 88e33204fb..212d2c3de1 100644 --- a/src/API.jl +++ b/src/API.jl @@ -1131,7 +1131,8 @@ end function precompile(ctx::Context, pkgs::Vector{PackageSpec}; internal_call::Bool=false, strict::Bool=false, warn_loaded = true, already_instantiated = false, timing::Bool = false, - _from_loading::Bool=false, flags_cacheflags::Pair{Cmd, Base.CacheFlags}=(``=>Base.CacheFlags()), kwargs...) + _from_loading::Bool=false, configs::Union{Base.Precompilation.Config,Vector{Base.Precompilation.Config}}=(``=>Base.CacheFlags()), + kwargs...) Context!(ctx; kwargs...) if !already_instantiated instantiate(ctx; allow_autoprecomp=false, kwargs...) @@ -1154,7 +1155,7 @@ function precompile(ctx::Context, pkgs::Vector{PackageSpec}; internal_call::Bool activate(dirname(ctx.env.project_file)) do pkgs_name = String[pkg.name for pkg in pkgs] - return Base.Precompilation.precompilepkgs(pkgs_name; internal_call, strict, warn_loaded, timing, _from_loading, flags_cacheflags, io) + return Base.Precompilation.precompilepkgs(pkgs_name; internal_call, strict, warn_loaded, timing, _from_loading, configs, io) end end diff --git a/src/Operations.jl b/src/Operations.jl index 4d1127ee95..7e837c74c8 100644 --- a/src/Operations.jl +++ b/src/Operations.jl @@ -2046,7 +2046,7 @@ function test(ctx::Context, pkgs::Vector{PackageSpec}; if should_autoprecompile() cacheflags = Base.CacheFlags(parse(UInt8, read(`$(Base.julia_cmd()) $(flags) --eval 'show(ccall(:jl_cache_flags, UInt8, ()))'`, String))) Pkg.activate(sandbox_ctx.env.project_file; #=io=devnull=#) do - Pkg.precompile(sandbox_ctx; io=sandbox_ctx.io, flags_cacheflags = flags => cacheflags) + Pkg.precompile(sandbox_ctx; io=sandbox_ctx.io, configs = flags => cacheflags) end end