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

Respawn when memory pool allocation fails (not available memory) #940

Closed
kyungjoo-kim opened this issue Jul 10, 2017 · 12 comments
Closed

Respawn when memory pool allocation fails (not available memory) #940

kyungjoo-kim opened this issue Jul 10, 2017 · 12 comments
Assignees
Labels
Bug Broken / incorrect code; it could be Kokkos' responsibility, or others’ (e.g., Trilinos)

Comments

@kyungjoo-kim
Copy link
Contributor

kyungjoo-kim commented Jul 10, 2017

@hcedwar
I would like to respawn until it gets available memory. Current respawn API requires dependence.

respawn(self, dependence, priority)

How can I respawn this like periodic pooling

@hcedwar
Copy link
Contributor

hcedwar commented Jul 10, 2017

Do you mean respawn when memory pool allocation might be available; e.g., the dependence is that some other task has deallocated memory?

@kyungjoo-kim
Copy link
Contributor Author

I mean respawn when memory is not available. I am going to use tight bound of memory pool and sometimes it is possible that memorypool cannot allocate. However, I know some memory will be released and available while executing tasks and I want to put this task back and check memory again with respawning. Since this task already satisfy the dependence, dependence would not be changed.

@kyungjoo-kim
Copy link
Contributor Author

I tested respawn with an empty future. It seems to be working but I am also concerned about whether this is an expensive way to do spin lock. Any better suggestion ?

@mhoemmen
Copy link
Contributor

@kyungjoo-kim I'm not sure if it's even possible to implement a spin lock this way. I remember wanting to use Kokkos tasks for MPI polling (since MPI doesn't promise to make asynchronous progress on nonblocking operations), but Christian said it wouldn't work.

@hcedwar
Copy link
Contributor

hcedwar commented Jul 10, 2017

@kyungjoo-kim Did you tryrespawn( this , scheduler , priority ) ?

@kyungjoo-kim
Copy link
Contributor Author

this is not exactly polling and I do not have a control when this respawned task is executed.

my work scenario is

  • I have a memory pool
  • tasks need workspace and workspace is allocated via memory pool
  • the workspace size required in each task is irregular and the memory pool capacity tightly estimated
  • a large number of thrads demand more workspace simultaneously.

so, there is a dynamic situation that a task want to allocate space but it may not available due to several reasons. anyway, it indicates that there are tasks to be processed and this thread is used for such computation.

my intention is to make the code robust (not about performance, but I am pretty sure this does not hurt performance either as long as I can make all processors busy).

i am not sure if this example is analogous to mpi polling. maybe you can use "low" priority when the polling task is respawned so that it is not executed too often.

@hcedwar
Copy link
Contributor

hcedwar commented Jul 10, 2017

Yes - "low" priority where everything else is "high" or "regular"

@kyungjoo-kim
Copy link
Contributor Author

no. respawn( this , scheduler , priority ) is not working.

@hcedwar hcedwar added the Bug Broken / incorrect code; it could be Kokkos' responsibility, or others’ (e.g., Trilinos) label Jul 11, 2017
@hcedwar
Copy link
Contributor

hcedwar commented Jul 11, 2017

The above respawn should work, this is a bug. @kyungjoo-kim : Aside from that, are you asking for a respawn dependence that is satisfied by any other task being deallocated?

@kyungjoo-kim
Copy link
Contributor Author

uuummmm.... I think that I do something really stupid.... yes I did. the respawn without dependence is to reuse my code again as it includes some repeated pattern. i do this respawn instead of putting the same code block duplicated.

@kyungjoo-kim
Copy link
Contributor Author

future array with stride ???

when I construct a block of futures with other meta information, for instance

struct block {
  int nrows, ncols;
  future_type future;
};

view<block*> A("blocks", 10);

// after tasking spawning and future is recorded here and I need to respawn this with dependence
// currently 
future_type *dep;  pool.alloc(dev, 10);
for (int i=0;i<10;++i) dep[i] = A(i).future;

respawn(this, when_all(dev,10), priority);

// can I do this with stride ? 
long offset = &A(0).future - &A(0), stride = sizeof(block);
respawn(this, when_all(A.data() + offset, stride, 10), priority);

// I think when the futures are already available, I do not need to pack them to pass dependence.


@hcedwar
Copy link
Contributor

hcedwar commented Jul 24, 2017

Bug fix for respawn( this , scheduler , priority ); on task-dag branch.

@hcedwar hcedwar moved this from Backlog to In Develop in On-node Task DAG Jul 25, 2017
@crtrott crtrott closed this as completed Jul 27, 2017
@hcedwar hcedwar moved this from In Develop to Done in On-node Task DAG Jul 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Broken / incorrect code; it could be Kokkos' responsibility, or others’ (e.g., Trilinos)
Projects
No open projects
Development

No branches or pull requests

4 participants