Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The similar method for SharedArray returns an Array #5893

Closed
dmbates opened this issue Feb 21, 2014 · 3 comments · Fixed by #5914
Closed

The similar method for SharedArray returns an Array #5893

dmbates opened this issue Feb 21, 2014 · 3 comments · Fixed by #5914

Comments

@dmbates
Copy link
Member

dmbates commented Feb 21, 2014

Wouldn't it make more sense to have it return a SharedArray of the same element type and dimensions with the index chunks for the pids aligned?

@amitmurthy
Copy link
Contributor

I guess we we want the same behavior for a DArray too, i.e., similar(d::DArray,element_type, dims) returning an uninitialized darray?

Also once #5452 is merged similar(S::SharedArray, element_type, dist::SharedDist) would return an uninitialized SharedArray while similar(D::DArray, element_type, dist::ChunkedDist) would return a DArray. dist describes the distribution of the array (pids and chunks in case of a darray, only pids in case of a sharedarray). Both element_type and dist are optional.

@amitmurthy
Copy link
Contributor

Since similar returns an uninitialized array, and I guess the intent of this is to make the same code play nicely whether it is an Array, DArray or SharedArray, I am wondering what would be the best strategy to achieve this.

Towards this end should we define
procs(a::AbstractArray) = [myid()] ,
localpart(a::AbstractArray) = a and localindexes(a::AbstractArray) which again returns the complete indexes of a?

Similarly for SharedArray too. @timholy had some reservations in describing a chunking scheme for a SharedArray since it was not really relevant, but I am thinking now that it may make sense if folks want to write algorithms that compose the same way with a local or distributed array and just work. SharedArray will have a localpart returning a SubArray, and localindexes, which would be based on a partitioning scheme that plays well with SharedArrays.

Users can then write code assuming it to be distributed and it will work the same way for a local array:

for p in procs(a)
   remotecall_fetch(p, ....)
end

Thoughts?

@timholy
Copy link
Sponsor Member

timholy commented Feb 22, 2014

My point was that some algorithms may just ignore it, but I don't think it hurts anything to have it. So if this makes life better, no objections from me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants