Содержание
- 2. Introduction to Parallel Programming Parallel Loops Parallel Aggregation
- 3. Introduction to Parallel Programming Parallel Loops Parallel Aggregation
- 4. Hardware trends predict more cores instead of faster clock speeds One core is loaded at 100%,
- 5. Some parallel applications can be written for specific hardware For example, creators of programs for a
- 6. Decomposition Coordination Scalable Sharing Parallel programming patterns aspects
- 7. Tasks are sequential operations that work together to perform a larger operation Tasks are not threads
- 8. Tasks that are independent of one another can run in parallel Some tasks can begin only
- 9. Tasks often need to share data Synchronization of tasks Every form of synchronization is a form
- 10. Understand your problem or application and look for potential parallelism across the entire application as a
- 11. Concurrency is a concept related to multitasking and asynchronous input-output (I/O) multiple threads of execution that
- 12. With parallelism, concurrent threads execute at the same time on multiple cores Parallel programming focuses on
- 13. Amdahl’s law says that no matter how many cores you have, the maximum speedup you can
- 14. Whenever possible, stay at the highest possible level of abstraction and use constructs or a library
- 15. Use patterns Restructuring your algorithm (for example, to eliminate the need for shared data) is better
- 16. Based on the .NET Framework 4 Written in C # Use Task Parallel Library (TPL) Parallel
- 17. Introduction to Parallel Programming Parallel Loops Parallel Aggregation
- 18. Parallel programming patterns
- 19. Use the Parallel Loop pattern when you need to perform the same independent operation for each
- 20. Parallel.For
- 21. Parallel.ForEach
- 22. Almost all LINQ-to-Objects expressions can easily be converted to their parallel counterpart by adding a call
- 23. Use PLINQ’s ForAll extension method in cases where you want to iterate over the input values
- 24. The .NET implementation of the Parallel Loop pattern ensures that exceptions that are thrown during the
- 25. Parallel loops 12 overloaded methods for Parallel.For 20 overloaded methods for Parallel.ForEach PLINQ has close to
- 26. Writing to shared variables Using properties of an object model Dependencies between loop iterations
- 27. Referencing data types that are not thread safe Loop-carried dependence Sometimes, it’s possible to use a
- 28. Sequential iteration With parallel loops more than one step may be active at the same time,
- 29. Use Break to exit a loop early while ensuring that lower-indexed steps complete Parallel Break
- 30. Calling Break doesn’t stop other steps that might have already started running To check for a
- 31. ParallelLoopResult
- 32. Use Stop to exit a loop early when you don’t need all lower-indexed iterations to run
- 33. External Loop Cancellation
- 34. Special handling of small loop bodies
- 35. The number of ranges that will be created by a Partitioner object depends on the number
- 36. You usually let the system manage how iterations of a parallel loop are mapped to your
- 37. The PLINQ query in the code example will run with a maximum of eight tasks at
- 38. Sometimes you need to maintain thread-local state during the execution of a parallel loop For example,
- 39. Random initialization of the large array
- 40. Calling the default Random constructor twice in short succession may use the same random seed Provide
- 41. You can substitute custom task scheduling logic for the default task scheduler that uses ThreadPool worker
- 42. Step size other than one Hidden loop body dependencies Small loop bodies with few iterations Processor
- 43. Adaptive partitioning Parallel loops in .NET use an adaptive partitioning technique where the size of units
- 44. Introduction to Parallel Programming Parallel Loops Parallel Aggregation
- 45. Parallel programming patterns
- 46. The pattern is more general than calculating a sum It works for any binary operation that
- 47. Sequential version LINQ expression Calculating a sum
- 48. PLINQ PLINQ has query operators that count the number of elements and calculate the average, maximum,
- 49. PLINQ is usually the recommended approach You can also use Parallel.For or Parallel.ForEach to implement the
- 50. The PLINQ Aggregate extension method includes an overloaded version that allows a very general application of
- 51. Aggregation using Parallel For and ForEach Design notes
- 52. Aggregation in PLINQ does not require the developer to use locks The final merge step is
- 54. Скачать презентацию