DistributedArrays.jl icon indicating copy to clipboard operation
DistributedArrays.jl copied to clipboard

REPL show of DArray makes 4 round trip calls for each element.

Open amitmurthy opened this issue 7 years ago • 2 comments

I noticed that the default show of DArray (i.e., it defaults to the one in Base) results in 4 round trip calls for each element. We ought to define Base.show(io::IO, mime::MIME"text/plain", D::DArray) in this package.

The question is should it

  1. Only print DArray meta data (which worker has which indexes and so on) or
  2. Efficiently call a convert(Array, D) and then print it in one go locally or
  3. Pull in and show only the first few and last few elements of the darray.

amitmurthy avatar May 06 '17 15:05 amitmurthy

@andreasnoack

amitmurthy avatar May 06 '17 15:05 amitmurthy

We should probably never assume that it is okay to call convert(Array, D). Longer term I think the base method for printing arrays shouldn't fetch element by element before it knows that it is fetching from an Array, i.e. it should first convert the relevant block of the AbstractArray to an Array. However, it is fair to assume that distributed arrays are large so printing any elements is not really informative so I think we just print some metadata. Maybe some nice ASCII art displaying the layout over processes.

andreasnoack avatar May 08 '17 01:05 andreasnoack