Open main menu

CDOT Wiki β

Changes

GPU621 Team 1

7,439 bytes removed, 11:29, 5 December 2016
Replaced content with "[https://wiki.cdot.senecacollege.ca/wiki/DPS921_Team_1 Please go to this page title]"
 == What is VTune Amplifier? == Application that apply different analysis to your program<br />Helps programmer debugs and improve program <br />Provide GUI version <br />It has both a standalone and a IDE add-on <br /> == Where To Get Vtune ? == Price: $899 <br/>Window / Linux <br/>Free Software Tools <br/>- Students <br/>- Educators <br/>- Academic researchers <br/>- Open source contributors <br/>   [https://softwarewiki.intelcdot.com/en-us/intel-vtune-amplifier-xe/try-buy Download Vtune Here] == Getting Started ==When using VTune Amplifier the following page will shows <br />[[File:Tim getstart 1senecacollege.png|200px]]<br ca/>First you need create a project.A project will have can save more than one Analysis. Therefore, you can compare the different analysis and this helps you to compare the code you change. [[File:Tim getstart 2.png|200px]]<br wiki/>After the project is created. You need DPS921_Team_1 Please go to it will automatically start a Analysis. You need to locate your program and setup the parameters as well. You need need to change the working directory if the default one is not correct. [[File:Tim getstart 3.png|200px]]<br />In this tab you can choose any Analysis type and run the analysis. In the following turtoral we did not use the VTune Amplifier program. We use the Visual Studio with the VTune Amplifier. This way it will set up the program location, parameters and working directory for you automatically.<br /><br /> == VTune Tutorial 1: Finding HotSpot ==[[File:1.png|400px]] This example program will be downloaded when you install VTune Amplifier. Following is the directory that contain the sample code from Intel. [Program Files]\IntelSWTools\VTune Amplifier XE <version>\samples\en\C++\tachyon_vtune_amp_xe.zipOpen the project using Visual Studio. Then you can run the the VTune Amplifier and click new Analysis. (You need to download Vtune Amplifier to have that tab on Visual Studio)<br /> [[File:Tim Hotspt 2.png|400px]] This should be the next page you will get. You begin to choose different type of Analysis here. We are going do a Basic Hotpots Analysis.Then click start to start the Analysis.<br /> [[File:Tim Hotspt 3.png|400px]] The program should run itself after you begin.You will notice that the image is loading from the bottom to the top. After the program finish running, it will take a while for Amplifer to generate report. <br /> [[File:Tim Hotspt 4.png|400px]] After the program finish running, it will take a while for Amplifer to generate report. <br /> [[File:Tim Hotspt 5.png|400px]] The first page will shows a summary of the program.The time it took, the top hotspots, CPU usage etc. We will focus looking at the Hotspots table. we notice that the "initialize_2D_buffer" use the most the CPU time. If you look at the code on ''find_hotspots.cpp'' you will notice it is actually one function in side that cpp file<br /> [[File:Tim Hotspt 7.png|400px]] We go to the bootom up tab. it will give you a graph that shows the Hotspots table you got. You can clearly see that "initialize_2D_buffer" use the most time compare to the other function.<br /> [[File:Tim Hotspt 8.png|400px]] If we double click on this function we it will shows the sources code and shows you which line of the code actually use the most time in the specific function. Now we can tell that most of the time are spend on the while loop.<br /> [[File:Tim Hotspt 9.png|400px]] To compare a paralleled version of this code I already have a program that use CILK PLUS to parallelize that program. Below is the link to download that code. Simply replace the ''find_hotspots.cpp'' with this code, build it and run the Analysis again.  Link:[[File:Find hotspots.zip]] [[File:Tim hotspot 15.PNG|150px]] [[File:Tim hotspot 13.PNG|400px]] [[File:Tim hotspot 14.PNG|500px]] This is the code we change. <br />- First we change to header to allow Cilk Plus. <br />- Second we comment the bad slow method from "initialize_2D_buffer" and use the faster method. <br />- Third we add some Cilk Plus code to make it the program run in parallel. <br />  [[File:Tim Hotspt 10.png|400px]] When you run the Analysis this time you will see the program image load at the same time in different level instead of loading from the bottom to the top.<br />  [[File:Tim Hotspt 11.png|400px]] This time we should able to see that the Elased Time is shorter than the old time about 10second and the Top Hotspot is no longer "initialize_2D_buffer".<br />  [[File:Tim Hotspt 12.png|400px]] If we go to bottom up tab you can see that the "initialize_2D_buffer" is no longer exist and it shows the Cilk worker graph that shows the program is not run a parallel. <br /><br /> == VTune Tutorial 2: Locks and Wait Tutorial == Reference: https://software.intel.com/en-us/node/471876 Work Flow of Analyzing locks and waits: [[File:1.gif]] The sample application we are using for this tutorial is called "tachyon".  For application configuration options, setup instruction, and to get the file refer to this: https://software.intel.com/en-us/node/471878 Run the program for the first time to get the baseline run time to compare with consequent results. The baseline run time for this sample is: 16.484s. [[File:2.GIF]] Run locks and waits analysis on the sample application. Refer to this to learn how to run the analysis: https://software.intel.com/en-us/node/471882.  Interpret the data result from the analysis. To interpret the data on the sample code performance, do the following: Analyze the basic performance metrics provided by the Locks and Waits analysis. Identify locks.  Analyze the basic performance metrics provided by the Locks and Waits analysis: [[File:11.PNG]]  To identify the cause, you need to understand how this Wait time was distributed per synchronization objects. The Top Waiting Objects section provides a list of sync objects and the wait time, and other metrics for each object. [[File:12.PNG]] The first few sync objects (that have the highest wait time) should be analyzed.  Thread Concurrency Histogram: [[File:13.PNG]] Most of the elapsed application time occurs for 1 thread running. This is poor concurrency of threads.  [[File:14.PNG]] Most of the elapsed application time occurs for 1-2 CPU running simultaneously. This is poor concurrency.  [[File:15.PNG]] Clicking on the "Bottom-Up" panel, will display more details about the sync objects.  Having found, the sync objects that is causing extreme wait time. We need to look at the code and see if we can change it.  In the "Bottom-Up" panel, click on sync objects and then click on the function that uses the sync object. This will open a window that shows the code. [[File:16.PNG]]  Lastly, modify the code to fix the locks.  Re-build and re-run the application and compare results. == VTune Tutorial 3: Disk input Output Analysis ==   == Resources ==Getting Started with Intel® VTune™ Amplifier XE 2017 for Windows* OS https://software.intel.com/en-us/node/564483 <br />Examples with code vtune components and tutorials https://software.intel.com/en-us/articles/intel-vtune-amplifier-tutorials <br />Vtune hotspot video by intel https://www.youtube.com/watch?v=i3d7XYjxuaQ <br />Vtune with MPI program https://software.intel.com/en-us/videos/getting-started-using-mpi-with-intel-vtune-amplifier-xe == Presentation == [https://docs.google.com/presentation/d/1zCTrwVQe-oJmkgK0mWI35bUyyqOtJHZYl9QEmmjgpb8/edit?usp=sharing Link To Google Slides Presentationtitle]