JuliaParallel / JuliaParallel/DistributedArrays.jl
ddata doesn't work as intended when length(data) = length(pids)
- Lingua principale
- Julia
- Stelle
- 205
- Fork
- 34
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
The documentation says the following about `ddata`:
> The function `ddata(;T::Type=Any, init::Function=I->nothing, pids=workers(), data::Vector=[])` can be used to created a distributed vector whose localparts need not be Arrays.
> ...
> Argument `data` if supplied is distributed over the `pids`. `length(data)` must be a multiple of `length(pids)`. **If the multiple is 1, returns a `DArray{T,1,T}` where T is `eltype(data)`**. If the multiple is greater than 1, returns a `DArray{T,1,Array{T,1}}`, i.e., it is equivalent to calling `distribute(data)`.
The case when "_the multiple is 1_" is giving me trouble:
```Julia
julia> using Distributed; addprocs(2)
julia> using DistributedArrays
julia> ddata(data=["foo", "bar"])
2-element DArray{String, 1, String}:
ERROR: TypeError: in typeassert, expected String, got a value of type Char
...
```
```Julia
julia> ddata()
ERROR: On worker 2:
MethodError: no method matching getindex(::Nothing, ::Int64)
...
```
Note that `ddata` works as intended for multiples greater than 1:
```julia
julia> ddata(data=["foo", "bar", "foo", "bar"])
4-element DArray{String, 1, Vector{String}}:
"foo"
"bar"
"foo"
"bar"
```
```julia
julia> ddata(;T=Any, init=I->nothing, pids=workers(), data=[nothing, nothing, nothing, nothing])
4-element DArray{Nothing, 1, Vector{Nothing}}:
nothing
nothing
nothing
nothing
```
First time posting an issue, hope I'm doing things right!
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Start at the ddata entry point and compare its documented behavior with the supplied reproductions for data whose length equals the worker count, including ddata() with no data. Re-run the examples using Distributed and DistributedArrays; done means both cases work without the shown TypeError or MethodError while the documented behavior remains accurate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- julia
- Ambito
- data, distributed-systems
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100