MSDN Magazine April 2012 - C++AMP, Kinect and Bacteria
Written by Mike James
Tuesday, 03 April 2012
This month's MSDN Magazine is more cutting edge than usual with some parallel programming, Kinect, AI, bacterial algorithms, code generation and some Microsoft technologies.
If April's MSDN Magazine has a theme is is probably C++ AMP - but only because there are two articles on the topic.
A Code-Based Introduction to C++ AMP is an introduction to the AMP Accelerated Massive Parallelism technology includes with Visual Studio 11 - yes not all of the new features are about WinRT. C++ AMP is Microsoft's alternative to language extensions like OpenCL which allow you to work with heterogeneous environments which mix CPU and GPU. C++ AMP is open specification and there could be other implementations in the future but for the moment it is tied to DirectX 11. This article does a reasonable job of introducing how a typical C++AMP program works but as the "Code-Based" part of the title suggest by showing you the code rather than describing the principles.
The big topic not introduced in the previous article is Tiling which is taken up in Introduction to Tiling in C++ AMP In C++ AMP, the most common and first step to dialing up performance gains to the next level is through a technique called tiling. This is essentially how to break the problem up into discrete blocks that can be handed out to each processor.
If you think Apple's Siri is the cutting edge you need to see project Lily, a Kinect-enabled WPF application that aims to create a virtual office assistant. It started out as a student project but it's such a good idea that it would be a shame to drop it. In this part of the description Context-Aware Dialogue with Kinect, there is a promised second part for next month, focuses on speech recognition and a simple trick of maintaining a state to narrow down the likely phrases to be used. From the programmers point of view the audio aspects of the Kinect are relatively neglected. Next month the article is to focus on using the depth camera. It is a good article, read if for inspiration.
Code generation isn't something that a lot of programmers need to get involved with but if you are interested in the Domain Specific Language (DSL) approach to applications then you can't avoid it. Lowering the Barriers to Code Generation with T4 explains how the T4 toolkit makes it easier. The article explains how to build, implement, and debug code generation and how to recognize situations where it might be useful.
.NET rumbles on even if Microsoft's headline attention is on WinRT and a return to native code. One of the main reasons for the attraction to native code is that it is faster so it's good to read An Overview of Performance Improvements in .NET 4.5 to discover that even managed code can go faster. The article includes a rundown of upcoming performance improvements in the .NET Framework 4.5 that affect the CLR, ASP.NET, ADO.NET, Entity Framework and more.
This is a fairly standard explanation of how to use the media queries to format the UI to suit the display device. This is well explained but it isn't particularly Microsoft specific and given it's HTML5 it really shouldn't be. If you don't know about media queries then its a good introduction.
Notable among the regular columns is Test Run:Bacterial Foraging Optimization which describes and illustrates a nice "swarm" style algorithm for finding a maximum. If you think ant optimization is about as low as it can go on the evolutionary scale you need to find out how bacteria behave.
Other interesting articles include Dino Exposito on Long Polling and SignalR which looks at the HTTP protocol and how to get more out of it. After looking at streaming audio Charles Petzold move on to actually generating music Musical Instruments for Windows Phone, In this case the instrument is a Theremin which you can play by touch.
Other articles including web only content that you might find interesting are:
This issue splits the programming world like no other topic. It's a cross-platform, cross-language divide that pits fellow programmer against the barbarians who simply format their code in the wrong w [ ... ]