1 / 12

Parallel Fx Library for .NET 3.5 & Multi-Core Programming

Parallel Fx Library for .NET 3.5 & Multi-Core Programming. Victor Stachura. The Man, The Myth, The Legend. Who is this guy?. Warning !. A New Programming Model is Needed. Multi-Core. Moore’s Law. Single Core. Performance. Time. Inside a Multi-Core Processor. One Processor.

sef
Download Presentation

Parallel Fx Library for .NET 3.5 & Multi-Core Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Parallel Fx Library for .NET 3.5 & Multi-Core Programming Victor Stachura

  2. The Man, The Myth, The Legend Who is this guy? Warning!

  3. A New Programming Model is Needed Multi-Core Moore’s Law Single Core Performance Time

  4. Inside a Multi-Core Processor One Processor With multiple execution Cores

  5. Parallel Programming Makes a Difference Task 3 Core #1 Task 4 Core #1 Parallel programming with 2 cores Task 1 Task 5 Core #2 Task 2 Core #2 Degree of Parallel Programming Sequential app with threads Task 2 Task 4 Task 1 Task 3 Sequential app Task 1 Task 2 Task 3 Task 4 Execution Time

  6. 16 1 101 PA Parallel Programming How is Microsoft Addressing this Problem? Parallel Computing Initiative The Manycore Shift Whitepaper

  7. 16 1 101 PA Parallel Programming The Elements of Parallel Programming Software you need: Parallel Fx Library (Dec 07 CTP) Parallel Fx Concepts: Declarative Data Parallelism Imperative Data Parallelism* Imperative Task Parallelism Namespaces: System.Linq System.Linq.Parallel System.Threading System.Threading.Tasks .NET Framework 3.5 VS 2008 General Concepts: Problem Identification** Threads Thread Safety Locking Synchronization Race Conditions Deadlock

  8. 16 1 101 PA Parallel Programming Project Sybil So, does all this stuff work?

  9. 16 1 101 PA Parallel Programming Code Sample: Parallel.For() for (int i = 0; i < 10000000; i++) DataArray[i] = Rand.Next(); stopWatch.Start(); for (int i = 0; i < 10000000; i++) { DataArray[i] = DataArray[i] / 3; DataArray[i] = DataArray[i] * 6; DataArray[i] = DataArray[i] / 3; DataArray[i] = DataArray[i] * 5; DataArray[i] = DataArray[i] / 3; DataArray[i] *= DataArray[i]; DataArray[i] = DataArray[i] / 3; DataArray[i] = DataArray[i] * 6; DataArray[i] = DataArray[i] / 3; DataArray[i] = DataArray[i] * 5; DataArray[i] = DataArray[i] / 3; DataArray[i] *= DataArray[i]; } stopWatch.Stop(); for (int i = 0; i < 10000000; i++) DataArray[i] = Rand.Next(); stopWatch.Start(); Parallel.For(0, 10000000, delegate(int i) { DataArray[i] = DataArray[i] / 3; DataArray[i] = DataArray[i] * 6; DataArray[i] = DataArray[i] / 3; DataArray[i] = DataArray[i] * 5; DataArray[i] = DataArray[i] / 3; DataArray[i] *= DataArray[i]; DataArray[i] = DataArray[i] / 3; DataArray[i] = DataArray[i] * 6; DataArray[i] = DataArray[i] / 3; DataArray[i] = DataArray[i] * 5; DataArray[i] = DataArray[i] / 3; DataArray[i] *= DataArray[i]; }); stopWatch.Stop();

  10. 16 1 101 PA Parallel Programming Shift Happens Most applications running slow Hardware unused Applications must change You must learn You are responsible

  11. 16 1 101 PA Parallel Programming Resources MS Parallel Development Center Manycore Whitepaper Book: "Multi-core programming - Increasing Performance Through Software Multithreading" Intel ‘Go Videos’ MSDN Article: Optimized managed code for multicore machines

  12. The End

More Related