DistributedArrays.jl
DistributedArrays.jl copied to clipboard
REPL show of DArray makes 4 round trip calls for each element.
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
- Only print DArray meta data (which worker has which indexes and so on) or
- Efficiently call a
convert(Array, D)
and then print it in one go locally or - Pull in and show only the first few and last few elements of the darray.
@andreasnoack
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.