• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JuliaLang / julia / #37515

pending completion
#37515

push

local

web-flow
Add ITTAPI timing functions to JL_TIMING (#49448)

71142 of 83024 relevant lines covered (85.69%)

33956574.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.12
/stdlib/Distributed/src/Distributed.jl
1
# This file is a part of Julia. License is MIT: https://julialang.org/license
2

3
"""
4
Tools for distributed parallel processing.
5
"""
6
module Distributed
30✔
7

8
# imports for extension
9
import Base: getindex, wait, put!, take!, fetch, isready, push!, length,
10
             hash, ==, kill, close, isopen, showerror, iterate, IteratorSize
11

12
# imports for use
13
using Base: Process, Semaphore, JLOptions, buffer_writes, @async_unwrap,
14
            VERSION_STRING, binding_module, atexit, julia_exename,
15
            julia_cmd, AsyncGenerator, acquire, release, invokelatest,
16
            shell_escape_posixly, shell_escape_csh,
17
            shell_escape_wincmd, escape_microsoft_c_args,
18
            uv_error, something, notnothing, isbuffered, mapany
19
using Base.Threads: Event
20

21
using Serialization, Sockets
22
import Serialization: serialize, deserialize
23
import Sockets: connect, wait_connected
24

25
# NOTE: clusterserialize.jl imports additional symbols from Serialization for use
26

27
export
28
    @spawn,
29
    @spawnat,
30
    @fetch,
31
    @fetchfrom,
32
    @everywhere,
33
    @distributed,
34

35
    AbstractWorkerPool,
36
    addprocs,
37
    CachingPool,
38
    clear!,
39
    ClusterManager,
40
    default_worker_pool,
41
    init_worker,
42
    interrupt,
43
    launch,
44
    manage,
45
    myid,
46
    nprocs,
47
    nworkers,
48
    pmap,
49
    procs,
50
    remote,
51
    remotecall,
52
    remotecall_fetch,
53
    remotecall_wait,
54
    remote_do,
55
    rmprocs,
56
    workers,
57
    WorkerPool,
58
    RemoteChannel,
59
    Future,
60
    WorkerConfig,
61
    RemoteException,
62
    ProcessExitedException,
63

64
    process_messages,
65
    remoteref_id,
66
    channel_from_id,
67
    worker_id_from_socket,
68
    cluster_cookie,
69
    start_worker,
70

71
# Used only by shared arrays.
72
    check_same_host
73

74
function _require_callback(mod::Base.PkgId)
179✔
75
    if Base.toplevel_load[] && myid() == 1 && nprocs() > 1
179✔
76
        # broadcast top-level (e.g. from Main) import/using from node 1 (only)
77
        @sync for p in procs()
12✔
78
            p == 1 && continue
27✔
79
            # Extensions are already loaded on workers by their triggers being loaded
80
            # so no need to fire the callback upon extension being loaded on master.
81
            Base.loading_extension && continue
15✔
82
            @async_unwrap remotecall_wait(p) do
14✔
83
                Base.require(mod)
14✔
84
                nothing
14✔
85
            end
86
        end
×
87
    end
88
end
89

90
const REF_ID = Threads.Atomic{Int}(1)
91
next_ref_id() = Threads.atomic_add!(REF_ID, 1)
115,695✔
92

93
struct RRID
94
    whence::Int
95
    id::Int
96

97
    RRID() = RRID(myid(), next_ref_id())
115,695✔
98
    RRID(whence, id) = new(whence, id)
382,571✔
99
end
100

101
hash(r::RRID, h::UInt) = hash(r.whence, hash(r.id, h))
466,789✔
102
==(r::RRID, s::RRID) = (r.whence==s.whence && r.id==s.id)
786✔
103

104
include("clusterserialize.jl")
105
include("cluster.jl")   # cluster setup and management, addprocs
106
include("messages.jl")
107
include("process_messages.jl")  # process incoming messages
108
include("remotecall.jl")  # the remotecall* api
109
include("macros.jl")      # @spawn and friends
110
include("workerpool.jl")
111
include("pmap.jl")
112
include("managers.jl")    # LocalManager and SSHManager
113
include("precompile.jl")
114

115
function __init__()
97✔
116
    init_parallel()
97✔
117
end
118

119
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc