stephen toub senior program manager lead microsoft session code: dtl203

Download Stephen Toub Senior Program Manager Lead Microsoft Session Code: DTL203

If you can't read please download the document

Upload: dominick-james

Post on 08-Jan-2018

218 views

Category:

Documents


0 download

DESCRIPTION

Agenda Why Parallelism, Why Now? Today’s difficulties Tomorrow’s solutions Demos along the way

TRANSCRIPT

Stephen Toub Senior Program Manager Lead Microsoft Session Code: DTL203 Agenda Why Parallelism, Why Now? Todays difficulties Tomorrows solutions Demos along the way Moores Law The number of transistors incorporated in a chip will approximately double every 24 months. Gordon Moore Intel Moores Law: Alive and Well? More than 1 billion transistors in 2006! More than 1 billion transistors in 2006! The number of transistors doubles every two years ,000 10,000 Moore's Law: Feel the Heat 10 Watts 100 Watts Watts 12 Watts 20 Watts 52 Watts 81 Watts 110 Watts 150 Watts Moore's Law: But Different 1 GHz 10 GHz MHz 600 MHz 2 GHz 3 GHz 3.6 GHz 3.8 GHz 1 GHz Frequencies will NOT get much faster! Maybe 5 to 10% every year or so, a few more times And these modest gains would make the chips LOTS hotter! Hardware Paradigm Shift we see a very significant shift in what architectures will look like in the future... fundamentally the way we've begun to look at doing that is to move from instruction level concurrency to multiple cores per die. But we're going to continue to go beyond there. And that just won't be in our server lines in the future; this will permeate every architecture that we build. All will have massively multicore implementations. Intel Developer Forum, Spring 2004 Pat Gelsinger Chief Technology Officer, Senior Vice President Intel Corporation February, 19, ,000 1, 7080900010 Power Density (W/cm 2 ) Pentium processors Hot Plate Nuclear Reactor Rocket Nozzle Suns Surface Intel Developer Forum, Spring Pat Gelsinger Todays Architecture: Heat becoming an unmanageable problem! Many-core Peak Parallel GOPs Single Threaded Perf 10% per year To Grow, To Keep Up, We Must Embrace Parallel Computing GOPS 32,768 2, Parallelism Opportunity 80X Disruption & Opportunity The Manycore Shift [A]fter decades of single core processors, the high volume processor industry has gone from single to dual to quad-core in just the last two years. Moores Law scaling should easily let us hit the 80-core mark in mainstream processors within the next ten years and quite possibly even less. -- Justin Rattner, CTO, Intel (February 2007)Justin Rattner If you havent done so already, now is the time to take a hard look at the design of your application, determine what operations are CPU-sensitive now or are likely to become so soon, and identify how those places could benefit from concurrency. -- Herb Sutter, C++ Architect at Microsoft (March 2005)Herb Sutter I'm convinced now what? Multithreaded programming is hard today Doable by only a subgroup of senior specialists Parallel patterns are not prevalent, well known, nor easy to implement So many potential problems Businesses have little desire to go deep Best devs should focus on business value, not concurrency Need simple ways to allow all devs to write concurrent code Example: Race Car Drivers IEnumerable drivers =...; var results = new List (); foreach(var driver in drivers) { if (driver.Name == queryName && driver.Wins.Count >= queryWinCount) { results.Add(driver); } results.Sort((b1, b2) => b1.Age.CompareTo(b2.Age)); Manual Parallel Solution IEnumerable drivers = ; var results = new List (); int partitionsCount = Environment.ProcessorCount; int remainingCount = partitionsCount; var enumerator = drivers.GetEnumerator(); try { using (var done = new ManualResetEvent(false)) { for(int i = 0; i < partitionsCount; i++) { ThreadPool.QueueUserWorkItem(delegate { while(true) { RaceCarDriver driver; lock (enumerator) { if (!enumerator.MoveNext()) break; driver = enumerator.Current; } if (driver.Name == queryName && driver.Wins.Count >= queryWinCount) { lock(results) results.Add(driver); } if (Interlocked.Decrement(ref remainingCount) == 0) done.Set(); }); } done.WaitOne(); results.Sort((b1, b2) => b1.Age.CompareTo(b2.Age)); } finally { if (enumerator is IDisposable) ((IDisposable)enumerator).Dispose(); } LINQ Solution var results = from driver in drivers where driver.Name == queryName && driver.Wins.Count >= queryWinCount orderby driver.Age ascending select driver; Visual Studio 2010 Tools/Programming Models/Runtimes Parallel Pattern Library Resource Manager Task Scheduler Task Parallel Library Task Parallel Library Parallel LINQ Managed Native Key: Threads Operating System Concurrency Runtime Programming Models ThreadPool Task Scheduler Resource Manager Data Structures Tools Tooling Parallel Debugger Tool Windows Parallel Debugger Tool Windows Profiler Concurrency Analysis Profiler Concurrency Analysis Agents Library UMS Threads.NET Framework 4 Visual C++ 10 Visual Studio IDE Visual Studio IDE Windows What Can I Do with These Cores Offload Free up your UI Go faster whenever you can Parallelize the parallelizable Do more Use more data to get better results Add more features Speculate Prefetch, Preprocess Multiple solutions Amdahls Law Maximum speedup: Sk speed-up factor for portion k Pk percentage of instructions in portion k that can parallelized Simplified: P percentage of instructions that can be parallelized N number of processors Amdahl by Example Theoretical maximum speedup determined by amount of sequential code Gustafsons Law Reevaluating Amdahl's Law P number of processors the non-parallelizable part of the process S percentage of parallelizable instructions Paraphrased Dont consider a fixed problem size, consider what can be done within a fixed time period Do more stuff in the same time Takeaways The Manycore Shift is happening Parallelism in your code is inevitable Visual Studio 2010 can help Platform.NET Framework 4.0 Visual C++ 10 Tooling Debugging Profiling Beta available soon! This is just the beginning Related Content Breakout Sessions DTL203 The Manycore Shift: Making Parallel Computing Mainstream DTL329 Parallel Computing APIs with the Microsoft.NET Framework 4.0 DTL310 Parallel Computing with Native C++ in Microsoft Visual Studio 2010 DTL309 Busy Microsoft.NET Developer's Guide to F# DTL303 A Whirlwind Tour of the Microsoft.NET Framework 4.0 WSV317 New NUMA Support with Windows 7 and Windows Server 2008 R2 Interactive Theater Sessions DTL06-TLC Task-Based Parallel Programming with the Microsoft.NET Framework 4.0 Hands-on Labs DTL11-HOL Parallel Extensions: Building Multicore Applications with the Microsoft.NET Framework DTL Track Resources Visit the DPR TLC for a chance to win a copy of Visual Studio Team Suite. Daily drawing occurs every day in the TLC at 4:15pm. Stop by for a raffle ticket. Please visit us in the TLC blue area Sessions On-Demand & CommunityResources for IT ProfessionalsResources for DevelopersMicrosoft Certification and Training ResourcesMicrosoft Certification & Training Resources Resources Complete an evaluation on CommNet and enter to win! 2009 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.