Description

Welcome back to another Visual Studio 2010 and .NET Framework 4.0 Week video. In this latest installment, we catch up with Rick Molloy, Program Manager on the Parallel Computing Platform team.

Rick takes us on a tour of the new parallelism features coming with C++ 10 via the Parallel Patterns Library. Covered are features like task groups, structured task groups, and agents-based parallelism, among many others.

The Discussion

And yes, that's me in the window in the beginning, something I didn't catch while filming :O. Also, the sound on this video is less than stellar as there was a lot of static noise in the background, so we apologize for that.

Hey qrt, I did that because they are actually screencasts which include the screen being shown at 1024x768 resolution. If they were formatted for the iPod, could you even see anything that is being shown off? If you still feel this is important, I will
definitely keep this in mind when I publish future screencasts!

Hey Jason, I wouldn't know since I haven't tried that yet. The resolution of the iPod is 480 x 320 so chances are low. But I still wouldn't mind to give it a try and report back if you find the time to convert an episode.

Thanks Rick,This parallel work that you're all working on is fantastic. Abstracting away the hard parts is definitely going to bring great benefits to all developers, and not just a minority in academia.I trust your making some progress with the parallel breakpoints problem.

How much of this work has been put into Azure?

Are you focusing on native first or going forward in parallel (no pun intended) with managed languages?

Glad you enjoyed this technogeist, if you check out the Visual Studio 2010 CTP, you'll see that we're doing significant work concurrently, in both native and in .NET 4.0 to support concurrency. I'd also encourage you to check out the video on the native
focused asynchronous agents which is also in the CTP.

Daniel Moth walked through some of the
tools that we're working on as well for debugging and I'd encourage you to check that out.

The parallell patterns library seems to be very simple and powerful. But this is not a bit of standard c++0x, is it?

If no; is there some equivalence in the c++0x standard library?

Where can we read some synopsis over the ppl.h? You said that the structured_task_group had the same functionallity that task_group, but it would be less portable and more optimized for this fibonacci-program. But when i try to use structured_task_group
with a lambda, it does not work because there is no run-method in structured_task_group that takes a lambda. Will the structured_task_group work with lambdas in the future, or do i have to use task_group with lambdas?

Also, the helper factory method is not mandatory, right? I'm new to parallell programming, but this library seems to be very simple, all i want is some specification or synopsis of it.

Sorry for the late response on this. The C++0x library draft is
here it has several crucial improvements to help with multi-threading (std::atomic, std::thread, and the locks), but doesn't address fine-grained concurrency in the same way that the PPL or the Concurrency Runtime does. std::thread gives a developer a
portable way to start threads (which is wonderful) and the atomics library and locks give folks a portable way to add thread safety and compare and swap operations, but the PPL provides a task abstraction and algorithms on top of it (similar to the STL algorithms)
for describing potential concurrency in an application. Specifically, I can build up generic 'algorithms' like those in the STL, for_each, accumulate, sort, transform and if as a developer I can guarantee that they won't be modified while being iterated upon
(or provide safety), I can use the task_group and task_handles to implement versions of those algorithms that can be run in parallel.

The helper function I showed make_task is not critical, it's a nicety. task_handle is a template helper class and we need to specify a type for a functor. I could use a std::function as the type, but again here this is binding it to a particular type, when
the type of a lambda is intentionally anonymous, the helper function just makes it a little easier to express, particularly when the lambda is declared inside the constructor.

I can then schedule any of these with a structured_task_group or a task_group.

i.e.

structured_task_group tg;tg.run(task1);tg.wait();

or: task_group tg;tg.run(task2);tg.wait();

structured_task_group is lighter weight and more efficient, but really for structured, nested or recursive scenarios (like building loops or algorithms), the task_group is more general purpose, the run and wait methods are threadsafe so can be use for unstructured
parallelism, and work can be scheduled on it on multiple threads for example, or it can be waited on a separate thread than it was started on.

Great, i get it now. I have actually learnt a lot since my first comment so i already knew most of it but now i also get the make_task template function. All it does is to allow me to use auto instead of explicity declaring the type, wouldn't it be great
if you then shipped ppl.h with the make_task function? It does no harm to include it as far as i can tell.

Anyway; so i will have to use a task_handle with structured_task_group, wich is very easily done with decltype or if you include make_task But task_group can directly take a lambda.

Ok thanks for the reply, this is very great to actually be talking to Microsoft and clearing things up. VS10 will be a great product, especially since i get it for free through dreamspark?

I have seen the "image" example in 2 or 3 videos now. Is there somewhere that this code is available? It would be a great tutor on how all this ties together. I have looked at the blog referenced above, but I have not been able to find the source code.