You don't have a ask twice!
Look for openMP.
--
Ian Collins
This is a good tutorial for those fluent in C++:
> I am programing something that could greatly benefit from parallel
> computing in C++, in parts of the program, where user defined classes
> are passed. I have googled but I cannot find the proper tool. Any
> experienced programmer could give me a hint, namely some good
> keywords?
What's wrong with pthreads?
Rui Maciel
Hey, Warp! Nice to see you here... ;)
It's very low-level, and does not provide most of the tools one need for
real-world parallel processing: thread pools, data structures that
support concurrent access, etc. (I'm partial to Intel TBB.)
> It's very low-level, and does not provide most of the tools one need for
> real-world parallel processing: thread pools
Isn't that a common design pattern that is easy to implement?
> data structures that
> support concurrent access
What's wrong with mutexes and read-write locks?
Rui Maciel
Of course.
>> data structures that
>> support concurrent access
>
> What's wrong with mutexes and read-write locks?
Nothing. However, if your looking for extremely scaleable high-performance
data-structures, well... That's another story... Perhaps best discussed over
on `comp.programming.threads'.
Not well.
>> data structures that
>> support concurrent access
>
> What's wrong with mutexes and read-write locks?
Those are large categories of things. There are lots of different types
of locks, and some of them become performance-prohibitive when there is
too much competition for them.
Not really. In particular, assigning tasks to threads at random kills
cache coherency and performance. You can write "a thread pool," but it
takes multiple person-months to get something competitive with COTS
solutions.
You can create full-blown lock-based work-stealing schedulers in POSIX that
have pretty darn good scalability. Wait-free work-stealing algorithms are
another story... Here is a pretty good one:
http://groups.google.com/group/comp.programming.threads/browse_frm/thread/8ad297f61b369a41
> In particular, assigning tasks to threads at random kills cache coherency
> and performance.
That depends on several factors. Anyway, a simple way to get good cache
performance is to batch up similar actions together and execute them all on
a single CPU:
http://www.usenix.org/events/usenix02/full_papers/larus/larus.pdf
> You can write "a thread pool," but it takes multiple person-months to get
> something competitive with COTS solutions.
Sometimes. Intel TBB and Clik++ are both based on work-stealing, and those
algorihtms are not rocket science, IMVHO of course...
However, COTS are OH SO CONVENIENT. AFAICT, Intel TBB is a very good choice.
:^)