Open main menu

CDOT Wiki β

Changes

OpenMP Debugging in Visual Studio / Team Debug

1,036 bytes added, 15:20, 6 December 2017
Case B - Using the Parallel Stacks and the Parallel Watch Window
Second function call:
cilk_spawn coo(i)
Now Worker 3 has taken the next spawned thread, which we can see the call stack highlighted in blue:
Third function call:
cilk_spawn boo(i);
Now Worker 1 has taken charge of the next spawned thread, highlighted in blue:
Fourth function call:
cilk_spawn doo(i);
Finally, Worker 2 picks up the next spawned thread:
Fifth function call:
cilk_spawn zoo(i);
Finally, the Main thread is available and picks up the next spawned thread, which is a call to zoo function.
Sixth function call:
foo(i);
The next thread to free up was Worker 2, which snatched up the call to function foo() since it was available.
Now we will use the Parallel Watch Window to view the variable i, and its value in the different threads as we go through the stack frames as determined by our breakpoints.
 
Setup:
 
1. After starting debug (F5), open a Parallel Watch Window, and add i into an <Add Watch> column.
2. Since we also want to see how variable i changes inside each of the functions, on top of the previous breakpoints we placed as in the above walkthrough, we will place more breakpoints, one at each of the return statements in each of the functions. That way we will be able to see the parameter value when it first entered the function, and how it leaves the function.
 
Walkthrough:
 
First Function Call:
cilk_spawn foo(i);
 
At this breakpoint, we can see Main Thread has taken up the spawned thread, and thread id is 11192.
[[File:Parallelwatch-step1-threads.PNG|500px|center|Synced up]]
In our Parallel Watch window, the thread is active, and we can see that the value of i is 1. When we hover our mouse over the value, we can see the previous value, which is a random int because that was the value before it was initialized.
[[File:Parallelwatch-step1.PNG|500px|center|Synced up]]
 
 
Parallelwatch-step1-threads.PNG
==Case C==
92
edits