Lab 1: Finding Hotspots
___________________________________________________________________
Developer Product Division
寻找热点
Disclaimer
The information contained in this document is provided for informational
purposes only and represents the current view of Intel Corporation ("Intel") and
its contributors ("Contributors") on, as of the date of publication. Intel and
the Contributors make no commitment to update the information contained in this
document, and Intel reserves the right to make changes at any time, without
notice.
DISCLAIMER. THIS DOCUMENT, IS PROVIDED "AS IS." NEITHER INTEL, NOR THE
CONTRIBUTORS MAKE ANY REPRESENTATIONS OF ANY KIND WITH RESPECT TO PRODUCTS
REFERENCED HEREIN, WHETHER SUCH PRODUCTS ARE THOSE OF INTEL, THE CONTRIBUTORS,
OR THIRD PARTIES. INTEL, AND ITS CONTRIBUTORS EXPRESSLY DISCLAIM ANY AND ALL
WARRANTIES, IMPLIED OR EXPRESS, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR ANY PARTICULAR PURPOSE, NON-INFRINGEMENT, AND ANY
WARRANTY ARISING OUT OF THE INFORMATION CONTAINED HEREIN, INCLUDING WITHOUT
LIMITATION, ANY PRODUCTS, SPECIFICATIONS, OR OTHER MATERIALS REFERENCED HEREIN.
INTEL, AND ITS CONTRIBUTORS DO NOT WARRANT THAT THIS DOCUMENT IS FREE FROM
ERRORS, OR THAT ANY PRODUCTS OR OTHER TECHNOLOGY DEVELOPED IN CONFORMANCE WITH
THIS DOCUMENT WILL PERFORM IN THE INTENDED MANNER, OR WILL BE FREE FROM
INFRINGEMENT OF THIRD PARTY PROPRIETARY RIGHTS, AND INTEL, AND ITS CONTRIBUTORS
DISCLAIM ALL LIABILITY THEREFOR. INTEL, AND ITS CONTRIBUTORS DO NOT WARRANT THAT
ANY PRODUCT REFERENCED HEREIN OR ANY PRODUCT OR TECHNOLOGY DEVELOPED IN RELIANCE
UPON THIS DOCUMENT, IN WHOLE OR IN PART, WILL BE SUFFICIENT, ACCURATE, RELIABLE,
COMPLETE, FREE FROM DEFECTS OR SAFE FOR ITS INTENDED PURPOSE, AND HEREBY
DISCLAIM ALL LIABILITIES THEREFOR. ANY PERSON MAKING, USING OR SELLING SUCH
PRODUCT OR TECHNOLOGY DOES SO AT HIS OR HER OWN RISK.
Licenses may be
required. Intel, its contributors and others may have patents or pending patent
applications, trademarks, copyrights or other intellectual proprietary rights
covering subject matter contained or described in this document. No license,
express, implied, by estoppels or otherwise, to any intellectual property rights
of Intel or any other party is granted herein. It is your responsibility to seek
licenses for such intellectual property rights from Intel and others where
appropriate. Limited License Grant. Intel hereby grants you a limited copyright
license to copy this document for your use and internal distribution only. You
may not distribute this document externally, in whole or in part, to any other
person or entity. LIMITED LIABILITY. IN NO EVENT SHALL INTEL, OR ITS
CONTRIBUTORS HAVE ANY LIABILITY TO YOU OR TO ANY OTHER THIRD PARTY, FOR ANY LOST
PROFITS, LOST DATA, LOSS OF USE OR COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES, OR FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF YOUR USE OF THIS DOCUMENT OR RELIANCE UPON THE INFORMATION CONTAINED
HEREIN, UNDER ANY CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF
WHETHER INTEL, OR ANY CONTRIBUTOR HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH
DAMAGES. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE
ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.
Intel and Intel logo are trademarks or registered trademarks of Intel
Corporation or its subsidiaries in the United States and other countries.
*Other names and brands may be claimed as the property of others.
Copyright
? 2009, Intel Corporation. All Rights Reserved.Table of Contents
Developer Product
Division i
Disclaimer ii
Lab 1: Finding
Hotspots 1
Activity 1 – Build the
Application 2
Activity 2 – Collect Performance
Data 3
Activity 3 – Find the
Hotspot 4
Lab 1: Finding Hotspots
Time |
Forty |
Objective |
In After
|
Activity 1 – Build the Application
Time |
Ten |
Objective |
|
- Using
Microsoft Visual Studio, select File->Open->Project/Solution and open
the solution file: tachyon_vtune_amp_xe.sln - Maximize
the Microsoft Visual Studio screen by double clicking on the title bar. - Verify
that Release is the selected Solution Configuration in the left hand pulldown
window near the top of the Visual Studio screen - Select/highlight
the find_hotspots project in the Solution Explorer pane - From the
top Visual Studio menu select Build->Build find_hotspots - Verify
at the bottom of the Visual Studio screen that it built with no errors. It
should indicate that 2 projects succeeded in being built
Review
Questions
- Did the
tachyon.common project build also? - How many
source files are in the find-hotspots project?
Activity 2 – Collect Performance Data
Time |
Fifteen |
Objective |
|
- Right-click on
find_hotspots in the Solution Explorer window and select "Set As Startup
Project." The project name "find_hotspots" will be displayed as bold
characters. - Click on
the "New Analysis" button - Select
"Algorithm Tuning->Hotspots" in the analysis type pane - Click
"Analyze" – The tachyon application will run. Note that as the application
runs it draws and image of several different silver balls on the screen.
Notice the execution time displayed in the application‘s title bar immediately
after the image is completely displayed. - After
the application completes the Intel? VTune? Amplifier XE will spend some time
analyzing the data. When it is finished analyzing, the Hotspots pane appears.
Note the analysis explanation pane comes up. Read it and then clear the
pane.
At this point the application has run to completion and the
Intel? VTune? Amplifier XE 2011 displays the analyzed results.
Review
Questions
- What is
the result screen that appears after clearing the analysis explanation pane? - Which
function used the most CPU time?
Activity 3 – Find the Hotspot
Time |
Twenty |
Objective |
|
- Make
sure the "Bottom-up" tab is highlighted. The functions in the tachyon program
will be listed in order of execution time. Notice the Timeline View at the
bottom of the screen. This shows the various states of the threads in the
program and the number of CPUs used as the program ran. There seems to be
very little CPU usage or thread execution near the end of the program. This
is the phase of the program in which it finished but kept the application
window visible so the user has time to see the overall execution time. Notice
also that there is only 1 thread shown with any significant execution time. - Go back
to looking at the function list at the top of the result screen. The
functions grid_intersect and sphere_intersect will be at the top of the list,
but there is another function that seems to have used a surprisingly large
amount of CPU time given what it does: initialize_2D_buffer. - Click on
the arrow to the left of the function name initialize_2D_buffer .
Notice the different calling sequences into that function, and to see the
relative amounts of execution time generated by those calling sequences. In
this case there appears to be only 1. - Double
click on the function name initialize_2D_buffer. The source code for that
function is displayed at the hottest point in that function along with
assembly code to the right. Each source and assembly statement is annotated
with execution time on the right.
Vertical panes to the right of the
source and assembly vertical scroll bars show relative position and density of
execution time throughout the view. Scroll up and down to see that. - Note the
comments surrounding the nested for loops in lines 77-87 that contain the
statement that consumed the most CPU time, line number 84.
To show the
use of the hotspot collector the source code has 2 different ways of
explicitly initializing the code. One referencing sequential memory locations
(the "faster" method) and one using a slower, non-sequential method). - Use
Visual Studio to comment out the slower method, rebuild the app (as was done
in Activity 1) and run it. Note the faster execution time. - Rerun
Piersol HE‘s Hotspots profiling mode. After it runs and Piersol HE shows the
results, notice that "initialize_2D_buffer" is much further down the function
list and took less time.
Review
Questions
- How much
faster was the modified application? - At what
point in the program does the CPU usage drop off? - Which
function took the most time in the optimized version?
Intel 寻找热点,布布扣,bubuko.com