Performance issue in `DArray` creation when `myid()` holds a chunk
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Estagnada
- Stack de tecnologia
- julia
- Domínio
- distributed-systems, performance
Direção de pesquisa
Comece pelo construtor de DistributedArrays.DArray e reproduza os tempos relatados com o exemplo em Julia usando addprocs e a função init. Verifique como o trabalho é despachado quando myid() está incluído em pids; considera-se concluído quando o processo local não bloqueia o despacho para outros pids e o benchmark não mostra mais a lentidão relatada.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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!
- Linguagem predominante
- Julia
- Estrelas
- 205
- Forks
- 34
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de JuliaParallel/DistributedArrays.jl
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
JuliaParallel/DistributedArrays.jl#255 · 1 reação ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
JuliaParallel/DistributedArrays.jl#239 · 1 reação ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
JuliaParallel/DistributedArrays.jl#238 · 1 comentário ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 30/100
Todas as issues de JuliaParallel/DistributedArrays.jl
Issues semelhantes
-
path: splitext treats directory references and leading dots as extensionsTalvez já em andamento @Hiten0305l assumiu hoje. Aberta
Dificuldade 2/5 Meio dia Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
JuliaParallel/Hwloc.jl#93 ·
-
Pleiades page: embedded solution at 7 sweeps reaches the order-7 collocation cap, not order 6Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
SciML/SciMLBenchmarks.jl#1996 ·
Mantenedores costumam responder em até 1 dia
-
Affine transformations of `JohnsonSU` could return a `JohnsonSU`Talvez já em andamento @devmotion assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
JuliaStats/Distributions.jl#2117 ·
Mantenedores costumam responder em até 2 dias
-
Difficult-group test writes to a closed IOStream, failing on Julia 1.14.0-beta1Talvez já em andamento @ChrisRackauckas assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
JuliaSymbolics/SymbolicIntegration.jl#162 · 1 comentário ·