Native Parallelism with the Parallel Patterns Library
- Posted: Nov 13, 2008 at 7:37 AM
- 61,751 Views
- 13 Comments
Download
How do I download the videos?
- To download, right click the file type you would like and pick “Save target as…” or “Save link as…”
Why should I download videos from Channel9?
- It's an easy way to save the videos you like locally.
- You can save the videos in order to watch them offline.
- If all you want is to hear the audio, you can download the MP3!
Which version should I choose?
- If you want to view the video on your PC, Xbox or Media Center, download the High Quality WMV file (this is the highest quality version we have available).
- If you'd like a lower bitrate version, to reduce the download time or cost, then choose the Medium Quality WMV file.
- If you have a Zune, WP7, iPhone, iPad, or iPod device, choose the low or medium MP4 file.
- If you just want to hear the audio of the video, choose the MP3 file.
Right click “Save as…”
- WMV (WMV Video)
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.
Enjoy!
This is another Visual Studio 2010 and .NET Framework 4.0 Week Video. For other Visual Studio 2010 videos, check out the Visual Studio topic area here on Channel 9.
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.
Enjoy!
This is another Visual Studio 2010 and .NET Framework 4.0 Week Video. For other Visual Studio 2010 videos, check out the Visual Studio topic area here on Channel 9.
Comments Closed
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Thanks for the feedback!
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?
Great Stuff!
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.
-Rick
I think the only tricky thing was the factory method for constructing a task...
#include <ppl.h>
//a helper factory mathod for declaring a task
template <class Func>
task_handle<Func> make_task(Func& fn){
return task_handle<Func>(fn);
};
void main(){
// a task_group
task_group tasks;
//a task
auto t = make_task([]{ cout << "hello from a task" << endl;});
tasks.run(t);
tasks.wait();
}
As far as getting access to ppl.h, check the blog at http://blogs.msdn.com/nativeconcurrency there is some content on the PPL, links to the CTP and links to the forums.
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.
These are all syntactically correct (though compiled in this form)...
auto lambda1([](){ cout << " hello world from a task! " << endl';});
task_handle<function<void(void)>> task1(lambda1);
auto task2(make_task(lambda1));
task_handle<decltype(lambda1)> task2;
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.
-Rick
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
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?
here is the thing : we're in 2009, and I can't display your freaking video
-at home, on a standard mac....
- at work, on window because of your new wizzbang format for... videos ? (wtf?)
How can such a simple thing gets so complex ??
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.
Remove this comment
Remove this thread
close