Changes

Jump to: navigation, search

GPU621/Debugging OpenMP

5,264 bytes added, 16:19, 30 November 2022
Group Members
# [mailto:sali263@myseneca.ca?subject=GPU621 Sami Ali]
# [mailto:lliu170@myseneca.ca?subject=GPU621 Leon Liu]
 
// TODO: Create a tutorial on how to debug parallel programs using OpenMP in Visual Studio
 
// remember to add pictures if possible
 
// Steps
 
1. Read the Microsoft Documentation for your section
 
2. Paraphrase the contents of your section onto the Wiki
 
3. Test it yourself in Visual Studio and add examples
 
// Uploading Files
 
To upload a file, go to https://wiki.cdot.senecacollege.ca/wiki/Special:Upload
 
To include a file in a page, use <nowiki>[[File:File.jpg]]</nowiki> to use the full version of the file
= Process and Thread =
==== Attach to Process ====
The Visual Studio debugger has the capability to attach to applications running in processes outside of Visual Studio locally and remotely. This is useful as you are able to debug external applications that are already built. You can use the debugger while attached to a separate app, though some features may be limited. To attach to a running process:
# With the app and Visual Studio running, select Debug > Attach to Process.
= User Interface =
// TODOPrimary tools include: Show the window and explain what it does for every single window below (medium)* Attach to Process Dialog* Process Window* Debug Location Bar
// documentation for windows are hereTools in debugging threads include: https://learn.microsoft.com/en-us/visualstudio/debugger/debug-threads-and-processes?view=vs-2022* Thread Windows* Thread Markers in Source Windows* Parallel Stacks Window* Debug Location Toolbar* Tasks Window* GPU Threads Window
== Attach to Process Dialog Box ==
 
In Attach to Process Dialog Box, you can attach:
* Process name
* Session number
* Menubar Title
* Process ID number
* Type (Managed v4.0; Managed v2.0, v1.1, v1.0; x86; x64; IA64)
* User Name
 
Actions you can perform include Select a process to attach to, Select a remote computer, and Change transport type for connecting to remote computers
 
 
== Process Window ==
 
Processes you can attach include:
* Process Name
* Process ID number
* Path to process .exe
* Menubar Title
* State (Break. Running)
* Debugging (Native, Managed, and so on.)
* Transport type (default, native with no authentication)
* Transport Qualifier (remote computer)
 
Tools include:
* Attach
* Detach
* Terminate
== Thread Window ==
 
Thread Window is a tool in Visual Studio that allows you to manage and monitor your program's threads during debugging.
 
It can be set up by adding breakpoints in your program in order to examine it's activity.
 
This is done by right-clicking the desired line and choose the Breakpoint option.
 
====How to use breakpoints====
 
You can use this by going to Debug -> Windows -> Threads, or by pressing CTRL + ALT + H
 
This will allow the execution to stop at your breakpoints.
 
Thread Window allows any kind of usage, it has multiple columns which present multiple fields of data.
 
These fields include:
 
* Flag: Indicates which threads the user wants to pay special attention to
 
* Current Thread: Current thread would be indicated by an arrow.
 
* ID: Shows a thread's identification number.
 
* Managed ID: Shows managed identification numbers.
 
* Category: Displays a thread's category, for example: User Interface Threads, Remote Call Procedure Handlers, or Worker Threads.
 
* Name: Identifies each thread by name.
 
* Location: Displays the location threads run.
 
* Priority: Shows the precedence assigned to a specific thread by the system, which is hidden by default.
 
* Affinity Mask: Displays the affinity mask for a thread. Affinity mask directs which processors a thread can run on, which is hidden by default.
 
* Suspended Count: This determines if a thread can run, which is hidden by default.
 
* Process Name: Shows the thread's process name, which is hidden by default.
 
* Process ID: Shows the thread's process ID, which is hidden by default.
 
* Transport Qualifier: Helps identify which machine the debugger is connected to.
 
== Source Window ==
 
The Source Window is used to display source code.
 
====How to set it up====
It can be set up by pressing F5, which starts debug. This will allow it to show up automatically.
 
If the window is closed, it can be opened by double-clicking any linked items or the filename in the project pane.
 
====How to use it====
There is an icon named "Show Threads in Source" near the top of the window that is off, turn it on.
 
Another way you can turn it on is by right-clicking the menu on the thread window.
 
In the window's gutter, there is a thread icon that displays the current working threads. Details can be shown by hovering your mouse over it.
 
You can add or remove breakpoints from here.
== Debug Location Window ==
 
The Debug Location Window allows you to set the active or current processes.
 
====Options include:====
 
*Current process
 
*Suspend the application
 
*Resume the application
 
*Suspend and shut down the application
 
*Current thread
 
*Toggle current thread flag state
 
*Show only flagged threads
 
*Show only current process
 
*Current stack frame
 
====Which allows you to perform:====
 
*Switch to another process
 
*Suspend, resume, or shut down the application
 
*Switch to another thread in current process
 
*Switch to another stack frame in current thread
 
*Flag or unflag current threads
 
*Show only flagged threads
 
*Show only the current process
== Parallel Stacks Window ==
You can call stack information for your threads with Parallel Stacks Window, you can also focus on different threads and see the stack frames for those threads aswell.
 
====How to set it up====
 
* Click Debug -> Windows -> Parallel Stacks
* Detailed version can be accessed by going to Debug -> Options, go to Debugging -> General and uncheck "Enable just my code". Then go to Debugging -> Symbols and check "Microsoft Symbol Servers", which will allow the stack frames to be more descriptive.
 
====How to use it====
 
Parallel Stacks Window will show all of the threads that point within the program at every breakpoint you reach. It will also include their call stacks.
 
An example of the Threads Window and it's corresponding Parallel Stacks Window:
 
[[File:750px-Parallelstacks-threadsview.png]] [[File:750px-Parallelstacks-stacksview.png]]
== Parallel Tasks Window ==
 
====How to set it up====
 
Go to "Call Stack" by going to Debug -> Windows, you can also open "Thread" through Debug -> Windows.
 
====How to use it====
 
Every task displays a specific ID, if you select this ID, you can access the specific methods the task is passing. To go to the next breakpoint, you press "Continue", to freeze a task, you can rick-click.
 
====Features====
 
Users can determine the Thread Assignment of each specific task.
Users have the ability to see the status of each specific task.
== Parallel Watch Window ==
 
The user can watch a thread and it's specific variables with Parallel Watch Window. This is done by organizing the columns in the way you want.
 
====How to set it up====
 
You can set it up by setting a breakpoint at a line of your interest, then you can debug by pressing F5 and going to Debug -> Windows -> Parallel Watch.
 
====How to use it====
 
Variables can be selected to be put on parallel watch by the user, it will show the value in all the steps for active threads.
 
====Features====
 
Users have the ability to freeze or unfreeze a thread, this allows you to work on other threads while pausing on a specific one you do not want to currently work on.
= Walkthrough =
[[File: sort.png]]
 
 
== Case B: Using the Parallel Stacks Window ==
=== Start Execution Until the 1st Breakpoint ===
[[File: 3rd.png]]
 
=== Resume Execution Until the 4th Breakpoint ===
40
edits

Navigation menu