Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
CFLAGS="-pthreads"
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1563
Location: Germany

PostPosted: Thu Mar 04, 2010 9:19 am    Post subject: CFLAGS="-pthreads" Reply with quote

Does CFLAGS="-pthread" make sense on PowerPC G4 single processor?
gcc.gnu.org...RS_002f6000-and-PowerPC-Options..pthread
Would threading only be used together with USE="threads" for appropriate ebuilds?
_________________
ppc:PowerBook5,8 15"(1440)-G4/1.67,2G|amd64:HP EliteBook 8560w,i7-2620M,16G|Acer Z5610 (Core2QuadQ8200),8G|amd64-prefix:OpenSuse|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770
Lila-Theme
Back to top
View user's profile Send private message
aCOSwt
Bodhisattva
Bodhisattva


Joined: 19 Oct 2007
Posts: 2537
Location: Hilbert space

PostPosted: Thu Mar 04, 2010 11:13 am    Post subject: Reply with quote

Hmmm. I fear that there is no general definitive answer to your question.
I think this is terribly package / system dependent.

The unique example I am aware of is mysql 5 / Solaris 2.5 / Single processor, being about 10% slower with the libpthread.

EDIT : I do not exactly understand your second question : Do you mean :
"Will a package be built multi-threaded if and only if the thread use flag is set" ?
If this is what your question means then :

Not necessarily.
A package might be built multi-threaded because there is no option for building it single-threaded.
However if a package gets a threads use flag, then unsetting it will prevent from building the multi-threaded version of it.

BTW, there is no definite link between activating the -pthread option in gcc and being able to build a multi-threaded app. There are other threading libs available.
Back to top
View user's profile Send private message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1563
Location: Germany

PostPosted: Fri Mar 05, 2010 7:39 am    Post subject: Reply with quote

JoseJX told me that if the application uses pthreads, it will add it to the CFLAGs itself. That could possibly be triggered by the USE flag threads but no need to set that USE flag globally.
_________________
ppc:PowerBook5,8 15"(1440)-G4/1.67,2G|amd64:HP EliteBook 8560w,i7-2620M,16G|Acer Z5610 (Core2QuadQ8200),8G|amd64-prefix:OpenSuse|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770
Lila-Theme
Back to top
View user's profile Send private message
aCOSwt
Bodhisattva
Bodhisattva


Joined: 19 Oct 2007
Posts: 2537
Location: Hilbert space

PostPosted: Fri Mar 05, 2010 10:55 am    Post subject: Reply with quote

Massimo B. wrote:
JoseJX told me that if the application uses pthreads, it will add it to the CFLAGs itself. That could possibly be triggered by the USE flag threads but no need to set that USE flag globally.

Well Massimo : What are you trying to achieve ?
- Building your own app ?
- Building the packages in the portage tree and searching for gcc optimization flags ?

In the first case, you do exactly as you wish and if your app makes use of functions that can be found in libraries, then you need to link this app with the library of your choice that contains these functions. Adapted to your threads example, there are several different libs offering these functions => you are not forced to use the libpthread.

In the second case the authors of the app decide what they wish.
- If they wish to use the libpthread then the gcc invocation will force the -pthread option and you just get not choice about this. If you absolutely wish to remove the -pthread then the package will just fail to link because of unresolved external references.
- If they wish the end user has the choice of building a single-threaded version of their app, then you are likely to get some 'xyz_thread_tuv' use flag enabling you to choose. If you choose the threaded version then, the package will be built with the libs chosen by the developpers.
- If they wish to give you the choice on which specific libs you wish, then you are likely to get another 'xyz_thread_tuv' use flag enabling you to choose.

Just have a look here : http://www.gentoo.org/dyn/use-index.xml
And look the description associated with :
- The nptl use flag. If you set this use flag, the package will be built with the Native POSIX threads library
- The threads global use flag : labeled as : Adds threads support for various packages. Usually pthreads
You will notice the Usually... => Not necessarily !
Back to top
View user's profile Send private message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1563
Location: Germany

PostPosted: Fri Mar 05, 2010 11:06 am    Post subject: Reply with quote

Just for the second case and if the end user has the choice of building a single-threaded or multi-threaded version: Is there a performance gain of going for the multi-threaded?
But just as you said in your first post there could be a 10% performance loss of having the multi-threaded version.
Thanks for the clarification.
_________________
ppc:PowerBook5,8 15"(1440)-G4/1.67,2G|amd64:HP EliteBook 8560w,i7-2620M,16G|Acer Z5610 (Core2QuadQ8200),8G|amd64-prefix:OpenSuse|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770
Lila-Theme
Back to top
View user's profile Send private message
aCOSwt
Bodhisattva
Bodhisattva


Joined: 19 Oct 2007
Posts: 2537
Location: Hilbert space

PostPosted: Fri Mar 05, 2010 8:10 pm    Post subject: Reply with quote

Massimo B. wrote:
Thanks for the clarification.

:lol: :lol: :lol:

Clarification ?

Well... Being happy that it sounds like a clarification for you... as...
es ist nicht für mich... :wink:

As a matter of fact...

You certainly get performance issues building some app multi/single threaded...

However...

1/ You will get different performances regarding a single app but, depending on your scheduler... globally... considering all your apps running together... your judgment might be different.
2/ You will get different performances (apps centered / global system considered) depending on the lib used for the needed functions. (libpthread being some time far less some times more efficient that native thread libs...)

That is just why my very first post insisted on the fact that "it depends".
It depends on which efficiency you consider / which package you consider / which system you are on / which processor you use / how much loaded is your system.

How much loaded is your system is another issue in your case.
In the only example I have of a multi-threaded app running on a single proc system, the differences in performances were huge depending on the load of the processor.
The more the processor was loaded, the greater the differences was between libpthread / native lib

In conclusion ?
Just.... try... :?

Good luck !
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC 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