C++ Forever: Interactive Applications in the Age of Manycore

Slides:



Advertisements
Similar presentations
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Advertisements

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Parallel Performance Tools in Visual Studio 2010.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
MIX 09 4/15/ :14 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Interactivity Navigating a data model Working with large quantities of data Entry Editing and adding data User feedback and validation Presentation.
Co- location Mass Market Managed Hosting ISV Hosting.
Windows 7 Training Microsoft Confidential. Windows ® 7 Compatibility Version Checking.
Multitenant Model Request/Response General Model.
Announcing Demo Announcing.
Feature: OLE Notes Migration Utility
Session 1.
travel Suru Windows 7 Release NET 4.0 / Surface 2.0 Release Multi-Touch Controls Multi-Touch API Surface Multi-Touch Controls & API Surface.
Built by Developers for Developers…. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Connect with life Connect with life
NEXT: Overview – Sharing skills & code.
demo Receive Inventory Export Parse and Normalize.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Customer Combiner and Modifier © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
announcing Dev Manager Do I understand what we’ve built? Developer Can I bet on using this shared component? Testers What’s changed since I last.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
demo Instance AInstance B Read “7” Write “8”

customer.
demo © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Parallel Pattern Library Resource Manager Task Scheduler Task Parallel Library Task Parallel Library Parallel LINQ Managed Native Key: Threads Operating.
demo Demo.
demo QueryForeign KeyInstance /sm:body()/x:Order/x:Delivery/y:TrackingId1Z
projekt202 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
The CLR CoreCLRCoreCLR © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.
 Boris Jabes Program Manager Lead Microsoft Corporation TL13.
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

MIX 09 4/17/2018 4:41 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
DoRon Motter Development Lead Microsoft Corporation
MIX 09 5/29/ :31 AM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Jim Nakashima Program Manager – Cloud Tools Microsoft Corporation
Lighting Up Windows Server 2008 R2 Using the ConcRT on UMS
Возможности Excel 2010, о которых следует знать
Title of Presentation 11/22/2018 3:34 PM
Developer Patterns to Integrate Silverlight 4.0 with SharePoint 2010
Office Mac /30/2018 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Title of Presentation 12/2/2018 3:48 PM
Building Modern Windows Applications with Visual C
F# for Parallel and Asynchronous Programming
1/3/2019 1:21 PM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
ASP.NET 4 Core Runtime for Web Developers
Pedro Miguel Teixeira Senior Software Developer Microsoft Corporation
Pablo Castro Software Architect Microsoft Corporation
8/04/2019 9:13 PM © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Windows 8 Security Internals
Виктор Хаджийски Катедра “Металургия на желязото и металолеене”
Jason Zander Unplugged
5/1/2019 3:29 AM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Title of Presentation 5/12/ :53 PM
Шитманов Дархан Қаражанұлы Тарих пәнінің
SharePoint 2013 Authentication with Azure – Part 2
Title of Presentation 5/24/2019 1:26 PM
5/24/2019 6:44 PM 1/8/18 Bell #10 In a world governed by the gods, is there any room for human will? Do human choices make a difference? EXPLAIN © 2007.
日本初公開!? Vista の新機能を実演 とっちゃん わんくま同盟 7/23/2019 9:09 AM
Title of Presentation 7/24/2019 8:53 PM
Coming Together in the Cloud
Building Data-Driven Applications Using "Quadrant" and "M"
What’s New in Visual Studio 2012 for Web Developers
Presentation transcript:

C++ Forever: Interactive Applications in the Age of Manycore 11/15/2018 2:29 AM SVR19         C++ Forever: Interactive Applications in the Age of Manycore Rick Molloy Program Manager Microsoft Corporation © 2007 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.

Demo…

Agenda & Takeaways Expressing Concurrency is easier: Tasks, Parallel Loops and Pipelines Your own parallel patterns A Composable and Scalable Concurrency Runtime Focus on correctness, not scalability Managing Shared State locks and concurrent containers Alternatives with the Agents Library Parallel Development Tools for Productivity

Parallel Computing and PDC09 Tools Managed Languages Visual F# Axum Visual Studio 2010 Parallel Debugger Windows Managed Libraries Native Libraries DryadLINQ Parallel Pattern Library Async Agents Library Profiler Concurrency Analysis Parallel LINQ Rx Task Parallel Library Microsoft Research Data Structures Data Structures Native Concurrency Runtime Race Detection Task Scheduler SVR10 Managed Concurrency Runtime Fuzzing ThreadPool Resource Manager Operating System SVR01 HPC Server Threads SVR18 UMS Threads Operating System Key: Research / Incubation Visual Studio 2010 / .NET 4 Windows 7 / Server 2008 R2

Parallel Pattern Library Concepts    Task: a computation that may be run asynchronously     Task group: a collection of tasks that form a logical computation Parallel Loops: STL style algorithms with support for cancellation and composition

How to express tasks Parallel Tasks Window Parallel Stacks Windows Expressing Tasks demo: tasks How to express tasks Parallel Tasks Window Parallel Stacks Windows

Extensibility: Building a parallel loop template< class InIt,class Pr> inline bool parallel_all_of(InIt first, InIt last, Pr pred) { typedef iterator_traits<InIt>::value_type Item_type; //create a structured task group structured_task_group tasks; auto for_each_predicate = [&pred,&tasks](const Item_type& cur){ if (!pred(cur)) tasks.cancel(); }; auto task = make_task([&](){ parallel_for_each(first, last, for_each_predicate); }); return tasks.run_and_wait(task) != canceled; } template< class InIt,class Pr> inline bool parallel_all_of(InIt first, InIt last, Pr pred) { typedef iterator_traits<InIt>::value_type Item_type; //create a structured task group structured_task_group tasks; auto for_each_predicate = [&pred,&tasks](const Item_type& cur){ if (!pred(cur)) tasks.cancel(); }; auto task = make_task([&](){ parallel_for_each(first, last, for_each_predicate); }); } template< class InIt,class Pr> inline bool parallel_all_of(InIt first, InIt last, Pr pred) { typedef iterator_traits<InIt>::value_type Item_type; //create a structured task group structured_task_group tasks; } template< class InIt,class Pr> inline bool parallel_all_of(InIt first, InIt last, Pr pred) { } template< class InIt,class Pr> inline bool parallel_all_of(InIt first, InIt last, Pr pred) { typedef iterator_traits<InIt>::value_type Item_type; //create a structured task group structured_task_group tasks; auto for_each_predicate = [&pred,&tasks](const Item_type& cur){ if (!pred(cur)) tasks.cancel(); }; }

Cancellation, Composability and Navigating a Sea of Tasks demo: parallel loops Composing Parallelism Parallel Stacks Window Method View Parallel Profiler

Parallel Pattern Library Task Parallelism task_handle task_group structured_task_group Parallel Algorithms parallel_for parallel_for_each parallel_invoke Synchronization Primitives reader_writer critical_section event Concurrent Containers concurrent_queue concurrent_vector combinable <T> more at http://code.msdn.com/concrtextras

Asynchronous Agents Concepts Agent: A coarse-grained application component Sources and Targets (Message Blocks): Participants in message-passing which transport from source to target Co-operative Send and Receive: Utility functions for message passing

Pipelining in Parallel Demo: message blocks Using Message Blocks Parallel Tasks window Locals Window 11/15/2018

Build an Agent What the agent provides A model for state and lifetime management A migration path for threads and thread local state Build an Agent 1. Derive your class from agent 2. Expose only sources and targets publicly 3. Connect your targets in the start routine

Agents are actors class Actor: public agent { overwrite_buffer<int> out; transformer<int,int> trans; public: ISource<int>* output_buf; ITarget<int>* input_buf; … void run(){ //initialize source and target trans.link_target(&out); … } }

Visualize a race condition Avoid it with message passing Demo: shared state Visualize a race condition Avoid it with message passing

Visualize a race condition Serial Code class Widget{ size_t m_width; size_t m_height; public: Widget(size_t w, size_t h):m_width(w),m_height(h){}; size_t GetWidth(){ return m_width; } size_t GetHeight(){ return m_height; void SetWidth(size_t width){ m_width = width; void SetHeight(size_t height){ m_height = height; };

Visualizing a race condition

Visualizing a race condition

Visualize a race condition locked class LockedWidget{ … reader_writer_lock lock; public: size_t GetWidth(){ auto lockGuard = reader_writer::scoped_lock_read(lock); return m_width; } void SetWidth(size_t width){ auto lockGuard = reader_writer::scoped_lock(lock); m_width = width; void SetHeight(size_t height){ auto lockGuard = reader_writer::scoped_lock(lock) m_height = height;

Recognize an unsafe interface We have APIs that need to be coordinated SetWidth and SetHeight We can always fix this by: Introducing more locks Adding acquire release semantics Or… we can coordinate this with message blocks

Coordination message blocks class AgentsWidget{ overwrite_buffer<WidgetDimensions> m_dimensionBuf; public: AgentsWidget(size_t w, size_t h){ send(&m_dimensionBuf,WidgetDimensions(w,h)); }; WidgetDimensions GetDimensions(){ return receive(&m_dimensionBuf); } void UpdateDimensions(size_t width, size_t height){

Interacting with the GUI thread The Basics: Get the work and I/O off of the UI thread Use PostMessage and message blocks to get the work back The Sample Pack provides: ui_task_group a ui message block more at http://code.msdn.com/concrtextras

Asynchronous Agents Library Message Blocks for Storing Data unbounded_buffer<T> overwrite_buffer<T> single_assignment<T> Message Blocks for pipelining tasks transformer<T,U> call<T> Message Blocks for joining data choice join Send and receive co-operatively send & receive messages more at http://code.msdn.com/concrtextras

Parallel Computing and PDC09 Tools Managed Languages Overviews: FT07 & WKSP08 Visual F# FT20 VTL02 Axum FT03 FT19 Visual Studio 2010 Parallel Debugger Windows Managed Libraries Native Libraries DryadLINQ SVR17 FT19 Parallel Pattern Library Async Agents Library Profiler Concurrency Analysis FT21 Parallel LINQ VTL04 Rx Task Parallel Library FT03 VTL32 Microsoft Research Data Structures Data Structures Native Concurrency Runtime Race Detection SVR10 Task Scheduler Managed Concurrency Runtime Fuzzing ThreadPool Resource Manager Operating System SVR01 HPC Server Threads SVR18 UMS Threads Operating System Key: Research / Incubation Visual Studio 2010 / .NET 4 Windows 7 / Server 2008 R2

Parallel Computing and PDC09 Overview FT07: The State of Parallel Programming WKSP08: Patterns of Parallel Programming Managed code in Visual Studio 2010 FT03: Manycore and .NET 4: A Match Made in Visual Studio 2010 FT21: PLINQ: LINQ, but Faster! FT20: F# for Parallel and Asynchronous Programming Native code in Visual Studio 2010 SVR18: Developing Applications for Scale-Up Servers Running Windows Server 2008 R2 SVR10: Lighting up Windows Server 2008 R2 Using the ConcRT on UMS FT19: C++ Forever: Interactive Applications in the Age of Manycore HPC Server SVR01: Accelerating Applications Using Windows HPC Server 2008 Research and Incubation VTL02: Axum: A .NET Language for Safe and Scalable Concurrency VTL32: Concurrency Fuzzing & Data Races SVR17: Data-Intensive Computing on Windows HPC Server with DryadLINQ VTL04: Rx: Reactive Extensions for .NET FT36: Future of Garbage Collection

YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation forms online at MicrosoftPDC.com

channel9.msdn.com/learn 11/15/2018 2:29 AM Learn More On Channel 9 Expand your PDC experience through Channel 9 Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses channel9.msdn.com/learn Built by Developers for Developers…. © 2007 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.

11/15/2018 2:29 AM © 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.

11/15/2018 2:29 AM © 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.