Skip to content

reshape of SharedArray error #26539

@bjarthur

Description

@bjarthur

i can reshape a SharedArray on the master process, but not workers. i get no errors on workers when getting the size or sum of a SharedArray. so reshape seems to be broken. or does my mental model of how they're supposed to work need corrected?

julia> using Distributed

julia> addprocs(3)
3-element Array{Int64,1}:
 2
 3
 4

julia> using SharedArrays

julia> s=SharedArray{UInt16}(48,48,48,3);

julia> reshape(s,(1,size(s)...));

julia> f = @spawnat 2 reshape(s,(1,size(s)...))
Future(2, 1, 16, nothing)

julia> fetch(f)
ERROR: On worker 2:
MethodError: Cannot `convert` an object of type RemoteException to an object of type Array{UInt16,5}
Closest candidates are:
  convert(::Type{T<:Array}, ::AbstractArray) where T<:Array at array.jl:418
  convert(::Type{T<:AbstractArray}, ::T<:AbstractArray) where T<:AbstractArray at abstractarray.jl:14
  convert(::Type{T<:AbstractArray}, ::LinearAlgebra.Factorization) where T<:AbstractArray at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/LinearAlgebra/src/factorization.jl:51
  ...
setproperty! at ./sysimg.jl:11
init_loc_flds at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/SharedArrays/src/SharedArrays.jl:419
init_loc_flds at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/SharedArrays/src/SharedArrays.jl:411 [inlined]
reshape at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/SharedArrays/src/SharedArrays.jl:301
#5 at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/Distributed/src/macros.jl:66
#117 at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/Distributed/src/process_messages.jl:265
run_work_thunk at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/Distributed/src/process_messages.jl:56
run_work_thunk at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/Distributed/src/process_messages.jl:65
#110 at ./event.jl:92
Stacktrace:
 [1] #remotecall_fetch#157(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function, ::Distributed.Worker, ::Distributed.RRID, ::Vararg{Any,N} where N) at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/Distributed/src/remotecall.jl:379
 [2] remotecall_fetch(::Function, ::Distributed.Worker, ::Distributed.RRID, ::Vararg{Distributed.RRID,N} where N) at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/Distributed/src/remotecall.jl:371
 [3] #remotecall_fetch#160(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function, ::Int64, ::Distributed.RRID, ::Vararg{Distributed.RRID,N} where N) at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/Distributed/src/remotecall.jl:392
 [4] remotecall_fetch at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/Distributed/src/remotecall.jl:392 [inlined]
 [5] call_on_owner at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/Distributed/src/remotecall.jl:465 [inlined]
 [6] fetch(::Future) at /Users/arthurb/src/julia/usr/share/julia/site/v0.7/Distributed/src/remotecall.jl:497
 [7] top-level scope

julia> s.pids
3-element Array{Int64,1}:
 2
 3
 4

julia> f = @spawnat 2 size(s)
Future(2, 1, 20, nothing)

julia> fetch(f)
(48, 48, 48, 3)

julia> f = @spawnat 2 sum(s)
Future(2, 1, 22, nothing)

julia> fetch(f)
0x0000000000000000

this is on a 0-day master and 0.6.2. thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions