
Hi All Some vague navel-gazing follows, please bear with me.... I've recently encountered OpenMP, and wondered if there's any activity within Boost to exploit this. Although OpenMP is new to me I appreciate it's been around a while, so apologies in advance if this is all old hat! In a nutshell as I understand it OpenMP is an open standard for explicity directing the compiler to exploit potential parallelism in the code by embedding #pragmas when statements or loops can be parallelised, and specifying in the pragma which variables are common and which are per execution path. The compiler then sorts out threads and locking etc. We have seen some dramatic performance gains using OpenMP. Ok, some (possibly very naive) thoughts - In some ways this is an alternative to Boost thread pools. - Using explicit pragmas is an intermediate step, and ultimately it might be hoped that a compiler would be able to do all this without external direction. - The whole OpenMP notion is too specific for a general library like Boost It occurs to me that there might be benefit in parallelised standard algorithms (for_each, find, etc), although these might have slightly different behaviour to the existing single thread versions. For example, find() would find any occurance of a value, not necessarily the first. Has any work been done in this area, and would it be of interest to anyone? Are there any known show-stoppers that blow the whole notion out of the water? Thanks for listening, - Rob.

Hi,
On Wed, 7 Apr 2010 08:57:35 +0100
Robert Jones
Has any work been done in this area, and would it be of interest to anyone?
you may have a look at the OpenMP Multi-Threaded Template Library. http://tech.unige.ch/omptl/ Heiko -- -- Nur der Wechsel ist wohltätig. Unaufhörliches Tageslicht ermüdet. -- (Wilhelm von Humboldt, 1767-1835) -- Cluster Computing @ http://www.clustercomputing.de -- Number Crunch Blog @ http://numbercrunch.de

Robert Jones wrote:
Hi All
Some vague navel-gazing follows, please bear with me....
I've recently encountered OpenMP, and wondered if there's any activity within Boost to exploit this.
Not that I know of. Intel TBB provides functionality similar to OpenMP as a library and is closer to Boost-like code.

Hi Robert, Robert Jones wrote:
- In some ways this is an alternative to Boost thread pools. - Using explicit pragmas is an intermediate step, and ultimately it might be hoped that a compiler would be able to do all this without external direction. - The whole OpenMP notion is too specific for a general library like Boost
I, too, have used OpenMP and noticed significant improvements by using it. It would be nice if Boost supported it. I'm not very knowledgeable in OpenMP or threads -- but I won't let that stop me from giving an opinion. :-) I have never used Boost.thread before, but looking at its documentation now, it looks like its purpose is to allow developers to create multithreaded software from scratch. So, various functions are needed to manage communication between threads, etc. On the other hand, OpenMP's strength is to allow users to take a sequential program and parallelize it by indicating which variables [in a loop, etc.] do not conflict with each other. So, as for point #1, I don't think it is an alternative to threads -- their motivations are slightly different. As for your second point, I don't know what compiler research is nowadays, but I would think it would be difficult to determine automatically if two variables will never conflict. In fact, doing it by hand with OpenMP, I got it wrong once or twice -- poor eyesight + poor variable names. :-) Putting this together, I think OpenMP isn't the same as Boost.threads or even Boost.mpi and I'm not so sure how Boost could fit with OpenMP -- it seems more suitable as pragmas to the compiler. However, I don't mind being proved wrong as something more Boost-like might be more intuitive to users than the #pragmas... Ray

Robert Jones wrote:
Has any work been done in this area, and would it be of interest to anyone?
http://gcc.gnu.org/onlinedocs/libstdc++/manual/parallel_mode.html

On Wed, Apr 7, 2010 at 12:51 PM, Ilya Sokolov
Robert Jones wrote:
Has any work been done in this area, and would it be of interest to anyone?
http://gcc.gnu.org/onlinedocs/libstdc++/manual/parallel_mode.html
Lol, thanks IIya, as usual I'm well behind the curve - I see it's all been done before! Now, how about parallel versions of all the new range algorithms! (Only kidding!) - Rob.
participants (5)
-
Heiko Bauke
-
Ilya Sokolov
-
Mathias Gaunard
-
Raymond Wan
-
Robert Jones