108
edits
Changes
→Progress
== Group Members ==
#Eunju Han [mailto:ejhan4@myseneca.ca?subject=GPU621%20from%20CDOT%20Wiki] Research etcand Demo.#<nowiki>Lei(Eric) Zhang </nowiki> [mailto:lzhang216@myseneca.ca?subject=GPU621%20from%20CDOT%20Wiki] Research etc. (Dropped '''He dropped the course.''') Research etc.
== Progress ==
*[https://software.intel.com/en-us/forums/debug-solutions/topic/515990 Intel Parallel Debugger Extension has been deprecated?]
While I studied this Intel Parallel Debugger Extension, I needed to learn more about Parallel Studio version. Links about Intel® Parallel Studio XE 2017 #[https://software.intel.com/en-us/intel-parallel-studio-xe link1 Intel® Parallel Studio XE 2017]#[http://www.adeptscience.co.uk/products/cpp/intel-parallel-studio-xe link2 Intel® Parallel Studio XE 2017]#[https://software.intel.com/en-us/articles/intel-parallel-studio-xe-release-notes link Intel® Parallel Studio XE Release Notes] ----'''Nov 14th - 23th17th:'''
*Links about Debug Multithreaded Applications in Visual Studio
**Main features descriptions in Parallel Stacks window
<table>
<tr><td colspan="3">[[File:Parallel_stack_view.png|500px|thumb|left|alt textThreads View from MSDN]]</td></tr>
<tr><td>Callout Letter</td><td>Element Name</td><td>Description</td></tr>
<tr><td>A</td><td>Call Stack Segment or Node</td><td>Contains a series of method contexts for one or more threads. </td></tr>
</table>
----'''Nov 18th - 23th:'''
'''Sample code to use debugging'''
*Sample code can be downloaded from here [https://software.intel.com/en-us/node/522584 Intel(R) Cilk(TM) quick sort]
The debugging example below is used for five odd numbers to be sorted. This is the easiest way to figured out how the threads work together with the simple data.
<table border="0" width="800">
<tr>
<td width="360" align="top">
*How to start debugging
The following sequence may guides you start to debug on the visual Studio.
# put breakpoints where you want to take a look by hitting the key F9 in the line or left-click at the front of a line
# Run the program in Debug mode by hitting the green button (or key F5)
# Go to the menu Debug -> Windows to open the windows you need ( see the image on your right)
# Choose the windows that you need (e.g. Memory, Threads, Parallel Stacks, Local or Auto and so on.)
# Hit the function keys to run a program:
## F10 to run codes line by line (Step Over)
## F11 to go into a subroutine (Step Into)
## Shit +F11 to get out of a subroutine (Step Out)
## F9 to put/remove breakpoints in a line
</td>
<td width="440">
To open windows you need for debugging on Visual Studio, You must run a program in debug mode first. Otherwise, there is no menu to open the windows.
[[File:debug_windows.png|440px|thumb|left|Menu Debug > Windows on VS 2015]]
</td>
</tr>
</table>
*Sample code results
**Data flow of parallel_qsort
<table border="0" width="800">
<tr align="left"><td>[[File:dataflow.png|250px220px|thumb|left|alt Quick sorting dataflow]]</td><td>Explanation Fist set of this quick sorting is that main thread worked for first half of all elements which starts *begin 9 to *end 1. The *mid value was 9 so it swapped *mid for *end. Since mid moved to end, the second half of all elements was the end to the end which only end value are to be sorted; the actual process will be here soonskipped so no value is changed. Next set of this is that second element(its value 3) to the last element (its value 9). The *mid value was 9 and swapping it for the *end which was same as before. For the set 4-1 step, two Threads are working for this; Worker3 and Worker2 for two level parallel_qsort function calling and two level spawning call to parallel_qsort; values are already sorted so there was no swapping. As you see the rest of the major steps indicated in the data flows diagram. </td></tr>
</table>
**Parallel Stacks
<table border="0" width="800">
<tr><td width="400">[[File:qsort_set1.png|350px|thumb|left|alt qsort_set1]]</td><td width="400">[[File:qsort_set2.png|400px|thumb|left|alt qsort_set2]]</td></tr>
<tr><td>Recursive calling parallel_qsort of spawning parallel_qsort in the first parallel_qsort function which main thread has responsible for</td>
<td>The moment right after a spawning thread works in second parallel_qsort calling which Main Thread had finished</td></tr>
<tr><td>[[File:qsort_set4_1qsort_set3_done.png|350px400px|thumb|left|alt qsort_set4_1qsort_set3_done]]</td><td>[[File:qsort_set4_doneqsort_set4_1.png|400px350px|thumb|left|alt qsort_set4_doneqsort_set4_1]]</td></tr><tr><td>For two level parallel_qsort function calling and two level spawning call to parallel_qsort, two Threads are working for this; Worker3 and Worker2</td>
<td>The moment that Main Thread is working for getting out of the previous spawning thread calling to parallel_qsort and 3d and 4th element values in the data array are exchanging in memory.
</td><td>For two level parallel_qsort function calling and two level spawning call to parallel_qsort, two Threads are working for this; Worker3 and Worker2</td></tr>
</table>
----
* Tip for Parallel program debugging
The followings will be a great approach to improve your debugging experience.
First of all, doing debugging yourself is the best, not just see the videos or friend's working how to do debugging.