Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2466 Discussions

One small problem about the total number of tasks

irisshinra308
Beginner
453 Views
Hello~

I am trying to observe the total task number of applications from parsec.
The only way to put tasks into a deque of thread is calling the "spawn" function. Am I right?

I simply create a variable and increase it at each iteration in the "spawn" function.
Do I miss anything?

Thanks for reading

Dennis
0 Kudos
6 Replies
Alexey-Kukanov
Employee
453 Views
Tasks might not necessarily be spawned in order to execute.
I'd track the number of allocated tasks or the number of executed tasks.
0 Kudos
irisshinra308
Beginner
453 Views
Tasks might not necessarily be spawned in order to execute.
I'd track the number of allocated tasks or the number of executed tasks.

Thanks for replying.

I want to calculate all the tasks which would be put in the deque of scheduler to wait for execution.
I know the task which is returned by the previous task would be executed without being put in the deque again.
If I track the number of allocated tasks or executed tasks, the result would be the total tasks of applications.

Am I wrong?

Thanks again for your patience

Dennis
0 Kudos
Alexey-Kukanov
Employee
453 Views
If counting only spawned tasks is what you need, then yes, track spawn().
0 Kudos
irisshinra308
Beginner
453 Views
Thanks for replying.

I am trying to sample the number of tasks resides in the deque during the applications execution.
I have traced the task.cpp and I am wondering if the variable "deepest" in the get_task equals the number of tasks in the deque currently.
That is, the deepest = 5 in the get_task method means that there are five tasks in this deque, am I right?
I am also curious about what's the purpose of the task pointer "next" in the task_proxy class.

Any help would be grateful!

Thank you very much.

Dennis

0 Kudos
Alexey-Kukanov
Employee
453 Views
Quoting - irisshinra308
Thanks for replying.

I am trying to sample the number of tasks resides in the deque during the applications execution.
I have traced the task.cpp and I am wondering if the variable "deepest" in the get_task equals the number of tasks in the deque currently.
That is, the deepest = 5 in the get_task method means that there are five tasks in this deque, am I right?
I am also curious about what's the purpose of the task pointer "next" in the task_proxy class.

Any help would be grateful!

Thank you very much.

Dennis


No, deepest is not equal to the number of tasks in the pool.

The task_proxy class does not have a member called next;did you mean "next_in_mailbox", and if yes, isn't it self-describing? :) Mailbox is a list of task_proxy objects representing the work suggested by other threads; it is a part of task-to-thread affinity mechanism in TBB.
0 Kudos
irisshinra308
Beginner
453 Views

No, deepest is not equal to the number of tasks in the pool.

The task_proxy class does not have a member called next;did you mean "next_in_mailbox", and if yes, isn't it self-describing? :) Mailbox is a list of task_proxy objects representing the work suggested by other threads; it is a part of task-to-thread affinity mechanism in TBB.

Thanks for replying.

I have checked the source code of tbb and the member "next" is in the task_prefix class.
Sorry for my mistake.

Is there any variable in tbb record the number of tasks which are currently in the deque?
If not, could you please give me some hint to get this information?

Any help would be grateful!!

Thanks again.

Dennis

0 Kudos
Reply