Skip to content

setindex! not defined? #155

Closed
Closed
@barche

Description

@barche

Hi,

Is it possible setindex! is not defined? I tried the following:

@everywhere using DistributedArrays
x = dzeros((20,), procs(), (nprocs(),))
x[20] = 3

But got

ERROR: indexing not defined for DistributedArrays.DArray{Float64,1,Array{Float64,1}}
Stacktrace:
 [1] setindex!(::DistributedArrays.DArray{Float64,1,Array{Float64,1}}, ::Int64, ::Int64) at ./abstractarray.jl:967

I could set a value using this workaround (assuming the above was on 4 processes):

@sync @spawnat 4 localpart(x)[end] = 3.0

So it seems a general setindex! would not be that difficult to implement (presumably using the same mechanism to get local indices as used in getindex), or am I missing something here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions