Difference between revisions of "GPU621/Group 2"
(→Threads Window) |
m (→Threads Window) |
||
Line 37: | Line 37: | ||
[[File:ThreadsWindow.png]] | [[File:ThreadsWindow.png]] | ||
− | The threads window | + | The threads window provides a detailed display of every thread running in your application. Here, you can observe the steps each thread takes and how each thread affects the data of your application, along with a number of other features like searching for specific threads, applying filters on what threads to display, freezing threads in place, etc. |
=== Switching Threads === | === Switching Threads === |
Revision as of 15:00, 10 March 2023
GPU621/DPS921 | Participants | Groups and Projects | Resources | Glossary
Contents
Group Members
Definitions
Processes
Every process is a separate instance of a particular program that is being run on a computer.
Threads
Threads are sets of instructions that get executed by the processes that contain them. The existence of multiple threads enables a process to separate work to be performed in parallel.
Debugging Single-threaded V.S. Multi-threaded Programs
Debugging usually occurs on a single threaded program by pausing the execution at a specific line of code. While the execution is paused, the values of all the variables can be inspected. This can be helpful to closely view what is occurring between each line of code.
Debugging a multithreaded program is different from debugging a single threaded program because each thread has its own sequence of execution, meaning that the point that the execution is paused at can vary for each thread.
OpenMP Debugging in Visual Studio
Debugging in Visual Studio will be demonstrated using this code:
#include <stdio.h>
#include <omp.h>
int main() {
int numThreads = omp_get_max_threads();
printf("Number of threads: %d\n", numThreads);
#pragma omp parallel
{
int threadNum = omp_get_thread_num() + 1;
printf("Hello thread #%d\n", threadNum);
}
printf("End of program");
}
Threads Window
The threads window provides a detailed display of every thread running in your application. Here, you can observe the steps each thread takes and how each thread affects the data of your application, along with a number of other features like searching for specific threads, applying filters on what threads to display, freezing threads in place, etc.