Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tech Ed North America 2010 6/20/2018 7:07 AM Required Slide

Similar presentations


Presentation on theme: "Tech Ed North America 2010 6/20/2018 7:07 AM Required Slide"— Presentation transcript:

1 Tech Ed North America 2010 6/20/2018 7:07 AM Required Slide SESSION CODE: DEV317 Profiling and Debugging Parallel Code with Microsoft Visual Studio 2010 Huseyin Yildiz Software Design Engineer Microsoft Corporation © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2 AGENDA Motivation Recap of Parallel Programming support in Visual Studio 2010 Parallel Profiling Parallel Debugging

3 MOTIVATION Multicore processors are here
Single thread performance is mostly flat Performance burden shifted to software Parallelism libraries now available, and make the job easier Data parallelism, task parallelism, parallel loops, agents Concurrency opens up new challenges for debugging and tuning => Need for targeted tools

4 CONCURRENCY DEVELOPMENT CYCLE
Divide & conquer Express Parallelism Debug Tune - Isolate phases - Identify parallelism opportunities - Data parallelism - Task parallelism - Parallel loops - Remove parallelism blockers - Reduce latency - Find more parallelism opportunities

5 PARALLELISM SUPPORT IN VISUAL STUDIO 2010
Tech Ed North America 2010 6/20/2018 7:07 AM PARALLELISM SUPPORT IN VISUAL STUDIO 2010 Tools Programming models PLINQ Parallel Pattern Library Agents Library Parallel Debugger Task Parallel Library Data structures Data structures Concurrency runtimes Concurrency Visualizer Task Scheduler Task Scheduler Thread Pool Resource manager Resource Manager Operating system Threads Key: Managed library Native library Tools © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

6 PARALLEL PROFILING Tech Ed North America 2010 6/20/2018 7:07 AM
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

7 CONCURRENCY VISUALIZER OVERVIEW
New concurrency-oriented profiler in Visual Studio 2010 Visualizes thread activity on a timeline Per-thread or per-core views of execution states, blocking, I/O etc. Provides very fine grained information Zoom in to individual context switches to track suspicious interactions Or zoom out to look for patterns (good or bad)

8 A STORY BETTER TOLD IN PICTURES

9 CONCURRENCY VISUALIZER OVERVIEW (cont’d)
Sampling profiler, also utilizes existing kernel level event sources Based on ETW technology => very low overhead Not tied to a specific concurrency runtime Includes some visual markers specific to TPL, PPL, PLINQ Supports Native and managed apps 32-bit and 64-bit Windows 7, Windows Server 2008, and Windows Vista

10 GETTING STARTED Run as admin Symbol paths OK?
Enable concurrency option in Performance Wizard

11 CPU UTILIZATION VIEW What it shows How to use it
High level graph of CPU utilization by your process Y-axis covers all available cores Comparison against other processes and idle time How to use it Good starting point for most concurrency profiling scenarios Identify ranges or patterns of overall utilization When was execution truly parallel? When did it get serialized?

12 THREAD VIEW What it shows How to use it
Each thread’s execution over time - down to context switches Call stacks for where a thread got blocked and who unblocked it Sampled call stacks (collected every 1 ms) Disk I/O details on the same timeline How to use it Find root causes of low utilization and long delays When a thread isn’t executing, find out why Blocked? Paging? Preempted? Sleeping? Analyze thread interactions

13 CORE VIEW What it shows How to use Execution activity per core
Individual threads identifiable by color Core migration statistics How to use Identify thread affinity or migration issues Unintended feature: Hunt for garbage collections!

14 Parallel Profiling Case Study
Tech Ed North America 2010 6/20/2018 7:07 AM Parallel Profiling Case Study DEMO © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

15 PATTERNS: SERIALIZATION
Problem: Too much synchronization in parallelized code Signs: Little or no overlapping execution blocks, too frequent blocking Solution: Identify contended lock from blocking call stacks, reduce locking

16 PATTERNS: UNEVEN WORK DISTRIBUTION
Problem: DOP decreases towards the end due to high work granularity Signs: Staircase pattern in a group of related threads as work acquiesces Solution: Revisit work partitioning

17 PATTERNS: OVERSUBSCRIPTION
Problem: Too many active threads competing for CPU time Signs: Checkerboard pattern of execution and preemption blocks Solution: Limit degree of parallelism

18 PATTERNS: INEFFICIENT I/O
Problem: Too much concurrent I/O blocks CPU bound work Signs: Interleaved execution and I/O blocks Solution: Revisit I/O strategy, consider asynchronous I/O

19 CUSTOM MARKERS FOR APPLICATION PHASES
#include "Scenario.h" int _tmain(int argc, _TCHAR* argv[]) { ... myScenario = new Scenario(0, L"Scenario Marker Example", (LONG) 0); myScenario->Begin(0, TEXT(“PHASE1")); // Do actual work for phase 1 here myScenario->End(0, TEXT(“PHASE1")); } Native and managed scenario marker libraries available at

20 PARALLEL DEBUGGING Tech Ed North America 2010 6/20/2018 7:07 AM
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

21 PARALLEL DEBUGGER OVERVIEW
Goal: Help navigate pending and active tasks in the debugger for TPL and PPL applications Two new debugger tool windows: “Parallel Tasks” “Parallel Stacks” Works with native and managed task runtimes Task Parallel Library Parallel Patterns Library

22 PARALLEL TASKS WINDOW List of all unfinished tasks
Which threads they are running on, call stacks Which tasks are blocked, or waiting to run

23 PARALLEL STACKS WINDOW
Zoom control Bird’s eye view Multiple call stacks in a single view Task status Easy navigation to any executing method Rich UI (zooming, panning, bird’s eye view, flagging, tooltips)

24 OTHER DEBUGGING ENHANCEMENTS
DebuggerDisplay and DebuggerProxy attributes for most new managed parallelism-related types Task ,TaskScheduler AggregateException Concurrent collections New synchronization primitives Lazy<T> , ThreadLocal<T> Historical debugging (IntelliTrace) support for Task, QUWI and LazyInitializer

25 Parallel Debugger in Action
Tech Ed North America 2010 6/20/2018 7:07 AM Parallel Debugger in Action DEMO © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

26 RESOURCES MSDN Parallel Computing Dev Center: Team blog: Hazim Shafi’s blog: MSDN article on Concurrency Visualizer: Scenario marker API:

27 Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub. Tech Ed North America 2010 6/20/2018 7:07 AM Track Resources Visual Studio – Soma’s Blog – MSDN Data Developer Center – ADO.NET Team Blog – WCF Data Services Team Blog – EF Design Blog – © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

28 Resources Learning Required Slide www.microsoft.com/teched
Tech Ed North America 2010 6/20/2018 7:07 AM Required Slide Resources Learning Sessions On-Demand & Community Microsoft Certification & Training Resources Resources for IT Professionals Resources for Developers © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

29 Complete an evaluation on CommNet and enter to win!
Tech Ed North America 2010 6/20/2018 7:07 AM Required Slide Complete an evaluation on CommNet and enter to win! © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

30 Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31st
You can also register at the North America 2011 kiosk located at registration Join us in Atlanta next year

31 Tech Ed North America 2010 6/20/2018 7:07 AM
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

32 CPU UTILIZATION VIEW CLOSE-UP
Number of cores CPU Utilization of other processes CPU Utilization of the target process Idle time

33 THREAD VIEW CLOSE-UP Zoom control and time axis
Ruler tool for custom time measurements One lane per thread Thread activity (color coded execution states) Usage Hints Activity Legend Call Stacks available for each “sample” Who unblocked this thread?

34 CORE VIEW CLOSE-UP Execution on each core One lane per logical core
One color per thread Cross-core migration statistics

35 Required Slide Tech Ed North America 2010 6/20/2018 7:07 AM
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.


Download ppt "Tech Ed North America 2010 6/20/2018 7:07 AM Required Slide"

Similar presentations


Ads by Google