Skip to content

Commit

Permalink
move out Distributed from the sysimage (#49258)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored Apr 9, 2023
1 parent 4a3a5f8 commit 5851e15
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Distributed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ include("macros.jl") # @spawn and friends
include("workerpool.jl")
include("pmap.jl")
include("managers.jl") # LocalManager and SSHManager
include("precompile.jl")

function __init__()
init_parallel()
Expand Down
14 changes: 14 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
precompile(Tuple{typeof(Distributed.remotecall),Function,Int,Module,Vararg{Any, 100}})
precompile(Tuple{typeof(Distributed.procs)})
precompile(Tuple{typeof(Distributed.finalize_ref), Distributed.Future})
# This is disabled because it doesn't give much benefit
# and the code in Distributed is poorly typed causing many invalidations
# TODO: Maybe reenable now that Distributed is not in sysimage.
#=
precompile_script *= """
using Distributed
addprocs(2)
pmap(x->iseven(x) ? 1 : 0, 1:4)
@distributed (+) for i = 1:100 Int(rand(Bool)) end
"""
=#
4 changes: 2 additions & 2 deletions test/distributed_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1874,7 +1874,7 @@ let julia = `$(Base.julia_cmd()) --startup-file=no`; mktempdir() do tmp
using Distributed
project = mktempdir()
env = Dict(
"JULIA_LOAD_PATH" => LOAD_PATH[1],
"JULIA_LOAD_PATH" => string(LOAD_PATH[1], $(repr(pathsep)), "@stdlib"),
"JULIA_DEPOT_PATH" => DEPOT_PATH[1],
"TMPDIR" => ENV["TMPDIR"],
)
Expand All @@ -1884,7 +1884,7 @@ let julia = `$(Base.julia_cmd()) --startup-file=no`; mktempdir() do tmp
""" * setupcode * """
for w in workers()
@test remotecall_fetch(depot_path, w) == [DEPOT_PATH[1]]
@test remotecall_fetch(load_path, w) == [LOAD_PATH[1]]
@test remotecall_fetch(load_path, w) == [LOAD_PATH[1], "@stdlib"]
@test remotecall_fetch(active_project, w) == project
@test remotecall_fetch(Base.active_project, w) == joinpath(project, "Project.toml")
end
Expand Down

0 comments on commit 5851e15

Please sign in to comment.