Community
cancel
Showing results for 
Search instead for 
Did you mean: 
90 Views

Help with task_arena execute function

I have a task arena of 31 worker threads, and on those threads i'm trying to execute over 2000+ tasks recursively.

A function is being dispatched as a task which then recursively calls it self again and again but as another task. This works fine up until a point where the tasks don't seem to be executed.

My logging shows that many tasks are attempting to be executed but once it goes into that function it never drops out so i never see the logs after this function.

But to my knowledge each task should be executed once a worker thread is available and if one isn't available then there is a wait performed, it seems like this wait never ends.

One thing to note is that when i set the arena to 1 thread there are no hangs.

Any thoughts on this? A small example code snippet below is outlining what happens.

void Compute() {

     for (child : childs) {
        _dispatcher.execute(&Compute)
    }

  }

}


void CallCompute() {

    _dispatcher.execute(&Compute)

}


int main(){

  CallCompute();

}

 

0 Kudos
1 Reply
Alexei_K_Intel
Employee
90 Views

The execute method runs the functor immediately (or delegates to some thread but waits for the functor completion). So there is no actual parallelism and everything should be executed serially. It is unclear why it is hangs.

It seems that the parallel_do algorithm suits your needs better because it allows adding additional tasks during execution (with the feeder interface). Could you clarify why do you need task_arena? 

Reply