首页 > 代码库 > Intel 并行性分析
Intel 并行性分析
Lab 2: Analyzing Parallelism
___________________________________________________________________
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 ? 2010, Intel Corporation. All Rights Reserved.Table of Contents
Lab 2: Analyzing Parallelism i
Developer Product Division i
Disclaimer ii
Lab 2: Finding Parallelism Issues 1
Activity 1 – Build the Application 2
Activity 2 – Collect Parallelism Data 3
Activity 3 – Analyze the app‘s Parallelism 4
Lab 2: Finding Parallelism Issues
Time Required | Thirty minutes |
Objective | In this lab session, you will use Intel? VTune? Amplifier XE to determine the amount of parallelism in an application. After successfully completing this lab‘s activities, you will be able to:
|
Activity 1 – Build the Application
Time Required | Ten minutes |
Objective |
|
- Using Microsoft Visual Studio, select File->Open and open the solution file: tachyon_vtune_amp_xe.sln
- Select/highlight the analyze_locks project
- From the top Visual Studio menu select Build->Build analyze_locks
- Verify at the bottom of the Visual Studio screen that it built with no errors
Review Questions
- Did the tachyon.common project build also?
- What was the build configuration for the projects?
Activity 2 – Collect Parallelism Data
Time Required | Ten minutes |
Objective |
|
Codes Description |
|
- Right-click on identify_concurrency in the Solution Explorer window and select "Set As Startup Project"
- Click on the "New Analysis" button
- Select "Algorithm Tuning->Parallelism" 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 applications title bar immediately after the image is completely displayed. You will need this execution time in Lab 3
- After the application completes the Intel? VTune? Amplifier XE will spend some time analyzing the data. When it is finished analyzing, the summary 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? Analyzer is ready to display the analyzed results.
Review Questions
- What is the result screen that appears after clearing the analysis explanation pane?
- What useful data is in this first screen?
Analyze the app‘s Parallelism
Time Required | Twenty minutes |
Objective |
|
Codes Description |
|
- Click the "Bottom-up" tab. Notice the timeline view at the bottom of the screen. It shows the multiple threads that executed as it ran. There are a number of interesting things to notice.
There is a very large amount of thread transition time as indicated by the large amount of yellow color in the top thread graph. It looks like the threads are spending a lot of time transitioning locks between them. - Zoom-in on a yellow portion of the graph by left-clicking and dragging over a 1 second portion of the it. A dialog box appears - select "Zoom in on selection". Now you can see that there is no time in which both worker threads executed at the same time. Something is causing these 2 threads to "take turns" executing and to not execute at the same time!
- Click on the "Undo Previous Zoom Selection" icon to get back to the original timeline view. Notice also that if you move the mouse pointer slowly over the Thread Concurrency graph at the bottom of the screen, the concurrency numbers are always around one. We are not getting any useful parallelism in this app.
Notice also that 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 windows visible so the user has time to see the overall execution time.
Review Questions
- Is this really a parallel application? Did it have more than 1 thread executing simultaneously at any time?