Setting and Creating Custom Groups
This page presents a series of examples that set and create groups.
On this page:
Using the dgroups Command
To create a custom group, use the command dgroups.
You can use the following methods to indicate that thread 3 in process 2 is a worker thread:
dsetWGROUP(2.3) $WGROUP(2)
Assigns the group ID of the thread group of worker threads associated with process 2 to the WGROUP variable. (Assigning a nonzero value to WGROUP indicates that this is a worker group.)
dset WGROUP(2.3) 1
This is a simpler way of doing the same thing as the previous example.
dfocus 2.3 dworker true
Adds the threads in the indicated focus to a workers group.
dset CGROUP(2) $CGROUP(1)
dgroups -add -g $CGROUP(1) 2
dfocus 1 dgroups -add 2
These three commands insert process 2 into the same control group as process 1.
dgroups -add -g $WGROUP(2) 2.3
Adds process 2, thread 3 to the workers group associated with process 2.
dfocus tW2.3 dgroups -add
This is a simpler way of doing the same thing as the previous example.
Following are some additional examples:
dfocus g1 dgroups -add -new thread
Creates a new thread group that contains all the threads in all the processes in the control group associated with process 1.
set mygroup [dgroups -add -new thread $GROUP($SGROUP(2))] dgroups -remove -g $mygroup 2.3 dfocus g$mygroup/2 dgo
The first command creates a new group that contains all the threads from the process 2 share group; the second removes thread 2.3; and the third runs the remaining threads.
|
The dfocus command |
|
|
The dgroup command |
|
|
The dset command |
Using the g Specifier: An Extended Example
The meaning of the g width specifier is sometimes not clear when it is coupled with a group scope specifier. Why have a g specifier when you have four other group specifiers? Stated in another way, isn’t something like gL redundant?
The simplest answer, and the reason you most often use the g specifier, is that it forces the group when the default focus indicates something different from what you want it to be.
The following example shows this. The first step sets a breakpoint in a multi-threaded OMP program and executes the program until it hits the breakpoint.
d1.<> dbreak 35
1
d1.<> dcont
Thread 1.1 has appeared
Created process 1/37258, named "omp_prog"
Thread 1.1 has exited
Thread 1.1 has appeared
Thread 1.2 has appeared
Thread 1.3 has appeared
Thread 1.1 hit breakpoint 1 at line 35 in ".breakpoint_here"
The default focus is d1.<, which means that the CLI is at its default width, the process of interest (POI) is 1, and the thread of interest (TOI) is the lowest numbered nonmanager thread. Because the default width for the dstatus command is process, the CLI displays the status of all processes. Typing dfocus p dstatus produces the same output.
d1.<> dstatus
1: 37258 Breakpoint [omp_prog]
1.1: 37258.1 Breakpoint PC=0x1000acd0,
[./omp_prog.f#35]
1.2: 37258.2 Stopped PC=0xffffffffffffffff
1.3: 37258.3 Stopped PC=0xd042c944
d1.<> dfocus p dstatus
1: 37258 Breakpoint [omp_prog]
1.1: 37258.1 Breakpoint PC=0x1000acd0,
[./omp_prog.f#35]
1.2: 37258.2 Stopped PC=0xffffffffffffffff
1.3: 37258.3 Stopped PC=0xd042c944
The CLI displays the following when you ask for the status of the lockstep group. (The rest of this example uses the f abbreviation for dfocus, and st for dstatus.)
d1.<> f L st
1: 37258 Breakpoint [omp_prog]
1.1: 37258.1 Breakpoint PC=0x1000acd0,
[./omp_prog.f#35]
This command displays the status of the threads in thread, which is the 1.1 lockstep group since this thread is the TOI. The f L focus command narrows the set so that the display only includes the threads in the process that are at the same PC as the TOI.
By default, the dstatus command displays information at process width. This means that you don’t need to type f pL dstatus.
The duntil command runs thread 1.3 to the same line as thread 1.1. The dstatus command then displays the status of all the threads in the process:
d1.<> f t1.3duntil 35
35@> write(*,*)"i= ",i,
"thread= ",omp_get_thread_num()
d1.<> f p dstatus
1: 37258 Breakpoint [omp_prog]
1.1: 37258.1 Breakpoint PC=0x1000acd0,
[./omp_prog.f#35]
1.2: 37258.2 Stopped PC=0xffffffffffffffff
1.3: 37258.3 Breakpoint PC=0x1000acd0,
[./omp_prog.f#35]
As expected, the CLI adds a thread to the lockstep group:
d1.<> f L dstatus
1: 37258 Breakpoint [omp_prog]
1.1: 37258.1 Breakpoint PC=0x1000acd0,
[./omp_prog.f#35]
1.3: 37258.3 Breakpoint PC=0x1000acd0,
[./omp_prog.f#35]
The next set of commands begins by narrowing the width of the default focus to thread width—notice that the prompt changes—and then displays the contents of the lockstep group:
d1.<> f t
t1.<> f L dstatus
1: 37258 Breakpoint [omp_prog]
1.1: 37258.1 Breakpoint PC=0x1000acd0,
[./omp_prog.f#35]
Although the lockstep group of the TOI has two threads, the current focus has only one thread, and that thread is, of course, part of the lockstep group. Consequently, the lockstep group in the current focus is just the one thread, even though this thread’s lockstep group has two threads.
If you ask for a wider width (p or g) with L, the CLI displays more threads from the lockstep group of thread 1.1. as follows:
t1.<> f pL dstatus
1: 37258 Breakpoint [omp_prog]
1.1: 37258.1 Breakpoint PC=0x1000acd0,
[./omp_prog.f#35]
1.3: 37258.3 Breakpoint PC=0x1000acd0,
[./omp_prog.f#35]
t1.<> f gL dstatus
1: 37258 Breakpoint [omp_prog]
1.1: 37258.1 Breakpoint PC=0x1000acd0,
[./omp_prog.f#35]
1.3: 37258.3 Breakpoint PC=0x1000acd0,
[./omp_prog.f#35]
If the TOI is 1.1, L refers to group number 1.1, which is the lockstep group of thread 1.1.
Because this example only contains one process, the pL and gL specifiers produce the same result when used with the dstatus command. If, however, there were additional processes in the group, you only see them when you use the gL specifier.