-
Notifications
You must be signed in to change notification settings - Fork 76
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
Missing distributed array creation methods #1278
Comments
example: array_d([[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]) -> each machine creates a 4x4 matrix tile of 0's. array_d(shape=((4,4), row)) -> all machines create a 4x4 row order tile array_d(shape=( (4,4), [ (0, row) , (1, col) ] ) ) -> each machine makes a 4x4 tile, machine 0 creates row order tile, machine 1 creates a column order tile; if a machine isn't listed, it creates a 4x4 using a default layout. |
We have |
@stevenrbrandt How should the distributed array be initialized? We have available the equivalents for |
@hkaiser The 'tile()' primitive creates a bigger array by replicating an input array. I assume you meant
|
@ct-clmsn see above about what I think |
In all of this you are assuming a single locality loading a file (or otherwise generating the array) which should then be distributed across other localities. The execution model we target at this point however is pure SPMD, i.e. every locality executes the same code. How should the |
@hkaiser -- if we assume pure SPMD, then any non-distributed array must have an identical copy on each locality (unless it's a random array). I guess that means |
Ok. You can do that using |
@ct-clmsn I like this approach as it provides a concise way to specify tiles. We currently have some means for that, but it's difficult to use. |
@hkaiser - in reference to @stevenrbrandt - I like the concept of registering local data into a distributed AGAS container (matrix/array/vector). did you have any comment on the examples in the response I posted earlier? Do those fit into your model or are they separate conceptually and build on what you are thinking? |
@hkaiser I don't see how |
@ct-clmsn I'm not sure I understand your idea. Normally, when we think of a distributed array, I think of a large array with some definite shape that gets chopped into pieces and distributed. You seem to want to have a distributed array that exists as an identical copy on each processor, but with different tilings. Is that correct? I'm a little unclear about how such an array is kept in sync during a calculation. |
@stevenrbrandt I don't think having
or similar. Having a local |
@stevenrbrandt My bad! You are on point; I misstated something...this may not lend itself to a text exchange, will save for a conference call. For clarity, The 'local copy' in the question posed was about a tile that composes a matrix portion. If you consider the matrix as a globally addressable Java/C++ container type, each tile is globally addressable, and the data in the tile is stored on a local node - that last bit feels a bit regressive to state but is posted for clarity.
This feature intends that a user knows how big each tile should be on each of the N machines ahead of time. The final matrix size is 4x4 * N machines. For a 4 node computation, you get a 16x16 matrix. The 16x16 matrix is broken up into 4 tiles of 4x4 mini-matrices.
A similar way of saying the same thing in the previous example adds in a row or column layout for the data. The 4x4 mini-matrix on each machine is stored in memory using a row layout.
A similar way of saying the same thing in the previous example provides users with a finer level of granularity for memory layout. The 0'th machine's 4x4 matrix is stored in a row order fashion, the 1st machine's 4x4 matrix is stored in a column order fashion. |
@hkaiser I'm a little confused. What do you mean it might not be an array? The lambda should always return a scalar. Array creation with fromfunction() looks like this:
from_function_d() would possibly need a list of localities and/or a tiling, but should otherwise work the same. Yes? |
@ct-clmsn I think it's better to pass the size of the global array and the number of localities and have some algorithm figure out how to make it work. What happens with your routine if you ask for 4x4 and want 3 localities? If I passed a 6x6 and asked for 3 localities, I could get a 2x6 and two 3x4's. I don't want to have to figure that kind of thing out for myself, normally. |
I think this is not quite how it works. The supplied function is called with arrays of indices, one array per dimension: import numpy as np
np.fromfunction(lambda i, j: print("i: ", i, "\nj: ", j), (2, 3)) will print: i: [[0. 0. 0.]
[1. 1. 1.]]
j: [[0. 1. 2.]
[0. 1. 2.]] Also, for instance: print(np.fromfunction(lambda i, j: "boo!", (2, 3)) ) will output: 'boo!' |
@stevenrbrandt - Understood, I've been thinking about your suggestion to have a Python function that does the partitioning automatically, and that's where I believe we (could) all agree with Avah's automatic tiling and data layout work fits into the picture. That said, something like what I'm proposing will be needed by Avah's contributions for building that automatic capability - think of the proposal as an entry point for Avah's contributions. The proposal can also allow people who need or want that sort of granular control to express or compute layouts they may require. |
@hkaiser, so I see I was mistaken. It passes an array of integers--it just happens to give the same answer I was expecting. I think it would be okay for fromfunction_d() to require the output to match the shape of the input. |
@ct-clmsn one can, in principle do what you propose with annotate_d(), I believe. It's a question of level of user friendliness. |
I merged a local-only version of |
array_d(array)
: split up an existing array across localities (we havetile()
, see below)fromfunction(func, shape)
: like numpy's fromfunction (see Adding indices and fromfunction primitives #1289)file_read_hdf5_d(filename)
: like file_read_csv_d except it reads from hdf5 filesRelated methods that would be helpful...
file_write_hdf5_d(filename)
: like file_read_hdf5_d except it writes filesfile_write_csv_d(filename)
: like file_write_hdf5_d except it writes csv filesThe text was updated successfully, but these errors were encountered: