idb info task (gdb mode only)

Display information for existing tasks in an OpenMP* application.

Syntax

idb info task [ task_id, ... ]

Parameters

task_id

A task ID.

Description

This command displays the following information for any existing task, which you specify with task_id, in an OpenMP* application.

If you do not specify task_id, this command shows all existing tasks in the OpenMP* application.

Note iconNote

This command is fully supported for OpenMP* versions 3.0 and higher. For older versions, this command has restricted functionality.

Example

The program being debugged in this example calculates the 5th Fibonacci number by spawning tasks to calculate the previous two numbers recursively. Consider the following source code:

1 #include <stdio.h>
2 #include <omp.h>
3 
4 static int fib(int n) {
5   if (n == 0) {
6     return 0;
7   } else if (n == 1) {
8     return 1;
9   } else {
10     int i = 0;
11     int j = 0;
12 
13 #pragma omp task shared(i)
14     i = fib(n-1);
15  
16 #pragma omp task shared(j)
17     j = fib(n-2);
18  
19 #pragma omp taskwait
20     return i+j;
21   }
22 }
23 
24 
25 main()
26 {
27   int result = 0;
28 
29   omp_set_num_threads(4);
30 
31 #pragma omp parallel
32   {
33     #pragma omp single
34     {
35       result = fib(5);
36     }
37   }
38 
39   printf("fib(5) = %d\n", result);
40 }

The following output illustrates the type of information that idb info task displays.

(idb)  b 6
Breakpoint 1 at 0x804898e: file /fib.C, line 6.
(idb)  r
Starting program: /fib
[New Thread 3086866112 (LWP 22340)]
[New Thread 3086866112 (LWP 22340)]
[New Thread 1194912 (LWP 22341)]
[New Thread 7830432 (LWP 22342)]
[New Thread 9931680 (LWP 22343)]
[New Thread 15641504 (LWP 22344)]
 
Breakpoint 1, fib (n=0) at /fib.C:6
6     return 0;
(idb)  idb info task
4           implicit task on thread 1 in team 1
            State: suspended by unknown
            Created at: unknown
            Parent task: -
            Child task: 15 16 17 18 
 
15          implicit task on thread 1 in team 7
            State: suspended by unknown
            Created at: "/fib.C":main:31:37
            Parent task: 4
            Child task: 20 19 
 
16          implicit task on thread 3 in team 7
            State: suspended by unknown
            Created at: "/fib.C":main:31:37
            Parent task: 4
            Child task: none
 
17          implicit task on thread 4 in team 7
            State: running
            Created at: "/fib.C":main:31:37
            Parent task: 4
            Child task: none
 
18          implicit task on thread 5 in team 7
            State: running
            Created at: "/fib.C":main:31:37
            Parent task: 4
            Child task: none
 
19          tied task on thread 3 in team 7
            State: suspended by unknown
            Created at: "/fib.C":fib:13:13
            Parent task: 15
            Child task: 25 26 
 
20          tied task on thread 1 in team 7
            State: suspended by unknown
            Created at: "/fib.C":fib:16:16
            Parent task: 15
            Child task: 21 
 
21          tied task on thread 1 in team 7
            State: suspended by unknown
            Created at: "/fib.C":fib:13:13
            Parent task: 20
            Child task: 23 24 
 
23          tied task on thread unknown in team 7
            State: created
            Created at: "/fib.C":fib:13:13
            Parent task: 21
            Child task: none
 
24          tied task on thread 1 in team 7
            State: running
            Created at: "/fib.C":fib:16:16
            Parent task: 21
            Child task: none
 
25          tied task on thread unknown in team 7
            State: created
            Created at: "/fib.C":fib:13:13
            Parent task: 19
            Child task: none
 
26          tied task on thread 3 in team 7
            State: running
            Created at: "/fib.C":fib:16:16
            Parent task: 19
            Child task: 27 
 
27          tied task on thread unknown in team 7
            State: created
            Created at: "/fib.C":fib:13:13
            Parent task: 26
            Child task: none

See Also


Submit feedback on this help topic

Copyright © 1996-2010, Intel Corporation. All rights reserved.