50
edits
Changes
→Interpreting results
Inspector allows you to choose between predefined types of analysis.
[[File:Inspector_03_Threading_analysis_startpage.PNG| 700px]]
Choose the type of Analysis using a '''drop-down menu (2)''':
==='''IntroductionAbout VTune'''===
Intel VTune amplifier is a analysis software that allows you the ability to measure performance of your serial or multithreaded program. VTune allows you to analyze the performance of your algorithms and multithreading. It can help with debugging threads by calculating overhead, finding bottlenecks or inefficiencies.
==='''Configure a projectStarting VTune'''===
When you hover over Intel VTune Amplifier 2019 in the tool’s menu. You will see more options appear.
Select the '''Select configure Analysis.'''option.
[[File:options.PNG | 400px]]
[[File:SetupOptions.PNG | 600px]]
This menu will appear, it contains different tests that you can run against your program. [[File:startup options.PNG | 600px400px]] ==='''Demo'''=== The following is some code from the Matrix Multiplication exercise we did in lab3. It contains 2 versions of the “matMul” function. Change the value of the version macro inside "MatMul.cpp" to run the different versions. *Version 1 – the matrix multiplication logic has been put inside a parallel for statement *Version 2 – the matrix multiplication logic is still inside the parallel for statement, but it is being dynamically scheduled and certain variables are selected to be private or shared. '''[https://github.com/coreyjjames/CoreyJJames/tree/Lab3_VTune_Example Example Code]''' To run the example code, copy the code into Visual Studio and Build it.
==='''Interpreting results'''===
Determining the results from VTune will be a different process for your program then mine.
To be successful make sure to read through the results and look for anomalies.
'''Example of anomalies:'''
*Poor utilization of all the available threads.
*Uneven distribution of the work across the threads.
*High spin or overhead time.
*thread's waiting for no reason.
*Hotspots in the code
'''VTune navigation bar (Depending on the Analysis):'''
*Analysis configuration
**Main configuration page for VTune
**Logs from the analysis
*Summary
**Elapsed Time: this is the amount of time your program took to run***The CPU time: displays the effective, spin and overhead times.**Top Hotspots: Displays the area’s that were most active in your program.**Effective CPU Utilization Histogram: This shows the time your program spent using x number of threads. The graph shows x axis is the moments that your program was a certain number of threads. And the y axis is the time that your program used that number of threads for.**Collection and Platform Info: this display’s all the hardware Display's relevant information about the computer the test was run on.analysis
*Bottom-up
**Allows you to se the call stack of a function starting from the first call.
**Displays the time and the utilization of each thread.
Note:
*When reviewing results pay attention to any red flags that are displayed beside results in VTune. If you hover over them, it will give you more information.
*Almost everything that is in the color red means their is a potential problem.
*OpenMP integration, VTune does have native support for OpenMP some results are generated by VTune specifically for OpenMP.
----
First of all you need to have Intel parallel XE installed on your machine it will allows you to have access to tools such as Intel Advisor, Vtune Amplifier and Inspector on top of your Visual Studio window.
Lets start by creating a project on Visual Studio, I am using a sample code from Intel Advisor folder which they provide different samples for you to test the functionality of it. They can be found under <Your-Installed-Directory>\IntelSWTools\Advisor 2019\samples\en. I am using the "nqueens_Advisor" one. After choosing your project build the solution and look the following Icon from the image below
[[File:Advisor.png|900px]]
[[File:Select.png|250px]]
==='''How it works'''===
[[File:No_lock.png|900px]]
'''1 -''' It displays the selected loop or function for Annotation and tells us the number of errors it contains.
'''2 -''' Here is a very important window since it tells us in detail all the errors that needs to be fixed.
'''3 -''' In this case I selected the P6 error and it tells me in which function it is in and the specific variable affected.
==='''Fixing the problem'''===
We have Identified that there are several problems from the Check Dependencies report lets try to fix one of them.
From the "Dependecies Report - Problem and Messages" Window. right-click any data row and choose Edit Source to open the source file. It will bring you directly to the code of the selected problem.
In my case I selected the previously selected error P6 and the error is because multiple tasks may try and increment nrOfSolutions at the same time. So by adding Lock into it can avoid the multiple access to the variable making it one by one with the following way.
[[File:Lock.png|300px]]
After adding the lock, we build the solution again and re run the 2 analysis following the previous steps. This time we can notice that our Check Dependencies Report has changed
[[File:Refined.png|800px]]
The previous error has disappeared. Notice that previously there were 2 errors in RAW and now there is just one. We can also verify from the "Dependecies Report - Problem and Messages" Window that the previous problem is not there anymore which means it has been fixed.