Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
-d_glibcxx_parallel
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
kfiaciarka
Veteran
Veteran


Joined: 20 May 2005
Posts: 1498
Location: Dobre Miasto, Poland

PostPosted: Wed Apr 09, 2008 9:16 pm    Post subject: -d_glibcxx_parallel Reply with quote

Does anyone tried this cflag combined with -fopenmp ?
Code:
-D_GLIBCXX_PARALLEL -fopenmp
and experienced any speedup or compilaton issues? Here is some background
Back to top
View user's profile Send private message
MostAwesomeDude
Guru
Guru


Joined: 12 Aug 2007
Posts: 373

PostPosted: Thu Apr 10, 2008 6:46 pm    Post subject: Reply with quote

Technically, you're supposed to set that flag along with -fopenmp for OpenMP support, but GCC appears to enable its builtin speedups even without it.

Yeah, I have a few things that use it, but the majority of code in Gentoo has not been altered to support OpenMP. Adding it to your CFLAGS would be pretty silly, since most code would end up linked with libgomp but not actually using it.
_________________
Don't believe the "n00b" under my name.
Back to top
View user's profile Send private message
kfiaciarka
Veteran
Veteran


Joined: 20 May 2005
Posts: 1498
Location: Dobre Miasto, Poland

PostPosted: Thu Apr 10, 2008 6:56 pm    Post subject: Reply with quote

so what is the optimal solution to get some benefits from it ? Is just openmp USE enough for gcc to support it so additional -fopenmp c(xx)flag is not needed? Then -D_GLIBCXX_PARALLEL alone would be all you need to set ?
Back to top
View user's profile Send private message
loftwyr
l33t
l33t


Joined: 29 Dec 2004
Posts: 970
Location: 43°38'23.62"N 79°27'8.60"W

PostPosted: Thu Apr 10, 2008 8:10 pm    Post subject: Reply with quote

The D_GLIBCXX_PARALLEL flag will only have a useful effect if the program makes use of OpenMP structures. Setting it as a default CFLAGS entry wouldn't be of any use. The programmer would set it if it would have any effect.
_________________
My emerge --info
Have you run revdep-rebuild lately? It's in gentoolkit and it's worth a shot if things don't work well.
Celebrating 5 years of Gentoo-ing.
Back to top
View user's profile Send private message
MostAwesomeDude
Guru
Guru


Joined: 12 Aug 2007
Posts: 373

PostPosted: Thu Apr 10, 2008 10:11 pm    Post subject: Reply with quote

kfiaciarka wrote:
so what is the optimal solution to get some benefits from it ? Is just openmp USE enough for gcc to support it so additional -fopenmp c(xx)flag is not needed? Then -D_GLIBCXX_PARALLEL alone would be all you need to set ?


Setting -fopenmp will cause GCC to link against libgomp, and will enable OpenMP. The -D_GLIBCXX_PARALLEL will enable parallel STL code in libstdc++ for certain algorithms, which means that stuff in <algorithm> and <numeric> will automagically become parallelized.

GCC 4.2 and 4.3 will not enable OpenMP without -fopenmp.
_________________
Don't believe the "n00b" under my name.
Back to top
View user's profile Send private message
kfiaciarka
Veteran
Veteran


Joined: 20 May 2005
Posts: 1498
Location: Dobre Miasto, Poland

PostPosted: Thu Apr 10, 2008 10:50 pm    Post subject: Reply with quote

@MostAwesomeDude
ok, maybe you have got some personal experience with it? Or you think that giving it a shot is just pointless?
Back to top
View user's profile Send private message
loftwyr
l33t
l33t


Joined: 29 Dec 2004
Posts: 970
Location: 43°38'23.62"N 79°27'8.60"W

PostPosted: Fri Apr 11, 2008 12:41 am    Post subject: Reply with quote

MostAwesomeDude wrote:

Setting -fopenmp will cause GCC to link against libgomp, and will enable OpenMP. The -D_GLIBCXX_PARALLEL will enable parallel STL code in libstdc++ for certain algorithms, which means that stuff in <algorithm> and <numeric> will automagically become parallelized.

GCC 4.2 and 4.3 will not enable OpenMP without -fopenmp.


From the GOMP webpage:
Quote:

When -fopenmp is used, the compiler will generate parallel code based on the OpenMP directives encountered.


What that means is, IF the programmer is using openMP code, then -fopenmp and _GLIBCXX_PARALLEL will have an affect. On normal code, -fopenmp has no effect.
_________________
My emerge --info
Have you run revdep-rebuild lately? It's in gentoolkit and it's worth a shot if things don't work well.
Celebrating 5 years of Gentoo-ing.
Back to top
View user's profile Send private message
MostAwesomeDude
Guru
Guru


Joined: 12 Aug 2007
Posts: 373

PostPosted: Fri Apr 11, 2008 5:41 am    Post subject: Reply with quote

kfiaciarka wrote:
@MostAwesomeDude
ok, maybe you have got some personal experience with it? Or you think that giving it a shot is just pointless?


One of my side projects is a video game, and we have OpenMP support in some places in the code. So far, we're not seeing massive improvements; the biggest thing we're seeing is that we can peg one core with graphics and still have plenty of room on the second core for everything else, which is not exactly OpenMP-specific but is easier with it enabled.

Quote:

What that means is, IF the programmer is using openMP code, then -fopenmp and _GLIBCXX_PARALLEL will have an affect. On normal code, -fopenmp has no effect.


Half-right. The define is needed (I think?) to enable the parallel paths in the STL. So, using "-fopenmp -D_GLIBCXX_PARALLEL" should turn std::sort into a parallelized block of code upon compile. This allows unmodified code to experience OpenMP gains. However, I know that this is limited to the algorithms in <algorithm> and <numeric>, so if you don't use those you won't see anything. (And, before you ask, I have no idea about stuff like Boost or SWIG.)
_________________
Don't believe the "n00b" under my name.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum