This document provides an overview of parallel computing technologies introduced in Visual Studio 2010 and the .NET Framework 4. It discusses the importance of parallel computing and how these new technologies help ease the transition. Key topics covered include the Parallel Extensions library which supports parallel LINQ, task parallelism, and coordination data structures; new threading primitives like barriers and countdown events; and a unified cancellation model.
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...Roberto Casadei
Presentation of a paper accepted at the 4th Internetional Conference on Fog and Mobile Edge Computing (FMEC).
It discusses a decentralised, self-organising, spatial, collective approach to the development of edge-clouds/edge computing ecosystems.
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...Roberto Casadei
Coordination is a fundamental problem in the
engineering of collective adaptive systems (CAS). Prominent
approaches in this context promote adaptivity and collective
behaviour by founding coordination on local, decentralised in-
teraction. This is usually enabled through abstractions such as
collective interfaces, neighbour-based interaction, and attribute-
based communication. Application designers, then, use such
coordination mechanisms to enact collective adaptive behaviour
in order to solve specific problems or provide specific services
while coping with dynamic environments. In this paper, we
consider the other way round: we argue that a CAS model can
be used to provide support for high-level coordination models,
simplifying their implementation and transferring to them the
self-* properties it emergently fosters. As a motivating example,
we consider the idea of supporting tuple-based coordination by
Linda primitives such that tuples and operations have a position
and extension in space and time. Then, we adopt an aggregate
perspective, by which space-time is logically represented by a
mobile ad-hoc network of devices, and show that coordination
primitives can be implemented as true collective adaptive pro-
cesses. We describe this model and a prototype implementation
in the ScaFi aggregate programming framework, which is rooted
in the so-called computational field paradigm.
Keras is a high-level neural networks API, written in Python and capable of running on top of either TensorFlow, CNTK or Theano.
We can easily build a model and train it using keras very easily with few lines of code.The steps to train the model is described in the presentation.
Use Keras if you need a deep learning library that:
-Allows for easy and fast prototyping (through user friendliness, modularity, and extensibility).
-Supports both convolutional networks and recurrent networks, as well as combinations of the two.
-Runs seamlessly on CPU and GPU.
This presentation by Maksym Fastovets (Senior Software Engineer, Consultant, GlobalLogic, Kharkiv) was delivered at GlobalLogic Kharkiv Java Conference 2019 on June 9, 2019.
Maksym touched upon the Java development from Thread to CompletableFuture and introduced the Monitor concept and its implementation in Java. He also did not overlook Java tools supporting multithreading and asynchronous coding that exist aside from JDK.
Video: https://youtu.be/pLXQWbwneOw
This presentation begins by reviewing the Task Parallel Library APIs, introduced in .NET 4.0 and expanded in .NET 4.5 -- the Task class, Parallel.For and Parallel.ForEach, and even Parallel LINQ. Then, we look at patterns and practices for extracting concurrency and managing dependencies, with real examples like Levenstein's edit distance algorithm, Fast Fourier Transform, and others.
Plotting the training process
Regularization
Batch normalization
Saving and loading the weights and the architecture of a model
Visualize a Deep Learning Neural Network Model in Keras
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...Roberto Casadei
Presentation of a paper accepted at the 4th Internetional Conference on Fog and Mobile Edge Computing (FMEC).
It discusses a decentralised, self-organising, spatial, collective approach to the development of edge-clouds/edge computing ecosystems.
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...Roberto Casadei
Coordination is a fundamental problem in the
engineering of collective adaptive systems (CAS). Prominent
approaches in this context promote adaptivity and collective
behaviour by founding coordination on local, decentralised in-
teraction. This is usually enabled through abstractions such as
collective interfaces, neighbour-based interaction, and attribute-
based communication. Application designers, then, use such
coordination mechanisms to enact collective adaptive behaviour
in order to solve specific problems or provide specific services
while coping with dynamic environments. In this paper, we
consider the other way round: we argue that a CAS model can
be used to provide support for high-level coordination models,
simplifying their implementation and transferring to them the
self-* properties it emergently fosters. As a motivating example,
we consider the idea of supporting tuple-based coordination by
Linda primitives such that tuples and operations have a position
and extension in space and time. Then, we adopt an aggregate
perspective, by which space-time is logically represented by a
mobile ad-hoc network of devices, and show that coordination
primitives can be implemented as true collective adaptive pro-
cesses. We describe this model and a prototype implementation
in the ScaFi aggregate programming framework, which is rooted
in the so-called computational field paradigm.
Keras is a high-level neural networks API, written in Python and capable of running on top of either TensorFlow, CNTK or Theano.
We can easily build a model and train it using keras very easily with few lines of code.The steps to train the model is described in the presentation.
Use Keras if you need a deep learning library that:
-Allows for easy and fast prototyping (through user friendliness, modularity, and extensibility).
-Supports both convolutional networks and recurrent networks, as well as combinations of the two.
-Runs seamlessly on CPU and GPU.
This presentation by Maksym Fastovets (Senior Software Engineer, Consultant, GlobalLogic, Kharkiv) was delivered at GlobalLogic Kharkiv Java Conference 2019 on June 9, 2019.
Maksym touched upon the Java development from Thread to CompletableFuture and introduced the Monitor concept and its implementation in Java. He also did not overlook Java tools supporting multithreading and asynchronous coding that exist aside from JDK.
Video: https://youtu.be/pLXQWbwneOw
This presentation begins by reviewing the Task Parallel Library APIs, introduced in .NET 4.0 and expanded in .NET 4.5 -- the Task class, Parallel.For and Parallel.ForEach, and even Parallel LINQ. Then, we look at patterns and practices for extracting concurrency and managing dependencies, with real examples like Levenstein's edit distance algorithm, Fast Fourier Transform, and others.
Plotting the training process
Regularization
Batch normalization
Saving and loading the weights and the architecture of a model
Visualize a Deep Learning Neural Network Model in Keras
VLSI Projects for M. Tech, VLSI Projects in Vijayanagar, VLSI Projects in Bangalore, M. Tech Projects in Vijayanagar, M. Tech Projects in Bangalore, VLSI IEEE projects in Bangalore, IEEE 2015 VLSI Projects, FPGA and Xilinx Projects, FPGA and Xilinx Projects in Bangalore, FPGA and Xilinx Projects in Vijayangar
A brief introduction to deep learning, providing rough interpretation to deep neural networks and simple implementations with Keras for deep learning beginners.
First steps with Keras 2: A tutorial with ExamplesFelipe
In this presentation, we give a brief introduction to Keras and Neural networks, and use examples to explain how to build and train neural network models using this framework.
Talk given as part of an event by Rio Machine Learning Meetup.
Basics of RNNs and its applications with following papers:
- Generating Sequences With Recurrent Neural Networks, 2013
- Show and Tell: A Neural Image Caption Generator, 2014
- Show, Attend and Tell: Neural Image Caption Generation with Visual Attention, 2015
- DenseCap: Fully Convolutional Localization Networks for Dense Captioning, 2015
- Deep Tracking- Seeing Beyond Seeing Using Recurrent Neural Networks, 2016
- Robust Modeling and Prediction in Dynamic Environments Using Recurrent Flow Networks, 2016
- Social LSTM- Human Trajectory Prediction in Crowded Spaces, 2016
- DESIRE- Distant Future Prediction in Dynamic Scenes with Interacting Agents, 2017
- Predictive State Recurrent Neural Networks, 2017
Data centers consist of various users with multiple roles and differentiated levels of access. Tenant execution flows can be of different priorities based on the role of the tenant and the nature of the process. Traditionally enterprise network optimizations are made at each specific layer, from the physical layer to the application layer. However, a cross-layer optimization of cloud networks would utilize the data available to each of the layers in a more efficient manner.
This paper proposes an approach and architecture for differentiated quality of service (QoS). By employing a selective redundancy in a controlled manner, end-to-end delivery is guaranteed for priority tenant application flows despite congestion. The architecture, in a higher level, focuses on exploiting the global knowledge of the underlying network readily available to the Software-Defined Networking (SDN) controller to cater the requirements of the tenant applications. QoS is guaranteed to the critical tenant flows in multi-tenant clouds by cross-layer enhancements across the network and application layers.
The Hierarchical Temporal Memory Cortical Learning Algorithm (HTM CLA) is a theory and machine learning technology that aims to capture cortical algorithm of the neocortex. Inspired by the biological functioning of the neocortex, it provides a theoretical framework, which helps to better understand how the
cortical algorithm inside of the brain might work. It organizes populations of neurons in column-like units, crossing several layers such that the units are connected into structures called regions (areas). Areas and columns are hierarchically organized and can further be connected into more complex networks, which implement higher cognitive capabilities like invariant representations. Columns inside of layers are specialized on learning of spatial patterns and sequences. This work targets specifically spatial pattern learning algorithm called Spatial Pooler. A complex topology and high number of neurons used in this algorithm, require more computing power than even a single machine with multiple cores or a GPUs could provide. This work aims to improve the HTM CLA Spatial Pooler by enabling it to run in the distributed environment on multiple physical machines by using the Actor Programming Model. The proposed model is based on a mathematical theory and computation model, which targets massive concurrency. Using this model drives different reasoning about concurrent execution and enables flexible
distribution of parallel cortical computation logic across multiple physical nodes. This work is the first one about the parallel HTM Spatial Pooler on multiple physical nodes with named computational model. With the increasing popularity of cloud computing and server less architectures, it is the first step towards proposing interconnected independent HTM CLA units in an elastic cognitive network. Thereby it can provide an alternative to deep neuronal networks, with theoretically unlimited scale in a distributed cloud environment.
Compact dfa scalable pattern matching using longest prefix match solutionsNexgen Technology
Ecruitment Solutions (ECS) is one of the leading Delhi based Software Development & HR Consulting Firm, which is assessed at the level of ISO 9001:2008 standard. ECS offers an awesome project and product based solutions to many customers around the globe.
In addition, ECS has also widened its wings by the way consummating academic projects especially for the final year professional degree students in India. ECS consist of a technical team that has solved many IEEE papers and delivered world-class solutions .
classify images from the CIFAR-10 dataset. The dataset consists of airplanes, dogs, cats, and other objects.we'll preprocess the images, then train a convolutional neural network on all the samples. The images need to be normalized and the labels need to be one-hot encoded.
Join us on February 18th at 18:00 for a deep learning class where you'll receive hands-on experience with Pytorch to develop convolutional neural networks and expand your programming expertise. This workshop is a collaboration between GDSC TU/e, TU Delft, and AGU to bring students together under the same machine learning umbrella.
Note: Some knowledge in Python is expected.
The presentation is coverong the convolution neural network (CNN) design.
First,
the main building blocks of CNNs will be introduced. Then we systematically
investigate the impact of a range of recent advances in CNN architectures and
learning methods on the object categorization (ILSVRC) problem. In the
evaluation, the influence of the following choices of the architecture are
tested: non-linearity (ReLU, ELU, maxout, compatibility with batch
normalization), pooling variants (stochastic, max, average, mixed), network
width, classifier design (convolution, fully-connected, SPP), image
pre-processing, and of learning parameters: learning rate, batch size,
cleanliness of the data, etc.
VLSI Projects for M. Tech, VLSI Projects in Vijayanagar, VLSI Projects in Bangalore, M. Tech Projects in Vijayanagar, M. Tech Projects in Bangalore, VLSI IEEE projects in Bangalore, IEEE 2015 VLSI Projects, FPGA and Xilinx Projects, FPGA and Xilinx Projects in Bangalore, FPGA and Xilinx Projects in Vijayangar
A brief introduction to deep learning, providing rough interpretation to deep neural networks and simple implementations with Keras for deep learning beginners.
First steps with Keras 2: A tutorial with ExamplesFelipe
In this presentation, we give a brief introduction to Keras and Neural networks, and use examples to explain how to build and train neural network models using this framework.
Talk given as part of an event by Rio Machine Learning Meetup.
Basics of RNNs and its applications with following papers:
- Generating Sequences With Recurrent Neural Networks, 2013
- Show and Tell: A Neural Image Caption Generator, 2014
- Show, Attend and Tell: Neural Image Caption Generation with Visual Attention, 2015
- DenseCap: Fully Convolutional Localization Networks for Dense Captioning, 2015
- Deep Tracking- Seeing Beyond Seeing Using Recurrent Neural Networks, 2016
- Robust Modeling and Prediction in Dynamic Environments Using Recurrent Flow Networks, 2016
- Social LSTM- Human Trajectory Prediction in Crowded Spaces, 2016
- DESIRE- Distant Future Prediction in Dynamic Scenes with Interacting Agents, 2017
- Predictive State Recurrent Neural Networks, 2017
Data centers consist of various users with multiple roles and differentiated levels of access. Tenant execution flows can be of different priorities based on the role of the tenant and the nature of the process. Traditionally enterprise network optimizations are made at each specific layer, from the physical layer to the application layer. However, a cross-layer optimization of cloud networks would utilize the data available to each of the layers in a more efficient manner.
This paper proposes an approach and architecture for differentiated quality of service (QoS). By employing a selective redundancy in a controlled manner, end-to-end delivery is guaranteed for priority tenant application flows despite congestion. The architecture, in a higher level, focuses on exploiting the global knowledge of the underlying network readily available to the Software-Defined Networking (SDN) controller to cater the requirements of the tenant applications. QoS is guaranteed to the critical tenant flows in multi-tenant clouds by cross-layer enhancements across the network and application layers.
The Hierarchical Temporal Memory Cortical Learning Algorithm (HTM CLA) is a theory and machine learning technology that aims to capture cortical algorithm of the neocortex. Inspired by the biological functioning of the neocortex, it provides a theoretical framework, which helps to better understand how the
cortical algorithm inside of the brain might work. It organizes populations of neurons in column-like units, crossing several layers such that the units are connected into structures called regions (areas). Areas and columns are hierarchically organized and can further be connected into more complex networks, which implement higher cognitive capabilities like invariant representations. Columns inside of layers are specialized on learning of spatial patterns and sequences. This work targets specifically spatial pattern learning algorithm called Spatial Pooler. A complex topology and high number of neurons used in this algorithm, require more computing power than even a single machine with multiple cores or a GPUs could provide. This work aims to improve the HTM CLA Spatial Pooler by enabling it to run in the distributed environment on multiple physical machines by using the Actor Programming Model. The proposed model is based on a mathematical theory and computation model, which targets massive concurrency. Using this model drives different reasoning about concurrent execution and enables flexible
distribution of parallel cortical computation logic across multiple physical nodes. This work is the first one about the parallel HTM Spatial Pooler on multiple physical nodes with named computational model. With the increasing popularity of cloud computing and server less architectures, it is the first step towards proposing interconnected independent HTM CLA units in an elastic cognitive network. Thereby it can provide an alternative to deep neuronal networks, with theoretically unlimited scale in a distributed cloud environment.
Compact dfa scalable pattern matching using longest prefix match solutionsNexgen Technology
Ecruitment Solutions (ECS) is one of the leading Delhi based Software Development & HR Consulting Firm, which is assessed at the level of ISO 9001:2008 standard. ECS offers an awesome project and product based solutions to many customers around the globe.
In addition, ECS has also widened its wings by the way consummating academic projects especially for the final year professional degree students in India. ECS consist of a technical team that has solved many IEEE papers and delivered world-class solutions .
classify images from the CIFAR-10 dataset. The dataset consists of airplanes, dogs, cats, and other objects.we'll preprocess the images, then train a convolutional neural network on all the samples. The images need to be normalized and the labels need to be one-hot encoded.
Join us on February 18th at 18:00 for a deep learning class where you'll receive hands-on experience with Pytorch to develop convolutional neural networks and expand your programming expertise. This workshop is a collaboration between GDSC TU/e, TU Delft, and AGU to bring students together under the same machine learning umbrella.
Note: Some knowledge in Python is expected.
The presentation is coverong the convolution neural network (CNN) design.
First,
the main building blocks of CNNs will be introduced. Then we systematically
investigate the impact of a range of recent advances in CNN architectures and
learning methods on the object categorization (ILSVRC) problem. In the
evaluation, the influence of the following choices of the architecture are
tested: non-linearity (ReLU, ELU, maxout, compatibility with batch
normalization), pooling variants (stochastic, max, average, mixed), network
width, classifier design (convolution, fully-connected, SPP), image
pre-processing, and of learning parameters: learning rate, batch size,
cleanliness of the data, etc.
How do you improve the Config Model? Where to use Windows Server AppFabric? How to provide a RoutingService in the Framework? How to enable dynamic apps with Discovery?
Building scalable, highly-available applications that perform well is not an easy task. These features cannot be simply “bolted” onto an existing application – they have to be architected into it. Unfortunately, the things we need to do to achieve them are often in conflict with each other, and finding the right balance is crucial. In this session we will discuss why scaling web applications is difficult and will look at some of solutions we have come up with in the past to deal with the issues involved. We will then look at how in-memory data grids can make our jobs easier by providing a solid architectural foundation to build our applications on top of. If you are new to in-memory data grids, you are guaranteed to leave the presentation eager to learn more. However, even if you are already using one you will likely walk out with a few ideas on how to improve performance and scalability of your applications.
Chaos Engineering - The Art of Breaking Things in ProductionKeet Sugathadasa
This is an introduction to Chaos Engineering - the Art of Breaking things in Production. This is conducted by two Site Reliability Engineers which explains the concepts, history, principles along with a demonstration of Chaos Engineering
The technical talk is given in this video: https://youtu.be/GMwtQYFlojU
Ultra Fast Deep Learning in Hybrid Cloud using Intel Analytics Zoo & AlluxioAlluxio, Inc.
Data Orchestration Summit 2020 organized by Alluxio
https://www.alluxio.io/data-orchestration-summit-2020/
Ultra Fast Deep Learning in Hybrid Cloud using Intel Analytics Zoo & Alluxio
Jennie Wang, Software Engineer (Intel)
Tsai Louie, Software Engineer (Intel)
About Alluxio: alluxio.io
Engage with the open source community on slack: alluxio.io/slack
Similar to Parallel Computing For Managed Developers (20)
Serverless architectures: APIs, Serverless Functions, Microservices - How to ...Bala Subra
Do you have the next best idea? How will you quickly migrate a legacy feature to new world for almost free? This talk will give you how to architect and implement your scenario for a cloud-oriented solution. We will share the best practices for storing your state in database; ways to decouple by events and suggested patterns for serverless. You will be equipped with taking advantage of low-cost serverless computing in a secure way and how to minimize operational costs. It will mostly focus AWS offerings like Serverless Aurora, API Gateway and Lambda functions for solutions blueprint
How to find out production issues? Where to look for errors when application crashes in live environment? How to Visual Studio 2010 for replicating post mortem scenarios in difficult to reproduce errors? Using Source server, PDB symbols in old fashioned way for new age WCF services.
Basics & Intro to SQL Server Reporting Services: Sql Server Ssrs 2008 R2Bala Subra
How to use SQL Server 2008 R2 reporting services instead of ASP.NET for every data presentation problems? Where SSRS is superior to raw SQL? How it helps QA to automate their test cases?
Denny Lee\'s Data Camp v1.0 talk on SSRS Best Practices for ITBala Subra
Building and Deploying Large Scale SQL Server Reporting Services Environments Technical Note:
* Report Catalog sizing
* The benefits of File System snapshots for SSRS 2005
* Why File System snapshots may not help for SSRS 2008
* Using Cache Execution
* Load Balancing your Network
* Isolate your workloads
* Report Data Performance Considerations
BizTalk 2010 with Appfabric Hosting in the Cloud: WCF Services vs BT2010Bala Subra
How do you decide which Appfabric offering to use? When to prefer WCF services vs BizTalk solution? How to get the best performance with horizontal scaling in SOA?
How to ace your .NET technical interview :: .Net Technical Check TuneupBala Subra
This session is just not a brain dump of a technical interview on Microsoft technologies. It will be refresher on various pieces of the .NET, Database, OO, Process world. It will serve as a caution for interviewers to red flag their questions which are circulated on the webdom. For all the inquisitive and MCP certified brains, this will serve as a ‘whodunnit’ challenge. It will be a useful reference for the rest of us. The talk is divided into four sections. We will cover the typical BrainBench type questions to start with. Then we will attack the common problems encountered on the field and ideal solution paths to each of them. Third part will be about architectural trade-offs and ‘it depends’ scenarios. Finally, there will be discussion on best practices, books needed for interview preparation and open Q&A among the participants.
This session is for you if you want to learn tips and techniques that are used to optimize database development with special emphasis on SQL Server 2005. If you write lot of stored procedures and want to learn the tools of a DBA, this is the session for you. If you are new to SQL Server development environment, you will learn how the various constructs compare to each other and better performance can be produced every time with a brief introduction to understanding Execution Plans.
Generate reports with SSRS - SQL Server Reporting Services: This session will be a cornucopia of three sub-sessions. The first part will be to convince the skeptics. Why does every organization should consider SQL Server Reporting as part of its front-end solution? What will SSRS do better than a typical web application/site or a client-server application? The second portion will be a quick demo of the possibility and will be the shortest. The final part will talk about the best practices, tips from the field and will cover the implementation techniques.
3. Objectives
Understand the importance of the “parallel
computing shift”
Understand the technologies introduced in the .NET
Framework 4 that are easing this transition
4. “I used to think that cyberspace was fifty
years away. What I thought was fifty
years away, was only ten years away.
And what I thought was ten years
away... it was already here. I just
wasn't aware of it yet.”
- Bruce Sterling
6. “Moore’s Law scaling should easily let
us hit the 80-core mark in
mainstream processors within the
next ten years and quite possibly
even sooner.”
- Justin Ratner, CTO, Intel
7. The Parallel Computing Initiative
Letting the brightest developers solve
business problems, not concurrency
problems.
“Concurrency for the masses”
8. Concurrency Landscape
For Visual Studio 2010 and the .NET Framework 4…
System.Threading Parallel Extensions
Unified Cancellation Model
9. New System.Threading Primitives
A Barrier is a synchronization primitive that enforces
the stopping of execution between a number of
threads or processes at a given point and prevents
further execution until all threads or processors
YUCK!
have reached the given point.
A CountdownEvent is a synchronization primitive
that enables ongoing tracking of a given workload in
order to determine if processing of that workload is
finished or not.
10. Barrier
“Let’s all caravan over to Seattle! We’ll meet at the
gas station and leave from there.” - Charlie
Dennis
Mac
Barrier
Charlie Gas Station
Seattle
13. Parallel Extensions is a .NET Library that
supports declarative and imperative data
parallelism, imperative task parallelism, and a set of
data structures that make coordination easier.
1. Parallel LINQ (PLINQ)
2. Task Parallel Library (TPL)
3. Coordination Data Structures (CDS)
15. “Work Stealing” in Action
Worker Worker
Thread 1 Thread p
Program
Thread
Task 3
Task 1 Task 4Task 5
Task 2
16. Parallel Static Class
When program statements are independent…
StatementA();
StatementB();
StatementC();
…they can be parallelized
Parallel.Invoke(
() => StatementA(),
() => StatementB(),
() => StatementC() );
18. PLINQ
Parallel LINQ (PLINQ) enables developers to easily
leverage manycore with a minimal impact to
existing LINQ programming model
var q = from p in people.AsParallel()
where p.Name == queryInfo.Name &&
p.State == queryInfo.State &&
p.Year >= yearStart &&
p.Year <= yearEnd
orderby p.Year ascending
select p;
20. Recap
For Visual Studio 2010 and the .NET Framework 4.0…
System.Threading Parallel Extensions
Unified Cancellation Model
Editor's Notes
MESSAGING:Objectives for the session.
MESSAGING:It’s amazing how fast technology can sneak up on us. It’s important to remember that what we think is still years away from us is something that is actually already here and that we have to starting thinking about it now.
MESSAGING:Now this has a great impact on the capabilities of our applications. Thanks to the ever-increasing power of our computers, computing power has been on a steady incline. And for the most part, our applications have been able to track this computing power increase merely by relying on the fact that faster computers will be released that will, in turn, make their own applications faster (just by running on the faster hardware). In this world, sequential programming wasn’t a problem because the ever-increasing computer power allowed our sequential programs to keep on running faster and faster as new hardware was released.However, along this computing power trend, a shift was made to CPUs containing multiple cores. Computers now contained multiple cores, where each single core was slightly less powerful than a complete processor was before. And while it would be nice to think our applications could continue to follow the computing power trend just as they did before, that’s not reality.The reality is that if we continue to use the same programming models as we use today, our performance will plateau. Not only will it plateau, there is a possibility that performance will decrease a bit as many cores are introduced that each are just a little less powerful than their predecessors (for less power consumption, less heat dissapation, etc.). Cleary, new tools for us developers to write applications with are necessary.
MESSAGING:Today, concurrency usually has to be done by the brightest developers in a business. The problem with this is that the brightest developers are then being consumed by concurrency minutia rather than being able to be focused on core business problems and helping the business’s bottom line. By providing new libraries and tools that make it easy to write parallel code, we hope to allow the best and brightest developers focus on the business problems at hand. This in turn enables other developers to be able to address concurrency and parallelism.This is the long term goal of Microsoft with the Parallel Computing Initiative. Visual Studio 2010 and .NET Framework 4 is merely the first step being taken in this direction.
MESSAGING:There are three primary improvement areas in Visual Studio 2010 and .NET Framework 4 that we will discuss in this talk: System.Threading improvements, introduction of Parallel Extensions to the .NET Framework, and a new unified cancellation model coming in .NET Framework 4.
MESSAGING:Several important new primitives coming to System.ThreadingBarrier and CountdownEvent make coordinating multithreaded code easier than it was beforeTechnical descriptions are boring and not the best candidate for learningLet’s learn Barrier and CountdownEvent through analogy
MESSAGING:The new Barrier synchronization primitive allows you to provide “sync-points” where all threads/tasks of execution meet at. Then, no threads/tasks continue until all of them have arrived at the barrier. This is a way that now you can easily introduce “check points” into your parallel operations if there are naturally areas where you want different execution units to meet. A Barrier can be re-used multiple times to issue many “check points” that could occur in the code.As an example, think about a road trip. If some friends are taking a road trip to Seattle, for instance, they might all meet at the gas station first. They shouldn’t leave the gas station until all of them arrive so they can leave together. In this case, the gas station itself could represent the barrier. There is a natural “check point” that occurs before all of them leave and start driving again to Seattle.
MESSAGING:A new unified cancellation model is being introduced with .NET Framework 4. This new model allows many different operations (like separate threads of execution, I/O calls, etc.) to be organized in such a way that they can all be cancelled with one simple call in a unified way (no matter what the operation itself is).The new CancellationTokenSource and CancellationToken constructs is what the new unified cancellation model is comprised of. The CancellationTokenSource is the core of this model. From a CancellationTokenSource, you can pass out as many CancellationTokens as you wish to various types of operations that are or are not happening in parallel. Then you can use the CancellationTokenSource to signify that everything needs to be cancelled by calling a Cancel() method. Then the cancellation is reflected in all the various tokens.One key aspect of this new model is that the individual tokens that are passed out have no way to signify cancellation themselves. There is also no way to get from a reference to a CancellationToken back to the original CancellationTokenSource. This is by design. When you are passing out tokens to as many operations as you need to in order to keep your cancellation unified, the last thing you want to do is to allow some random token to be able to signify a Cancel() request and then cancel all the other processing that is happening.Think of this another way, compare cancellation tokens by the devices handed out at some restaurants to signify that you (as the customer) are ready to be seated. Though you have the device in your hand, there is no possible way for you personally to make it go off (that would kind of defeat the purpose). The only party that can signal that you are “ready to be seated” is the restaurant itself. This is the same relationship the CancellationTokenSource and CancellationToken have to each other.
MESSAGING:Parallel Extensions is simply a .NET library (meaning, normal .NET code that can be used by any .NET-based language). It contains three different pieces: PLINQ, TPL, and CDS (System.Collections.Concurrent). Parallel Extensions addresses everything from declarative and imperative data parallelism, to imperative task parallelism.
MESSAGING:The task scheduler in Parallel Extensions is very smart and powerful. There are two aspects that make it so: the ability for different worker threads to “steal work” from other threads when there is work to be done, and the addressing of data locality when a thread is determining what work to actually do.When a thread needs to find more work to do, it looks in three different places (in the following order):It’s local queueThe global queueOther thread’s queues that have work to be doneIt’s important to know that data locality is addressed when a thread needs to grab more work to do:When pulling from the local queue, the worker pulls the last item added to the queue. This is because the last item added to the queue has the greatest chance of still being fresh in the cache, as opposed to older items which are more likely have expired and been flushed from cache.When pulling from another worker’s queue, the current worker pulls the oldest item added to the queue. This is because the oldest item added to the queue has the greatest chance of not being in the cache even for its local worker (and hence needing to load in anyways).
MESSAGING:With the introduction of the new Parallel static class, it becomes much easier to parallelize independent statements. The great thing is that if program statements are completely independent from each other (i.e. they don’t share any common shared stated between the various calls are require the calls to take place in a given order), they can easily be parallelized using the new Parallel.Invoke() method. There are other static methods declared off the Parallel class that make other parallel operations easy as well (like Parallel.For() and Parallel.ForEach(). We’ll take a look at some of these in the demo.So one might ask: “Well, if it’s that simple, why doesn’t the compiler just do this for automatically?” The problem is that it’s not quite that simple. In our world of imperative code and shared state, there’s no easy way to guarantee that these methods being called don’t have some sort of state somewhere that they are sharing. It could be five method calls deep, it could be ten, it could be more. You, as the developer, are the one with the necessary knowledge to know where this is true. Therefore, Parallel.Invoke() is strictly an opt-in process. Otherwise, we could do more damage than good.
MESSAGING:PLINQ is a technology that allows developers to _easily_ leveragemanycore. The great thing about PLINQ is that if you are using LINQ-to-objects, there is a very minimal impact to your code in order for it to use PLINQ. All it takes to use PLINQ is adding “.AsParallel()” to your query. This will turn the query into a PLINQ query and will use the PLINQ execution engine when executed.One small change, and your code now takes advantage of all the hardware available to you.NOTES:AsParallel() works by returning an IParallelEnumerable so every subsequent query operator works against the new IParallelEnumerable rather than the normal IEnumerable. See the hands-on lab for Parallel Extensions for more details.
MESSAGING:So to recap, parallel computing enhancements for managed developers in Visual Studio 2010 and .NET Framework 4 are comprised of three different areas: System.Threading improvements, introduction of Parallel Extensions to the .NET Framework, and the newly introduced unified cancellation model (CancellationToken/CancellationTokenSource).