Skip to content

Conversation

@Roger-luo
Copy link
Contributor

@Roger-luo Roger-luo commented Nov 4, 2018

I'm not sure if this init is still needed? can we just provide it with fill interface?

Why do we need a init function in the constructor?

  • use undef for uninitialized SharedArray, but preserve the init keyword (you need it for files)
  • similar should return SharedArray

@Roger-luo Roger-luo changed the title WIP: make shared array constructor consistent to array constructor RFC: make shared array constructor consistent to array constructor Nov 5, 2018
@Roger-luo Roger-luo changed the title RFC: make shared array constructor consistent to array constructor WIP: make shared array constructor consistent to array constructor Nov 5, 2018
@Roger-luo Roger-luo changed the title WIP: make shared array constructor consistent to array constructor make shared array constructor consistent to array constructor Nov 5, 2018
@StefanKarpinski
Copy link
Member

Not sure who the best person to review SharedArray code is. @mbauman do you know? This looks fairly straightforward to me but I'm not certain.

@fredrikekre fredrikekre added the deprecation This change introduces or involves a deprecation label Nov 5, 2018
@mbauman
Copy link
Member

mbauman commented Nov 5, 2018

Unfortunately the similar part here was tried before (#12560) but it ran into many difficulties in practice and ended up getting reverted (#12964).

@Roger-luo
Copy link
Contributor Author

Roger-luo commented Nov 5, 2018

@mbauman What about return SharedArray for similar and have a new method that return a similar data?

So in my case, I tried to implement something with generic array type, which allows me to run either on multiprocess with SharedArray shares the data, or on a single process with simple Array, CuArray, etc. And then I'll need some consistent method to construct the array.

I currently have to work around this like:

_similar(xs...; kwargs...) = similar(xs...; kwargs...)

_similar(S::SharedArray, T::Type, dims::Dims{N}; pids=S.pids) where N = SharedArray{T, N}(dims; pids=pids)
_similar(S::SharedArray{ST, N}, T::Type; pids=S.pids) where {ST, N} = _similar(S, T, size(S); pids=pids)
_similar(S::SharedArray, dims::Dims; pids=S.pids) = _similar(S, eltype(S), dims; pids=pids)
_similar(S::SharedArray; pids=S.pids) = _similar(S, eltype(S), size(S); pids=pids)

@DilumAluthge
Copy link
Member

@Roger-luo Are you still interested in this PR?

@DilumAluthge
Copy link
Member

(I've cancelled CI for now. I'll re-trigger CI if we decide we're still interested in this PR.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deprecation This change introduces or involves a deprecation status: waiting for PR author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants