Changes

Jump to: navigation, search

GPU621/Intel Parallel Studio Inspector.

54 bytes added, 23:23, 8 December 2021
no edit summary
An Intel Inspector window will pop up, with different features. At the top, Intel Inspector lists 3 different types of analysis levels that can be selected.
[[File:Analyszation_Levels.jpg|950px]]
'''Detect Leaks'''<br>
To start a memory analysis, the left-field must be set as “Memory Error Analysis”. After the desired options are checked, the user can click the “start” button located on the right-hand side to begin the analysis.
[[File:Start_Analysis.jpg|950px]]
= Finding Nondeterministic Threading Errors =
Intel Inspector can be used to detect race conditions in programs. The following code is an example of race conditions occurring. In it, 5 threads are created to increment the value of an object several times. A race condition occurs when the threads race for the same data, therefore the value will be inconsistent and output different results. Normally in a data race, it becomes hard to locate data manually but with the help of Intel Inspector, it is much faster.
[[File:RaceConditions.jpg|950px]]
[[File:RaceCondition_Output.jpg|950px]]
''Values below 20000 are caused by race conditions''
Using Intel Inspector we can see where the race condition occurs in the code
[[File:RaceCondition_Inspector.jpg|950px]]
''Indicating where the data race occurs''
Deadlocks can potentially happen when dealing with multi-threads. When 2 threads or more are stuck waiting for each other and trying to access the recourse but are being locked by the previous threads. In case of a deadlock, the program may run fine on the first try but the lock will eventually come up and crash the program. The following program will demonstrate deadlock occurring. The code involves resources protected by mutex locks. Their orders are m1->m2 or m2->m1. In some cases, 2 threads may cause a deadlock when they are waiting for a mutex owned by the other.
[[File:Deadlock_Code.jpg|950px]]
[[File:Deadlock_Output.jpg|950px]]
''Deadlock occurs and the program doesn’t end''
Using Intel Inspector, we can also detect deadlocks in the program
[[File:Deadlock_Inspector.jpg|950px]]
''Points to mutex.lock function''
[[File:Deadlock_Inspector.jpg|950px]]
''Indicating where it occurred in the code''
The intel inspector allows us to quickly locate where the error occurs and we can move on to debug the program and find the optimal solution.
61
edits

Navigation menu