DARMA-tasking-internal / darma-frontend

Header library providing the frontend programming model for the DARMA asynchronous many-task model
Other
7 stars 0 forks source link

Inconsistencies/ambiguities in VASP semantics for collections #68

Open dhollman opened 6 years ago

dhollman commented 6 years ago

Some pieces of the VASP semantics for collections are obvious. For instance,

struct MyFunctor {
  void operator()(Index1D<int>, AccessHandleCollection<int, Range1D<int>>) const;
};
auto rng = Range1D<int>(42);
auto my_ahc = initial_access_collection<int>(index_range=rng);
create_concurrent_work<MyFunctor>(my_ahc, index_range=rng);
create_concurrent_work<MyFunctor>(my_ahc, index_range=rng);

Clearly, both of the above captures should work the same way as the create_work analog, since:

However, inside of the TaskCollection, it's less clear what the permissions on the UseCollection should be. The MM immediate permissions are represented by local Use objects at the time the TaskCollection starts, so holding a CollectionManagingUse with MM permissions is redundant. It also leads to awkwardness with respect to capture:

struct MyFunctor {
  void operator()(Index1D<int> idx, AccessHandleCollection<int, Range1D<int>> ahc) const {
    // <-- suppose the `CollectionManagingUse` has `MM` permissions here
    create_work([=]{ ahc[idx].local_access().set_value(42); }
    // <-- even if the above create_work only implicitly captures RN permissions on the
    //      CollectionManagingUse (so that read_access() to published info can be created),
    //      the permissions here *release* that Use and create a new CollectionManagingUse 
  }
};

Perhaps a better solution is to say that the CollectionManagingUse has Commutative RN permissions (and implicitly captures Commutative RN permissions) since what is being expressed is the ability to call read_access() on some non-local index.

Thoughts? Note that TestCreateConcurrentWork.nested_reverse depends on this decision, and won't work until we decide what to do.