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

AccessHandle<> owned_by elm of create_concurrent_work cannot be captured when non-owned #4

Open lifflander opened 7 years ago

lifflander commented 7 years ago

If an AccessHandle<> in a context of create_concurent_work is not locally owned by an element in the index range it cannot be captured. Being able to write uniform code with conditionals deeper in the code (if the developer desires) should be possible. Especially considering that determining who owns the AH may require deferring work. I think that propagating the AH in a defunct state would be correct.

DARMA assertion failed:
  Expression should be true: not unfetched_
  Assertion details:
    File: /Users/jliffla/codes2/darma-threads-development/darma-build/repos/frontend/src/include/darma/interface/app/access_handle.h
    Line: 679
    Illegal operation on unfetched non-local AccessHandle
struct TestFoo {
  void operator()(AccessHandle<int> foo) {
    // works correctly
    if (index.value == 0) { create_work([=]{ foo.set_value(29); }); }
    // does not work: generates the above runtime error
    create_work([=]{  if (index.value == 0) { foo.set_value(29); } });
  }
};

void darma_main_task(std::vector<std::string> args) {
  auto foo = initial_access<int>();
  create_concurrent_work<TestFoo>(
    foo.owned_by(Index1D<int>{0}, index_range=Range1D<int>(col_size)
  );
}

DARMA_REGISTER_TOP_LEVEL_FUNCTION(darma_main_task);
dhollman commented 7 years ago

yeah, this is probably the right thing to do. I'll add it to the list of things I need to change...

dhollman commented 7 years ago

This depends on the resolution of https://github.com/DARMA-tasking/darma-charm-backend/issues/2

dhollman commented 6 years ago

Moved to Icebox for now (is that what that's for?) because we're not sure if we're going to do owned_by any more