[libstdc++-v3 parallel mode] Why is not std::transform executed in parallel by default?

Johannes Singler singler@ira.uka.de
Wed Sep 17 10:03:00 GMT 2008


Kento EMOTO wrote:
> Hi,
> 
> I'm enjoying the novel libstdc++ parallel mode, and I have some
> questions about it:
> 
>   Does a user need to specify __gnu_parallel::parallel_balanced (or
>   other choice in _Parallelism) explicitly to execute std::transform
>   (and __gnu_parallel::transform) in parallel?
>   Is it an intended (desired) behavior of the parallel mode?

No.  This is a bug.  Thanks for finding it.

--snipped--

> BTW, when the default parameter value
> __gnu_parallel::parallel_balanced of the last parameter of
> transform1_switch (parallel/algo.h) is put into the prototype
> declaration of transform1_switch (parallel/algorithmfwd.h),
> std::transform is executed in parallel by default (when
> -D_GLIBCXX_PARALLEL is specified).
> 
>   Why is the default value specified not in the prototype
>   declaration but in the definition?
> Since the prototype without the default value is found earlier than
> the definition with the default value, g++ determines that
> transform1_switch does not have the default value. This situation
> occurs also in other 'XXX_switch'es.

Looks like you also found the solution :-)
Fixed accordingly in attached patch for /parallel.  Does that solve the
problem so far?  I will investigate the problem further.

-- Johannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: default_parallel_balanced.patch
Type: text/x-patch
Size: 5348 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20080917/7b2f64b1/attachment.bin>


More information about the Libstdc++ mailing list