Shared Arrays

Issue #4 resolved
Dan Bonachea created an issue

Ch 3.2: "1-D block-cyclically distributed shared-array type"..."Example of declaring a shared array sa of N integers distributed cyclically"

If the arrays are block cyclic in general, how does the user declare such an array with a block size greater than 1 element? (a more general example might help here) Is the blocksize a purely dynamic property established by init()? Or are we only supporting pure cyclic arrays?

What other member functions are available? (eg how do you query the total size or block size, access individual elements, etc) - again a longer example might help.

Re: shared_array<>:init(): What does it mean to pass sz==0? What happens if you call init() multiple times (with same or diff values)? What if the various ranks pass different arguments? (should probably prohibit that)

It seems a bit awkward to allow the user to statically define shared arrays, but then require a separate collective init() call for each such array after upcxx:init but before the first array use. Is there perhaps an implementation trick where you can use a "fake" static initializer to register the array with an internal list in the library, and then automatically init() all the arrays during upcxx::init()?

Comments (5)

  1. Yili Zheng

    Dan, I agree with your comments. I will add more text in the spec to address your concerns and explain the details.

    I also agree that the requiring statically defined shared_array to call init is awkward . I think what you suggested is doable and I actually used the same idea for shared_var. I will try to fix that shortly and follow up on this.

    On a related note, one feature that I hope to see in gasnet/gasnet-ex is that gasnet_init allows passing NULL to &argv and &argc because 1) it's sometimes desirable to init gasnet even before main() and 2) it's common to init gasnet without main() in a library.

  2. Cy Chan

    I second Dan's suggestion to use a static initializer that registers the array for initialization during upcxx::init(). We do a similar trick in Rambutan to register/initialize an application's Task and Data spaces. This would also alleviate the cost of executing a separate collective init() for each array in the user's code at startup. This is less of an issue if the code actually requires dynamically changing block sizes (and thus multiple calls to init()), but then I haven't seen examples of code requiring it.

  3. Log in to comment