Modern computers have made a worldwide breakthrough in the number of processors and kernels available for use in the system. System developers can leverage these powerful features in their software in a variety of ways, especially when dealing with complex algorithms or large datasets.
Microsoft's Parallel Computing platform (Parallel Computing Platform, PCP) provides tools that enable developers to leverage this powerful feature in an efficient, maintainable, and scalable manner. Parallel extensions introduce important concepts in the. NET Framework toolset: Task Parallel libraries (Tasks Parallel Library, TPL), and Parallel LINQ (Parallel LINQ, PLINQ) provide a parallel mechanism for command and task, allowing developers A declarative approach to data parallelism is used.
Goal
In this hands-on experiment, you will learn how to:
Parallelization of existing algorithms is achieved by using the Parallel helper class and by automatically handling concurrent expressions.
Create and run a task that can be canceled during run.
Use the Task<t> class to create and run a task that returns a value.
Use Parallel LINQ (PLINQ) to optimize LINQ queries for execution in a parallel environment.
System Requirements
You must have the following content to complete this experiment:
Microsoft Visual Studio Beta 2
. Net Framework 4
Installation
Use Configuration Wizard to validate all prerequisites for this experiment. To ensure that all content is configured correctly, follow these steps.
Note: To perform the installation steps, you need administrator privileges to run the script in the Command Line window.
1. If not previously executed, run training Kit's Configuration Wizard. To do this, run the Checkdependencies.cmd script that is located under the%trainingkitinstallationfolder%\labs\introtowf\setup folder. Install the software that is not installed in the prerequisites (please rescan if necessary) and complete the wizard.
Note: For convenience, many of the code that is managed in this experiment can be used in Visual Studio code Snippets. The Checkdependencies.cmd file launches the Visual Studio installer file to install the code fragment.
Practice
This hands-on experiment consists of the following exercises:
Use static Parallel classes to parallelization existing algorithms.
Create and run a parallelization task.
Use the Task<t> class to create and run a task that returns a value.
Use PLINQ to parallel LINQ queries.
Estimated time to complete this experiment: 60 minutes.
Next:
Exercise 1: Use static Parallel helper classes parallelization existing algorithms
Exercise 1: Use static Parallel helper classes parallelization existing algorithms
In this exercise, you'll learn how to use static Parallel helper classes to parallelization existing algorithms. This allows us to replace the for () with Parallel.For ().
Note: To verify that each step is executed correctly, it is recommended that you build the solution at the end of each task.