Performance issue in `DArray` creation when `myid()` holds a chunk
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- julia
- Bereich
- distributed-systems, performance
Rechercherichtung
Beginnen Sie beim Konstruktor von DistributedArrays.DArray und reproduzieren Sie die gemeldeten Laufzeiten mit dem Julia-Beispiel unter Verwendung von addprocs und der init-Funktion. Prüfen Sie, wie die Arbeit verteilt wird, wenn myid() in pids enthalten ist; als erledigt gilt die Aufgabe, wenn der lokale Prozess die Verteilung an andere pids nicht blockiert und der Benchmark die gemeldete Verlangsamung nicht mehr zeigt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Hello,
If the pid trying to create a DArray has to do enough work, we see a slow down. The work interferes with the asynchronous dispatch of work to the other pids.
using Distributed
addprocs(2)
using DistributedArrays
# a lot of work...
@everywhere function init(I)
rr=rand(map(length,I)...)
ss=0.
for _ in 1:10
ss+=sum(rr.^2)
end
exp.(ss*exp.(rr).^3)
end
n=2000
@btime d1=DArray(init,(n,n),workers()[1:2])
@btime d1=DArray(init,(n,n),procs()[1:2])
@btime d1=DArray(init,(n,n),procs()[2:-1:1]);
126.553 ms (290 allocations: 22.45 KiB)
156.219 ms (253 allocations: 213.64 MiB)
112.563 ms (249 allocations: 213.64 MiB)
Note that in the last experiment, the same pids are included, but the pid==1 is last and the slowdown disappears (it dispatches the work to others before doing its own). Which suggests the easy fix:
@everywhere @eval DistributedArrays function DistributedArrays.DArray(id, init, dims, pids, idxs, cuts)
localtypes = Vector{DataType}(undef,length(pids))
pids=copy(pids)
ind=findfirst(isequal(myid()),pids)
if ind != nothing
pids[end],pids[ind]=pids[ind],pids[end]
end
@sync begin
for i = 1:length(pids)
@async begin
local typA
if isa(init, Function)
typA = remotecall_fetch(construct_localparts, pids[i], init, id, dims, pids, idxs, cuts)
else
# constructing from an array of remote refs.
typA = remotecall_fetch(construct_localparts, pids[i], init[i], id, dims, pids, idxs, cuts)
end
localtypes[i] = typA
end
end
end
if length(unique(localtypes)) != 1
@sync for p in pids
@async remotecall_fetch(release_localpart, p, id)
end
throw(ErrorException("Constructed localparts have different `eltype`: $(localtypes)"))
end
A = first(localtypes)
if myid() in pids
d = registry[id]
d = isa(d, WeakRef) ? d.value : d
else
T = eltype(A)
N = length(dims)
d = DArray{T,N,A}(id, dims, pids, idxs, cuts, empty_localpart(T,N,A))
end
d
end
And after the fix:
@btime d1=DArray(init,(n,n),workers()[1:2])
@btime d1=DArray(init,(n,n),procs()[1:2])
@btime d1=DArray(init,(n,n),procs()[2:-1:1]);
79.150 ms (296 allocations: 22.64 KiB)
111.481 ms (258 allocations: 213.64 MiB)
111.870 ms (258 allocations: 213.64 MiB)
Will submit a PR with the fix promptly :)
Cheers!
- Vorherrschende Sprache
- Julia
- Sterne
- 205
- Forks
- 34
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus JuliaParallel/DistributedArrays.jl
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
JuliaParallel/DistributedArrays.jl#255 · 1 Reaktion ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
JuliaParallel/DistributedArrays.jl#239 · 1 Reaktion ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
JuliaParallel/DistributedArrays.jl#238 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
Alle Issues in JuliaParallel/DistributedArrays.jl
Ähnliche Issues
-
path: splitext treats directory references and leading dots as extensionsEvtl. vergeben @Hiten0305l hat das heute übernommen. Offen
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
JuliaParallel/Hwloc.jl#93 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
SciML/SciMLBenchmarks.jl#1996 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Affine transformations of `JohnsonSU` could return a `JohnsonSU`Evtl. vergeben @devmotion hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
JuliaStats/Distributions.jl#2117 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Difficult-group test writes to a closed IOStream, failing on Julia 1.14.0-beta1Evtl. vergeben @ChrisRackauckas hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
JuliaSymbolics/SymbolicIntegration.jl#162 · 1 Kommentar ·