James Kolpack, InRAD LLC popcyclical.com. CodeStock is proudly partnered with: Send instant feedback on this session via Twitter: Send a direct message.

Slides:



Advertisements
Similar presentations
Lambda Expressions Matt Van Horn Software Engineer Iverson Gaming Systems, Inc.
Advertisements

The Microsoft Technical Roadshow 2007 Language Enhancements and LINQ Daniel Moth Developer & Platform Group Microsoft Ltd
Ofir Aspis 1/2010 VS 2010 Targets High Level - IDE New Features VS 2010 As Editor and Platform Demo Editor features Extending.
Deep Dive into LINQ Eran Sharabi.NET Development Team Leader JohnBryce Training
INTEL CONFIDENTIAL Threading for Performance with Intel® Threading Building Blocks Session:
An overview of… Luis Guerrero Plain Concepts
Distributed Data-Parallel Computing Using a High-Level Programming Language Yuan Yu Michael Isard Joint work with: Andrew Birrell, Mihai Budiu, Jon Currey,
Parallel Extensions to the.NET Framework Daniel Moth Microsoft
FUTURE OF.NET PARALLEL PROGRAMMING Joseph Albahari SESSION CODE: DEV308 (c) 2011 Microsoft. All rights reserved.
C# and LINQ Yuan Yu Microsoft Research Silicon Valley.
NewsFlash!! Earth Simulator no longer #1. In slightly less earthshaking news… Homework #1 due date postponed to 10/11.
Optimus: A Dynamic Rewriting Framework for Data-Parallel Execution Plans Qifa Ke, Michael Isard, Yuan Yu Microsoft Research Silicon Valley EuroSys 2013.
Virtual techdays INDIA │ 9-11 February 2011 Parallelism in.NET 4.0 Parag Paithankar │ Technology Advisor - Web, Microsoft India.
The new The new MONARC Simulation Framework Iosif Legrand  California Institute of Technology.
Daniel Moth  Parallel Computing Platform Microsoft Corporation TL26.
PARALLEL PROGRAMMING ABSTRACTIONS 6/16/2010 Parallel Programming Abstractions 1.
Connect with life Bijoy Singhal Developer Evangelist | Microsoft India.
Parallel Programming in.NET Kevin Luty.  History of Parallelism  Benefits of Parallel Programming and Designs  What to Consider  Defining Types of.
SEC(R) 2008 Intel® Concurrent Collections for C++ - a model for parallel programming Nikolay Kurtov Software and Services.
.NET 3.0, 3.5, 4.0 WCF, WPF, WF, CardSpace, LINQ, Task Parallel.
© 2011 Autodesk Single Job 1 Processor 1 Single Job 2 Single Job 3 Processor 2 Processor 3 Big Job 1 Big Job 2 Single Job 4 Processor 1 Single Job 5 Single.
 Lynne Hill General Manager Parallel Computing Platform Visual Studio.
Parallel Programming Models Jihad El-Sana These slides are based on the book: Introduction to Parallel Computing, Blaise Barney, Lawrence Livermore National.
Parallel Extensions A glimpse into the parallel universe By Eric De Carufel Microsoft.NET Solution Architect at Orckestra
Parallel Programming in.NET 4.0 Tasks and Threading Ingo Rammer, thinktecture
Parallel Extensions A glimpse into the parallel universe Eric De Carufel
Task Parallel Library (TPL)
SALSASALSASALSASALSA Design Pattern for Scientific Applications in DryadLINQ CTP DataCloud-SC11 Hui Li Yang Ruan, Yuduo Zhou Judy Qiu, Geoffrey Fox.
About Me Microsoft MVP Intel Blogger TechEd Israel, TechEd Europe Expert C++ Book
MATRIX MULTIPLY WITH DRYAD B649 Course Project Introduction.
Lecture 21 Parallel Programming Richard Gesick. Parallel Computing Parallel computing is a form of computation in which many operations are carried out.
Data structures for concurrency 1. Ordinary collections are not thread safe Namespaces System.Collections System.Collections.Generics Classes List, LinkedList,
Design Issues. How to parallelize  Task decomposition  Data decomposition  Dataflow decomposition Jaruloj Chongstitvatana 2 Parallel Programming: Parallelization.
Parallel Extensions A glimpse into the parallel universe By Eric De Carufel Microsoft.NET Solution Architect at Orckestra
Huseyin YILDIZ Software Design Engineer Microsoft Corporation SESSION CODE: DEV314.
Lecture 3 : Performance of Parallel Programs Courtesy : MIT Prof. Amarasinghe and Dr. Rabbah’s course note.
Module 8 Enhancing User Interface Responsiveness.
LINQ & PLINQ (Parallel) Language Integrated Query.
Computer Science 320 Load Balancing with Clusters.
Inside LINQ to Objects How LINQ to Objects work Inside LINQ1.
Copyright © 2010, SAS Institute Inc. All rights reserved. SAS ® Using the SAS Grid.
MATRIX MULTIPLY WITH DRYAD B649 Course Project Introduction.
DEV303. Tiny Functions Why Does It Need a Name?
Visual Studio 2010 and.NET Framework 4 Training Workshop.
IAP C# 2011 Lecture 2: Delegates, Lambdas, LINQ Geza Kovacs.
3/12/2013Computer Engg, IIT(BHU)1 OpenMP-1. OpenMP is a portable, multiprocessing API for shared memory computers OpenMP is not a “language” Instead,
Patterns of Parallel Programming with.NET 4 Stephen Toub Principal Architect Parallel Computing Platform Microsoft Corporation
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
TOPICS WHAT YOU’LL LEAVE WITH WHO WILL BENEFIT FROM THIS TALK.NET developers: familiar with parallel programming support in Visual Studio 2010 and.NET.
C# Present and Future Marita Paletsou Software Engineer.
THE FUTURE OF C#: GOOD THINGS COME TO THOSE WHO ‘AWAIT’ Joseph Albahari SESSION CODE: DEV411 (c) 2011 Microsoft. All rights reserved.
Conception of parallel algorithms
Spark Presentation.
Representation, Syntax, Paradigms, Types
Async or Parallel? No they aren’t the same thing!
Lighting Up Windows Server 2008 R2 Using the ConcRT on UMS
Computer Engg, IIT(BHU)
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
Task Parallel Library: Design Principles and Best Practices
Functional Programming with Java
Parallel Programming with MPI and OpenMP
Staying Afloat in the .NET Async Ocean
C++ Forever: Interactive Applications in the Age of Manycore
.NET and .NET Core 9. Towards Higher Order Pan Wuming 2017.
.NET 3.0, 3.5, 4.0 WCF, WPF, WF, CardSpace, LINQ, Task Parallel
Tech·Ed North America /8/ :16 PM
CSCE569 Parallel Computing
Representation, Syntax, Paradigms, Types
Representation, Syntax, Paradigms, Types
Lecture 20 Parallel Programming CSE /8/2019.
Presentation transcript:

James Kolpack, InRAD LLC popcyclical.com

CodeStock is proudly partnered with: Send instant feedback on this session via Twitter: Send a direct message with the room number d codestock 406 This session is great! For more information on sending feedback using Twitter while at CodeStock, please see the “CodeStock README” in your CodeStock guide. RecruitWise and Staff with Excellence -

Parallel computing Manycore machines… …have arrived!

“Free Lunch” is over - TANSTAAFL Performance and Scalability

Outline Parallel Extensions Imperative Data Parallelization Imperative Task Parallelization Declarative Data Parallelization ( PLINQ) Thread-safe Data Structures Visual Studio 2010 Concurrency Visualizations

Parallel Extensions Concurrency.NET Library Lightweight user-mode runtime Key benefits Lightweight tasks, efficient scheduling Programming model improvements Unified exception models and scheduling Great for “Delightfully” Parallel Problems Computation-intensive processes for large data sets

Decomposition Breaking a problem into discrete parts Data Decomposition Iterations (for loops) over data Simple! Task Decomposition Separate operations that can run independently of each other …Or both!

Data Decomposition int[,] pixelData = new int[rowLen, colLen]; for (int y = 0; y < rowLen; y++) { for (int x = 0; x < colLen; x++) { pixelData[y, x] = TraceRay(y, x); }

Sequential x1x2x3x4 y1 y2 y3 y4 codeSample();

Thread for each Row x1x2x3x4 y1 y2 y3 y4 codeSample();

Threading with 2 Partitions x1x2x3x4 y1 y2 y3 y4 codeSample();

Imbalanced Workload x1x2x3x4 y1 y2 y3 y4

Dynamic Partitioning x1x2x3x4 y1 y2 y3 y4

Partitioning Tradeoffs Fully Static Fully Dynamic More Load-Balancing Less Synchronization

Partitioning Strategies Fully Static Fully Dynamic

Partitioning Strategies Dynamic Chunks Load Balancing

Sample Application For Real Ray Tracer Samples for Parallel Programming with.NET 4 code.msdn.microsoft.com/ParExtSamples code.msdn.microsoft.com/ParExtSamples

Parallel Extensions Architecture Task Parallel Library (TPL) Parallel Constructs.NET Program Imperative Parallel Algorithms Compiler C# VB F# C++ (any other) IL Data Structures Concurrent Collections Synchronization Types Coordination Types Algorithms Threads Tasks and Tasks Scheduling Proc 1…Proc p

Lambda Expressions (input parameters) => expression () => SomeMethod() (input parameters) => {statement;} (int i, string s) => { Console.WriteLine( “str: {0} int: {1}”, s, i); } bool MyFunc(int i, string s) { return s.Length > i; } void MyAction(int i, string s) { Console.WriteLine( “str: {0} int: {1}”, s, i); } (int i, string s) => s.Length > i

Func Generic Delegates TResult Func () TResult Func (in T1) TResult Func (in T1, in T2) Func f = (int i, string s) => s.Length > i; Action a = (int i, string s) => { Console.WriteLine( “str: {0} int: {1}”, s, i); } Action a = MyAction; bool MyFunc(int i, string s) {} void MyAction(int i, string s) {} Func f = MyFunc; void Action<>() void Action (in T1) Void Action (in T1, in T2)

Imperative Data Parallelization Parallel.For, Parallel.ForEach Exception handling Cancelling Break and Stop Thread-local state Nested parallelism Dynamic thread counts Efficient load balancing Parallel.For(0, n, i => { //... }); codeSample(); Parallel.ForEach(data, d => { //... });

Imperative Task Parallelization Tasks - Lighter weight than raw Threads Intelligent scheduling using ThreadPool Rich API for fine grained control Waiting, cancellation, continuations, exceptions, etc Parallel.Invoke( () => DoComputation(), () => DoAnotherCompuation() ); codeSample();

Concurrent Collections Thread-safe! Time-outs and waits Throttling Cancellation Classes BlockingCollection ConcurrentDictionary ConcurrentQueue ConcurrentStack ConcurrentBag codeSample();

Parallel Extensions Architecture Task Parallel Library (TPL) Parallel Constructs.NET Program Declarative Parallel Queries Imperative Parallel Algorithms PLINQ Execution Engine Query Analysis Data Partitioning Operator Types Merging Compiler C# VB F# C++ (any other) IL Data Structures Concurrent Collections Synchronization Types Coordination Types PLINQ Algorithms Threads Tasks and Tasks Scheduling Proc 1…Proc p

Parallel LINQ (PLINQ) Declarative Data Parallelization Describe what we want rather than how to accomplish it For LINQ to Object queries System.Linq.Parallel.AsParallel() codeSample();

PLINQ ForAll codeSample();

PLINQ Performance Considerations Computational cost of the overall work The form of query execution With ToArray or ToList, all results must be merged The type of merge options Buffered or Streaming The kind of partitioning Sequential mode fall-back var queryA = from num in numberList.AsParallel() select ExpensiveFunction(num); //good for PLINQ var queryB = from num in numberList.AsParallel() where num % 2 > 0 select num; //not so good for PLINQ

Parallel API Review Imperative Data Parallelization System.Threading.Tasks.Parallel Imperative Task Parallelization System.Threading.Tasks Declarative Data Parallelization ( PLINQ) System.Linq.Parallel Thread-safe Data Structures System.Collections.Concurrent Parallel.For(0, n, i => {}); Parallel.ForEach(data, i => {}); var t = Task.Factory.StartNew(() => {}); t.Wait(); from n in nums.AsParallel() select ExpressiveFunction(n); new BlockingCollection ();

Parallel Patterns Fork/Join Recursive Decomposition Aggregations Dependencies Producer/Consumer MapReduce Fold and Scan Shared State Anti-Patterns

Threads View Concurrency Visualizers CPU Utilization View Cores View

Links Blog series on Parallelism in.NET by Reed Copsey Jr. reedcopsey.com/category/algorithms/parallelism reedcopsey.com/category/algorithms/parallelism Patterns for Parallel Programming – Stephen Toub bit.ly/caxi9I bit.ly/caxi9I MSDN Parallel Computing Portal msdn.com/concurrency msdn.com/concurrency MSDN Parallel Programming in the.NET Framework bit.ly/bo73EI bit.ly/bo73EI