nested loop example revisited - plain Threads look as fast as Dagger
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- julia
- Ambito
- distributed-systems, performance
Direzione di ricerca
Inizia eseguendo il benchmark Julia fornito per experiments_threads e experiments_dagger dopo un riavvio pulito, quindi ripetilo dopo Distributed.addprocs(2, exeflags=--threads=3). Confronta il posizionamento delle attività, l’uso dei processi e i tempi per determinare perché i worker aggiunti non migliorano le prestazioni. Il lavoro è completato quando è disponibile una spiegazione confermata e, se necessario, è stata apportata una correzione chiaramente circoscritta all’esempio del ciclo annidato o alla relativa documentazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
It seems that the nested loop example should get the following implementation for Threads
using Dagger, Random, Distributions, StatsBase, DataFrames
function f(dist, len, reps, σ)
v = Vector{Float64}(undef, len) # avoiding allocations
maximum(mean(rand!(dist, v)) for _ in 1:reps)/σ
end
function experiments_threads(dists, lens, K=1000)
res = DataFrame()
@sync for T in dists
dist = T()
σ = Threads.@spawn std(dist)
for L in lens
z = Threads.@spawn f(dist, L, K, fetch(σ))
push!(res, (;T, σ, L, z))
end
end
res.z = fetch.(res.z)
res.σ = fetch.(res.σ)
res
end
function experiments_dagger(dists, lens, K=1000)
res = DataFrame()
@sync for T in dists
dist = T()
σ = Dagger.@spawn std(dist)
for L in lens
z = Dagger.@spawn f(dist, L, K, σ)
push!(res, (;T, σ, L, z))
end
end
res.z = fetch.(res.z)
res.σ = fetch.(res.σ)
res
end
dists = [Cosine, Epanechnikov, Laplace, Logistic, Normal, NormalCanon, PGeneralizedGaussian, SkewNormal, SkewedExponentialPower, SymTriangularDist]
lens = [10, 20, 50, 100, 200, 500]
using BenchmarkTools
@btime experiments_dagger(dists, lens) # slightly slower, for 6 Threads, 574.444 ms (9740771 allocations: 271.22 MiB)
@btime experiments_threads(dists, lens) # slightly faster, for 6 Threads, 543.696 ms (9681150 allocations: 268.68 MiB)
The differences in time might be pure randomness in this case.
However, even more confusing, if I am adding additional processes up front (after clean restart of julia)
using Distributed
Distributed.addprocs(2, exeflags=`--threads=3`)
and then run the previous code, then @btime experiments_dagger(dists, lens) is not twice as fast (we added another 6 threads in total), but stays about the same in speed.
- Lingua principale
- Julia
- Stelle
- 734
- Fork
- 94
- Merge medio
- 4g 18h
- PR unite (30g)
- 2
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di JuliaParallel/Dagger.jl
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
JuliaParallel/Dagger.jl#786 · 1 commento ·
-
MPI: tasks with acceleration=DistributedAcceleration() go missing when ranks spawn them independentlyForse già presa @AnnaLena77 l’ha presa 39 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
JuliaParallel/Dagger.jl#778 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
JuliaParallel/Dagger.jl#759 · 3 commenti ·
-
bug datadeps
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
JuliaParallel/Dagger.jl#665 · 3 commenti ·
-
memory usage
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
JuliaParallel/Dagger.jl#649 · 6 commenti ·
Tutte le issue di JuliaParallel/Dagger.jl
Issue simili
-
path: splitext treats directory references and leading dots as extensionsForse già presa @Hiten0305l l’ha presa oggi. Aperta
Difficoltà 2/5 Mezza giornata Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
JuliaParallel/Hwloc.jl#93 ·
-
Pleiades page: embedded solution at 7 sweeps reaches the order-7 collocation cap, not order 6Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
SciML/SciMLBenchmarks.jl#1996 ·
I maintainer di solito rispondono entro 1 giorno
-
Affine transformations of `JohnsonSU` could return a `JohnsonSU`Forse già presa @devmotion l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
JuliaStats/Distributions.jl#2117 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficult-group test writes to a closed IOStream, failing on Julia 1.14.0-beta1Forse già presa @ChrisRackauckas l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
JuliaSymbolics/SymbolicIntegration.jl#162 · 1 commento ·