-
-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
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.
...
Argumentdata
if supplied is distributed over thepids
.length(data)
must be a multiple oflength(pids)
. If the multiple is 1, returns aDArray{T,1,T}
where T iseltype(data)
. If the multiple is greater than 1, returns aDArray{T,1,Array{T,1}}
, i.e., it is equivalent to callingdistribute(data)
.
The case when "the multiple is 1" is giving me trouble:
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> ddata()
ERROR: On worker 2:
MethodError: no method matching getindex(::Nothing, ::Int64)
...
Note that ddata
works as intended for multiples greater than 1:
julia> ddata(data=["foo", "bar", "foo", "bar"])
4-element DArray{String, 1, Vector{String}}:
"foo"
"bar"
"foo"
"bar"
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!
M-PERSIC
Metadata
Metadata
Assignees
Labels
No labels