Matrix-vector multiplication fails when DArray is unevenly distributed

Aberta
#237 0 comentários 0 reações 0 responsáveis Ver no GitHub

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
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
julia

Direção de pesquisa

Reproduza o exemplo em test.jl com julia -p 2 e, em seguida, inspecione a construção do array de saída em torno de /src/linalg.jl:279 e a validação que está falhando em torno de /src/linalg.jl:209. Rastreie como os chunks da primeira dimensão com tamanhos desiguais são representados e verifique se A*x é concluído com sucesso para a distribuição 2x4 e 3x4.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

The following example creates DArrays A and x, then attempts A*x. The only unusual bit is that A is distributed unevenly.

# test.jl

using Distributed, DistributedArrays
@everywhere using Distributed, DistributedArrays

A2 = @spawnat 2 ones((2,4))           # 2x4 array
A3 = @spawnat 3 ones((3,4))           # 3x4 array
A = DArray(reshape([A2,A3], (2,1)))   # 5x4 array

x = dones((4,1))                      # 4x1 array

A*x

Launching the REPL with julia -p 2 including test.jl yields

julia> include("test.jl")
ERROR: LoadError: ArgumentError: cuts of the first dimension of the output matrix must match cuts of dimension 1 of the first input matrix
Stacktrace:
 [1] _matmatmul!(C::DArray{Float64, 2, Matrix{Float64}}, A::DArray{Float64, 2, Matrix{Float64}}, B::DArray{Float64, 2, Matrix{Float64}}, α::Int64, β::Int64, tA::Char)
   @ DistributedArrays ~/.julia/packages/DistributedArrays/fEM6l/src/linalg.jl:209
 [2] mul! (repeats 2 times)
   @ ~/.julia/packages/DistributedArrays/fEM6l/src/linalg.jl:262 [inlined]
 [3] *(A::DArray{Float64, 2, Matrix{Float64}}, B::DArray{Float64, 2, Matrix{Float64}})
   @ DistributedArrays ~/.julia/packages/DistributedArrays/fEM6l/src/linalg.jl:279

Looking at the source around /src/linalg.jl:279,

function Base.:*(A::DMatrix, B::AbstractMatrix)
    T = Base.promote_op(_matmul_op, eltype(A), eltype(B))
    C = DArray(I -> Array{T}(undef, map(length, I)),
            (size(A, 1), size(B, 2)),
            procs(A)[:,1:min(size(procs(A), 2), size(procs(B), 2))],
            (size(procs(A), 1), min(size(procs(A), 2), size(procs(B), 2))))
    return mul!(C, A, B)
end

I think the issue may be that creation of the output array C doesn't account for the (admittedly unusual) possibility that A is distributed in uneven chunks.

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

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de JuliaParallel/DistributedArrays.jl

Todas as issues de JuliaParallel/DistributedArrays.jl

Issues semelhantes

Mais issues de Julia

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.