Skip to content
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

when_all returns pointer of futures #990

Closed
kyungjoo-kim opened this issue Jul 27, 2017 · 1 comment
Closed

when_all returns pointer of futures #990

kyungjoo-kim opened this issue Jul 27, 2017 · 1 comment
Assignees
Labels
Enhancement Improve existing capability; will potentially require voting
Milestone

Comments

@kyungjoo-kim
Copy link
Contributor

kyungjoo-kim commented Jul 27, 2017

@hcedwar I put an issue after the discussion about packing a group of futures.

/// currently
struct block {
  int m, n;
  value_type *ptr;
  future_type future;
};

view<block**> blocks; 

doSomethingWithBlocks(blocks); // blocks(i,j).future has a handle for task.

// the whole blocks need to be dependent on another task

view<future_type*> deps("deps", blocks.m * blocks.n);
int k=0;
for (int i=0,k=0;i<blocks.m;++i)
  for (int j=0;j<blocks.n;++j,++k) 
     deps[k] = blocks(i,j).future;

Kokkos::respawn( this, when_all(blocks.m*blocks.n, deps), Priority::Regular);
// this depedence mechanism do multipl copy of futures (internally copy the array again)
----------
// the following may reduce the overhead in this situation
auto deps = when_all(blocks.m*block);
int k=0;
for (int i=0,k=0;i<blocks.m;++i)
  for (int j=0;j<blocks.n;++j,++k) 
     deps[k] = blocks(i,j).future;

Kokkos:respawn( this, deps, Priority::Regual );
@hcedwar hcedwar added the Enhancement Improve existing capability; will potentially require voting label Jul 27, 2017
@hcedwar hcedwar self-assigned this Jul 27, 2017
@hcedwar
Copy link
Contributor

hcedwar commented Jul 27, 2017

A more robust interface:

  when_all( blocks.m * blocks.n , [&]( int i ) { return blocks(i/blocks.n,i%blocks.n).future ; } );

@hcedwar hcedwar added this to Backlog in On-node Task DAG Jul 27, 2017
@hcedwar hcedwar added this to the 2017-September (mid) milestone Jul 31, 2017
@hcedwar hcedwar moved this from Backlog to In Progress in On-node Task DAG Aug 7, 2017
hcedwar added a commit to hcedwar/kokkos that referenced this issue Aug 7, 2017
hcedwar added a commit to hcedwar/kokkos that referenced this issue Aug 7, 2017
hcedwar added a commit to hcedwar/kokkos that referenced this issue Aug 7, 2017
crtrott added a commit that referenced this issue Aug 7, 2017
@hcedwar hcedwar moved this from In Progress to In Develop in On-node Task DAG Aug 8, 2017
@ibaned ibaned closed this as completed Aug 16, 2017
@hcedwar hcedwar moved this from In Develop to Done in On-node Task DAG Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improve existing capability; will potentially require voting
Projects
No open projects
Development

No branches or pull requests

3 participants