source code
# The Computer Language Benchmarks Game
# https://salsa.debian.org/benchmarksgame-team/benchmarksgame/
#
# Contributed by Adam Beckmeyer. Based on code by Jarret Revels, Alex
# Arslan, Michal Stransky, Jens Adam.
using Distributed
@everywhere struct Node
l::Union{Node,Nothing}
r::Union{Node,Nothing}
end
@everywhere make(n) =
n === 0 ? Node(nothing, nothing) : Node(make(n-1), make(n-1))
@everywhere check(node) =
node.l === nothing ? 1 : 1 + check(node.l) + check(node.r)
function binary_trees(io, n)
write(io, "stretch tree of depth $(n+1)\t check: $(check(make(n+1)))\n")
long_tree = make(n)
d = 4
while d <= n
niter = 1 << (n - d + 4)
c = @distributed (+) for _ in 1:niter
check(make(d))
end#for
write(io, "$niter\t trees of depth $d\t check: $c\n")
d += 2
end
write(io, "long lived tree of depth $n\t check: $(check(long_tree))\n")
end#function
isinteractive() || binary_trees(stdout, parse(Int, ARGS[1]))
notes, command-line, and program output
NOTES:
64-bit Ubuntu quad core
julia version 1.10.2
Sun, 03 Mar 2024 18:57:24 GMT
MAKE:
printenv JULIA_NUM_THREADS
4
0.03s to complete and log all make actions
COMMAND LINE:
/opt/src/julia-1.10.2/bin/julia -O3 --cpu-target=ivybridge --math-mode=ieee -p4 -- binarytrees.julia-4.julia 21
PROGRAM FAILED
PROGRAM OUTPUT:
From worker 2:
From worker 2: [194333] signal (11.1): Segmentation fault
From worker 2: in expression starting at none:0
From worker 2: Allocations: 1259794 (Pool: 1258621; Big: 1173); GC: 2
Worker 2 terminated.
UNHANDLED TASK ERROR: IOError: read: connection reset by peer (ECONNRESET)
Stacktrace:
[1] wait_readnb(x::Sockets.TCPSocket, nb::Int64)
@ Base ./stream.jl:410
[2] (::Base.var"#wait_locked#738")(s::Sockets.TCPSocket, buf::IOBuffer, nb::Int64)
@ Base ./stream.jl:902
[3] readbytes!(s::Sockets.TCPSocket, a::Vector{UInt8}, nb::Int64)
@ Base ./stream.jl:908
[4] read
@ ./io.jl:1013 [inlined]
[5] process_hdr(s::Sockets.TCPSocket, validate_cookie::Bool)
@ Distributed /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/process_messages.jl:274
[6] message_handler_loop(r_stream::Sockets.TCPSocket, w_stream::Sockets.TCPSocket, incoming::Bool)
@ Distributed /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/process_messages.jl:158
[7] process_tcp_streams(r_stream::Sockets.TCPSocket, w_stream::Sockets.TCPSocket, incoming::Bool)
@ Distributed /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/process_messages.jl:133
[8] (::Distributed.var"#103#104"{Sockets.TCPSocket, Sockets.TCPSocket, Bool})()
@ Distributed /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/process_messages.jl:121
ERROR: TaskFailedException
nested task error: worker did not connect within 60.0 seconds
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] create_worker(manager::Distributed.LocalManager, wconfig::WorkerConfig)
@ Distributed /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/cluster.jl:691
[3] setup_launched_worker(manager::Distributed.LocalManager, wconfig::WorkerConfig, launched_q::Vector{Int64})
@ Distributed /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/cluster.jl:545
[4] (::Distributed.var"#45#48"{Distributed.LocalManager, Vector{Int64}, WorkerConfig})()
@ Distributed /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/cluster.jl:501
Stacktrace:
[1] sync_end(c::Channel{Any})
@ Base ./task.jl:448
[2] macro expansion
@ ./task.jl:480 [inlined]
[3] addprocs_locked(manager::Distributed.LocalManager; kwargs::@Kwargs{exeflags::Cmd})
@ Distributed /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/cluster.jl:490
[4] addprocs_locked
@ /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/cluster.jl:456 [inlined]
[5] addprocs(manager::Distributed.LocalManager; kwargs::@Kwargs{exeflags::Cmd})
@ Distributed /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/cluster.jl:450
[6] addprocs
@ /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/cluster.jl:443 [inlined]
[7] addprocs(np::Int32; restrict::Bool, kwargs::@Kwargs{exeflags::Cmd})
@ Distributed /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/managers.jl:465
[8] addprocs
@ /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/managers.jl:462 [inlined]
[9] process_opts(opts::Base.JLOptions)
@ Distributed /opt/src/julia-1.10.2/share/julia/stdlib/v1.10/Distributed/src/cluster.jl:1364
[10] #invokelatest#2
@ ./essentials.jl:892 [inlined]
[11] invokelatest
@ ./essentials.jl:889 [inlined]
[12] exec_options(opts::Base.JLOptions)
@ Base ./client.jl:272
[13] _start()
@ Base ./client.jl:552