MAXIMISE.NET WITH C++ FOR INTEROP, PERFORMANCE AND PRODUCTIVITY Angel Hernandez Avanade Australia (c) 2011 Microsoft. All rights reserved. SESSION CODE:

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.
© 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.
MVC - LESSONS LEARNT FROM BEING BURNT Malcolm Sheridan - Quantitative Project Leader ANZ SESSION CODE: #WEB306.
Adding Value to Software Projects with VSTO Jake Ginnivan B: jake.ginnivan.net SESSION CODE: DEV304 (c) 2011 Microsoft. All rights reserved.
FUJITSU’S USER INITIATED WINDOWS 7 MIGRATION SESSION CODE: SEC201 (c) 2011 Microsoft. All rights reserved. “….most organizations will not be able to migrate.
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.
Windows 7 Training Microsoft Confidential. Windows ® 7 Compatibility Version Checking.
NEW WINDOWS PHONE “MANGO” APPLICATION PLATFORM SERVICES Chris blog.walshie.me SESSION CODE: WPH304 (c) 2011 Microsoft. All rights.
BUILDING HYBRID APPS WITH DYNAMICS CRM & WINDOWS AZURE Guy Riddle & George Doubinski Dynamics CRM MVP’s SESSION CODE: DEV-DYN-MID306 (c) 2011 Microsoft.
C++ Accelerated Massive Parallelism in Visual C Kate Gregory Gregory Consulting DEV334.
Session 1.
Built by Developers for Developers…. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
WinHEC /22/2017 © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
© 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.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
DISPOSABLE ARCHITECTURE Daniel Beaty Disposable Architect Objectify/Xamling DisposableArchitect.com SESSION CODE: #ARC-MID204 (c) 2011 Microsoft. All.
Ian Ellison-Taylor General Manager Microsoft Corporation PC27.
WINDOWS PHONE FIRST UP/ ALL UP Nick Randolph (Built to Roam) Dave Glover (Microsoft) SESSION CODE: #WPH202 (c) 2011 Microsoft. All rights reserved.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
Please visit m.ausalgo.com on your device and sign inm.ausalgo.com.

customer.
CONNECTING PHONE APPLICATIONS TO THE CLOUD Nick Randolph (Built to Roam) SESSION CODE: COS-WPH208 (c) 2011 Microsoft. All rights reserved.
INTRODUCTION TO WINDOWS AZURE APPFABRIC COMPOSITE APPLICATIONS Lewis Benge Creative Technologist Whybin\TBWA\Tequila SESSION CODE: COS-MID306.
JAVASCRIPT WITH A VIEW Jordan Knight Solution Architect Xamling SESSION CODE: WEB305 (c) 2011 Microsoft. All rights reserved.
demo © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
MICROSOFT SYSTEM CENTER OPALIS MEETS SHAREPOINT, ACTIVE DIRECTORY AND... Glenn Morris Microsoft Certified Trainer, Solution Architect Talisman Technology.
This deck has 1-, 2-, and 3- slide variants for C++ AMP If your own deck uses 4:3, get with the 21 st century and switch to 16:9 ( Design tab, Page Setup.
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.
KILLER REAL-WORLD POWERPIVOT EXAMPLES Grant Paisley SQL Server MVP Angry Koala SESSION CODE: DAT303 (c) 2011 Microsoft. All rights.
2 Screens and A Cloud, Without Being Cut! An MMO in 45 Minutes DEV305.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
UNLOCK THE POWER OF USER DEVICE AFFINITY IN SCCM 2012 James SESSION CODE: #SEC309.
CREATING CUSTOM WINPE 3.0 BOOT IMAGES Johan Arwidmark Chief Technical Architect Knowledge Factory SESSION CODE: CLI303 (c) 2011 Microsoft. All rights.
POWERSHELL ABOVE AND BEYOND: GUIS, WORKFLOWS, AND MORE Dean Corcoran Partner Service Account Manager (Cloud) – MCT – MCITP:EA Microsoft Australia SESSION.
MULTI-TASKING AND APPLICATION SERVICES IN WINDOWS PHONE 7.5 Chris blog.walshie.me SESSION CODE: WPH305 (c) 2011 Microsoft. All rights.
OVER THE FENCE DESIGNER DEVELOPER WORKFLOW Jordan & Alex Knight Directors Xamling SESSION CODE: DEV203 (c) 2011 Microsoft. All rights reserved.

OFFICE DEPLOYMENT FOR THE ELITE Yoni Kirsh Managing Director Fastrack Technology SESSION CODE: OFS308 (c) 2011 Microsoft. All rights reserved.
THE SOURCE OF 4 TH & MAYOR: CODE, HACKS, TRICKS Jeff Wilcox Senior Software Development Engineer Microsoft SESSION CODE: WPH308 (c) 2011 Microsoft. All.
THE FUTURE OF C#: GOOD THINGS COME TO THOSE WHO ‘AWAIT’ Joseph Albahari SESSION CODE: DEV411 (c) 2011 Microsoft. All rights reserved.
HETEROGENEOUS DEVELOPMENT WITH VISUAL STUDIO 2010 Mitch Denny Chief Technology Officer Readify SESSION CODE: #DEV307 (c) 2011 Microsoft. All rights reserved.
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.
The Challenges of moving Document Creation to the Cloud
Domain Driven Design, Domain Events and Unit Testing
Title of Presentation 12/2/2018 3:48 PM
Migrating XP to Windows 7 using ConfigMgr 2007
MAP & ACT Pre deployment planning for Windows 7 or Server 2008 R2
What’s new for Silverlight & XNA developers in Windows Phone Mango
(c) 2011 Microsoft. All rights reserved.
Migrating your applications to Azure
The Essential Windows Azure Developers Toolkit
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
Hyper-V server deployment - Using the right tools
Виктор Хаджийски Катедра “Металургия на желязото и металолеене”
(c) 2011 Microsoft. All rights reserved.
(c) 2011 Microsoft. All rights reserved.
Шитманов Дархан Қаражанұлы Тарих пәнінің
Title of Presentation 5/24/2019 1:26 PM
Presentation transcript:

MAXIMISE.NET WITH C++ FOR INTEROP, PERFORMANCE AND PRODUCTIVITY Angel Hernandez Avanade Australia (c) 2011 Microsoft. All rights reserved. SESSION CODE: DEV301

regex_searchregex_search replace_ifreplace_if thread_localthread_local find_if_notfind_if_not VisualC++VisualC++ binary_searchbinary_search setlocalesetlocale s t d :: v e c t o r s t d :: c o u t inlineinline typedeftypedef make_pairmake_pair s t d :: f o r _ e a c h getlinegetline volatilevolatile sleep_forsleep_for templatetemplate void(*ptr)void(*ptr) dynamic_castdynamic_cast bitsetbitset is_sortedis_sorted #include<iostream>#include<iostream> LambdasLambdas nullptrnullptr mutexmutex.. : ¦

Agenda ► What’s going on with C++ these days? ► C++ is the champion of speed ► Best situations for C++ ► C++/CLI ► Commonly used techniques for interop ► Native code without sacrificing.NET performance ► C++ and the cloud ► Introducing C++ AMP ► Basic Elements of C++ AMP Coding ► C++ AMP at a Glance (c) 2011 Microsoft. All rights reserved.

What’s going on with C++ these days? ► The new standard C++11 (previously known as C++0x) will be released soon ► Native support for multi-threaded applications ► New smart pointer classes, algorithms and containers ► Lambda expressions ► Automatic Type Deduction and decltype ► Lots more! (c) 2011 Microsoft. All rights reserved.

C++ is the champion of speed! (c) 2011 Microsoft. All rights reserved.

Best situations for C++ ► Graphical and audio workstation software ► Large-scale productivity applications like Adobe Photoshop ► Legacy codebases ► Real-time systems of all sizes and descriptions ► Anything involving extreme numerical computation ► Large-scale data storage and retrieval ► Device drivers ► And so forth (c) 2011 Microsoft. All rights reserved.

C++/CLI ► C++/CLI is a binding between the standard C++ programming language and the CLI. ► C++/CLI lets developers reuse their native code base, saving the agony of rewriting it all to run on the.NET Framework. ► C++/CLI is designed to be the lowest-level language for the.NET framework. (c) 2011 Microsoft. All rights reserved.

C++/CLI (cont.) ► C++ developers can Leverage their existing C++ knowledge to write powerful managed applications ► C++/CLI allows developers to leverage the latest managed frameworks ► C++/CLI is the most powerful language for interop (Marshalling made easy!) (c) 2011 Microsoft. All rights reserved.

Commonly used techniques for Interop ► Straightforward P/Invoke – [DllImport] & [MarshalAs] ► COM Interop ► C++/CLI wrapper class ► CALLI Instruction (Reflection.Emit) (c) 2011 Microsoft. All rights reserved.

Native code without sacrificing.NET performance ► Things to consider: – Mode Transition (Moving data between the managed & unmanaged modes of operation) – Marshalling the data to move across the boundary Marshalling is computationally expensive and the more data you move back and forth, the more expensive it becomes. (c) 2011 Microsoft. All rights reserved.

Native code without sacrificing.NET performance (cont.) ► Ways to transition code & data: – Traditional DLLs (code) – COM-based DLLs (code) – Marshalling (data) – Implement any IPC mechanism (data) (c) 2011 Microsoft. All rights reserved.

C++ and the cloud ► We can leverage the power of C++ with Windows Azure ► Microsoft refreshes C++ for the cloud Not for this version though…. (c) 2011 Microsoft. All rights reserved.

Introducing C++AMP (c) 2011 Microsoft. All rights reserved. What – Part of C++ & Visual Studio – STL-like library for parallel patterns on large arrays – Builds on Direct3D – open spec Why – Performance – Productivity – Portability How #include #include using namespace concurrency; void AddArrays(int n, int *pA, int *pB, int *pC) { array_view a(n, pA); array_view a(n, pA); array_view b(n, pB); array_view b(n, pB); array_view sum(n, pC); array_view sum(n, pC); parallel_for_each( sum.grid, parallel_for_each( sum.grid, [=](index idx) restrict(direct3d) { [=](index idx) restrict(direct3d) { sum[idx] = a[idx] + b[idx]; sum[idx] = a[idx] + b[idx]; } ); );}

Matrix Multiply (C++ AMP Sample) (c) 2011 Microsoft. All rights reserved.

Basic Elements of C++ AMP Coding (c) 2011 Microsoft. All rights reserved. void AddArrays(int n, int * pA, int * pB, int * pC) { array_view a(n, pA); array_view b(n, pB); array_view sum(n, pC); parallel_for_each( sum.grid, [=](index idx) restrict(direct3d) { sum[idx] = a[idx] + b[idx]; } ); } array_view variables captured and associated data copied to accelerator (on demand) restrict(direct3d): tells the compiler to check that this code can execute on Direct3D hardware parallel_for_each: execute the lambda on the accelerator once per thread grid: the number and shape of threads to execute the lambda index: the thread ID that is running the lambda, used to index into data array_view: Wraps the data to operate on the accelerator

(c) 2011 Microsoft. All rights reserved.

Session Objectives and Takeaways ► No universally “better” language – C++ robust, scalable and amazingly fast – Direct access to hardware and memory – Managed languages for RAD and business applications ► C++ native out-of-the-box support for multithreading (C++0X) ► Develop memory or CPU intensive components in C++ – Consume from any managed language (c) 2011 Microsoft. All rights reserved.

Related Content ► Visual C++ MVPs Visual C++ MVPs ► Bonafide Ideas - My Blog Bonafide Ideas ► Visual C++ Team Blog Visual C++ Team Blog ► C9::GoingNative | Channel 9 C9::GoingNative | Channel 9 ► Herb Sutter’s Blog Herb Sutter’s Blog ► Daniel Moth’s Blog (C++ AMP) Daniel Moth’s Blog (C++ AMP) ► Google’s paper on language performance Google’s paper on language performance ► The C++ Standards Committee The C++ Standards Committee ► The Visual C++ Weekly The Visual C++ Weekly ► Visual C++ MSDN Forums Visual C++ MSDN Forums (c) 2011 Microsoft. All rights reserved.

Enrol in Microsoft Virtual Academy Today Why Enroll, other than it being free? The MVA helps improve your IT skill set and advance your career with a free, easy to access training portal that allows you to learn at your own pace, focusing on Microsoft technologies. What Do I get for enrolment? ► Free training to make you become the Cloud-Hero in my Organization ► Help mastering your Training Path and get the recognition ► Connect with other IT Pros and discuss The Cloud Where do I Enrol? Then tell us what you think.

Sessions On-Demand & Community technet.microsoft.com/en-au Resources for IT Professionals Resources for Developers Microsoft Certification & Training Resources Resources (c) 2011 Microsoft. All rights reserved.

© 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. (c) 2011 Microsoft. All rights reserved.