Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Optimization settings
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
MisterTwo
n00b
n00b


Joined: 10 Apr 2002
Posts: 3
Location: Stilwater, Ok. (Ok State Univ)

PostPosted: Fri May 21, 2004 4:37 pm    Post subject: Optimization settings Reply with quote

I will be installing Gentoo 2004.1 tomorrow on a dual athlon 2000+ with 1gig of ram. What would be the best optimizations to use? And how do I start the install so that gcc takes advantage of both processors while it builds the system.

Thanks,
Jason
Back to top
View user's profile Send private message
moocha
Watchman
Watchman


Joined: 21 Oct 2003
Posts: 5722

PostPosted: Fri May 21, 2004 5:00 pm    Post subject: Re: Optimization settings Reply with quote

MisterTwo wrote:
I will be installing Gentoo 2004.1 tomorrow on a dual athlon 2000+ with 1gig of ram. What would be the best optimizations to use?


See the CFLAGS Central thread. My personal (take this word to heart - this topic can generate endless flamewars) recommendation is
Code:
-march=athlon-xp -mcpu=athlon-xp -O3 -fomit-frame-pointer -pipe


If you want to go for stability rather than speed you can use -O2 instead of -O3. But normally you shouldn't have any issues with -O3.

If you're using GCC 3.3.3, then you can also add
Code:
-ftracer


MisterTwo wrote:
And how do I start the install so that gcc takes advantage of both processors while it builds the system.


Edit /etc/make.conf and make sure it contains
Code:
MAKEOPTS="-j3"

_________________
Military Commissions Act of 2006: http://tinyurl.com/jrcto

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin
Back to top
View user's profile Send private message
GentooBox
Veteran
Veteran


Joined: 22 Jun 2003
Posts: 1168
Location: Denmark

PostPosted: Sat May 22, 2004 1:15 am    Post subject: Re: Optimization settings Reply with quote

moocha wrote:
MisterTwo wrote:
I will be installing Gentoo 2004.1 tomorrow on a dual athlon 2000+ with 1gig of ram. What would be the best optimizations to use?



See the CFLAGS Central thread. My personal (take this word to heart - this topic can generate endless flamewars) recommendation is
Code:
-march=athlon-xp -mcpu=athlon-xp -O3 -fomit-frame-pointer -pipe


If you want to go for stability rather than speed you can use -O2 instead of -O3. But normally you shouldn't have any issues with -O3.

If you're using GCC 3.3.3, then you can also add
Code:
-ftracer


MisterTwo wrote:
And how do I start the install so that gcc takes advantage of both processors while it builds the system.


Edit /etc/make.conf and make sure it contains
Code:
MAKEOPTS="-j3"


if you have -march in your cflags, then you dont need -mcpu.
i also think that -mcpu is not used anymore, now its -mtune or something.
maby thats only for GCC 3.4, i dont know.
search if you want to know :)
_________________
Encrypt, lock up everything and duct tape the rest
Back to top
View user's profile Send private message
moocha
Watchman
Watchman


Joined: 21 Oct 2003
Posts: 5722

PostPosted: Sat May 22, 2004 1:21 am    Post subject: Re: Optimization settings Reply with quote

GentooBox wrote:
if you have -march in your cflags, then you dont need -mcpu.

Wrong. -march implies -mcpu, true. However, there are ebuilds that filter out -march. If you encounter such a beast, and if you don't have -mcpu in your CFLAGS, you'll end up with no CPU-specific optimizations at all. Having -mcpu in the CFLAGS ensures that in those cases you'll at least get the instruction stream tuned for your CPU, even if it doesn't use architecture-specific instructions.
GentooBox wrote:
i also think that -mcpu is not used anymore, now its -mtune or something.
maby thats only for GCC 3.4, i dont know.

In GCC 3.4 the -mcpu syntax is deprecated in favor of -mtune, but even GCC 3.4 still accepts -mcpu as a synonym.
GentooBox wrote:
search if you want to know :)

Now that's a piece of advice I'd like to give right back to you... :D
_________________
Military Commissions Act of 2006: http://tinyurl.com/jrcto

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin
Back to top
View user's profile Send private message
GentooBox
Veteran
Veteran


Joined: 22 Jun 2003
Posts: 1168
Location: Denmark

PostPosted: Sat May 22, 2004 1:52 am    Post subject: Re: Optimization settings Reply with quote

moocha wrote:
GentooBox wrote:
if you have -march in your cflags, then you dont need -mcpu.

Wrong. -march implies -mcpu, true. However, there are ebuilds that filter out -march. If you encounter such a beast, and if you don't have -mcpu in your CFLAGS, you'll end up with no CPU-specific optimizations at all. Having -mcpu in the CFLAGS ensures that in those cases you'll at least get the instruction stream tuned for your CPU, even if it doesn't use architecture-specific instructions.


well, there is no such ebuild ;)
only libvorbis, and that was because of a bug and that bug is fixed in -r2
EDIT: and crack-attack, but what the heck.

Quote:
# find * |xargs grep march |grep filter
dev-lang/squeak/squeak-3.6_p3.ebuild: filter-flags "-fPIC" "-maltivec" "-mabi= altivec" "-fstack-protector" "-pipe" "-g" "-mtune" "-march" "-mcpu" "-O" "-O1" " -O2" "-Os" "-O3" "-freorder-blocks" "-fprefetch-loop-array" "-fforce-addr"
dev-lang/squeak/squeak-3.4.1-r1.ebuild: filter-flags "-fPIC" "-maltivec" "-mabi= altivec" "-fstack-protector" "-pipe" "-g" "-mtune" "-march" "-mcpu" "-O" "-O1" " -O2" "-Os" "-O3" "-freorder-blocks" "-fprefetch-loop-array"
dev-lang/squeak/squeak-3.4.1-r2.ebuild: filter-flags "-fPIC" "-maltivec" "-mabi= altivec" "-fstack-protector" "-pipe" "-g" "-mtune" "-march" "-mcpu" "-O" "-O1" " -O2" "-Os" "-O3" "-freorder-blocks" "-fprefetch-loop-array" "-fforce-addr"
dev-libs/libxml2/ChangeLog: line with scrollkeeper and gconf (#26320). filters for all marchs
dev-lisp/clisp/clisp-2.31-r1.ebuild: is-flag -march=athlon-xp && filter-flags -O?
eclass/crosscompile.eclass: filter-flags "-march= -mcpu="
games-arcade/crack-attack/crack-attack-1.1.10.ebuild: [ "`gcc-fullversion`" == "3.2.3" ] && filter-flags -march=pentium3
games-arcade/crack-attack/ChangeLog: Add filter-flags to remove march=pentium3 #30483.
media-libs/libvorbis/libvorbis-1.0.1-r1.ebuild: is-flag -march=k6-3 && filter-flags -fomit-frame-pointer
media-libs/libvorbis/libvorbis-1.0.1-r1.ebuild: is-flag -march=k6-2 && filter-flags -fomit-frame-pointer
media-libs/libvorbis/libvorbis-1.0.1-r1.ebuild: is-flag -march=k6 && filter-flags -fomit-frame-pointer
media-libs/libvorbis/libvorbis-1.0.1-r1.ebuild: filter-flags -march=pentium?
media-libs/libvorbis/libvorbis-1.0.1.ebuild: is-flag -march=k6-3 && filter-flags -fomit-frame-pointer
media-libs/libvorbis/libvorbis-1.0.1.ebuild: is-flag -march=k6-2 && filter-flags -fomit-frame-pointer
media-libs/libvorbis/libvorbis-1.0.1.ebuild: is-flag -march=k6 && filter-flags -fomit-frame-pointer
media-libs/libvorbis/libvorbis-1.0.1.ebuild: filter-flags -march=pentium?
media-libs/libvorbis/libvorbis-1.0-r4.ebuild: is-flag "-march=k6-3" && filter-flags "-fomit-frame-pointer"
media-libs/libvorbis/libvorbis-1.0-r4.ebuild: is-flag "-march=k6-2" && filter-flags "-fomit-frame-pointer"
media-libs/libvorbis/libvorbis-1.0-r4.ebuild: is-flag "-march=k6" && filter-flags "-fomit-frame-pointer"
media-libs/libvorbis/libvorbis-1.0-r4.ebuild: # filter march, see bug #26463 for details
media-libs/libvorbis/libvorbis-1.0-r4.ebuild: filter-flags "-march=pentium?"
media-libs/libvorbis/libvorbis-1.0.1-r2.ebuild: is-flag -march=k6-3 && filter-flags -fomit-frame-pointer
media-libs/libvorbis/libvorbis-1.0.1-r2.ebuild: is-flag -march=k6-2 && filter-flags -fomit-frame-pointer
media-libs/libvorbis/libvorbis-1.0.1-r2.ebuild: is-flag -march=k6 && filter-flags -fomit-frame-pointer
media-libs/libvorbis/libvorbis-1.0.1-r2.ebuild: filter-flags -march=pentium?
media-sound/lame/lame-3.96.ebuild: is-flag "-march=k6-3" && filter-flags "-fomit-frame-pointer"
media-sound/lame/lame-3.96.ebuild: is-flag "-march=k6-2" && filter-flags "-fomit-frame-pointer"
media-sound/lame/lame-3.96.ebuild: is-flag "-march=k6" && filter-flags "-fomit-frame-pointer"
media-sound/lame/lame-3.93.1-r1.ebuild: is-flag "-march=k6-3" && filter-flags "-fomit-frame-pointer"
media-sound/lame/lame-3.93.1-r1.ebuild: is-flag "-march=k6-2" && filter-flags "-fomit-frame-pointer"
media-sound/lame/lame-3.93.1-r1.ebuild: is-flag "-march=k6" && filter-flags "-fomit-frame-pointer"
media-sound/yammi/yammi-1.0.ebuild: is-flag "-march=pentium2" && filter-flags "-fomit-frame-pointer"
media-sound/yammi/yammi-0.8.2.ebuild: is-flag "-march=pentium2" && filter-flags "-fomit-frame-pointer"


i dont want to search every time i get some information, i'm lazy ;)
_________________
Encrypt, lock up everything and duct tape the rest
Back to top
View user's profile Send private message
moocha
Watchman
Watchman


Joined: 21 Oct 2003
Posts: 5722

PostPosted: Sat May 22, 2004 1:55 am    Post subject: Re: Optimization settings Reply with quote

GentooBox wrote:
well, there is no such ebuild ;)
only libvorbis, and that was because of a bug and that bug is fixed in -r2
EDIT: and crack-attack, but what the heck.

Hm... Can't hurt though, one never knows. Paranoia == good :)

GentooBox wrote:
i dont want to search every time i get some information, i'm lazy ;)


Got me on that one - can't dispute it :D
_________________
Military Commissions Act of 2006: http://tinyurl.com/jrcto

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin
Back to top
View user's profile Send private message
GentooBox
Veteran
Veteran


Joined: 22 Jun 2003
Posts: 1168
Location: Denmark

PostPosted: Sat May 22, 2004 2:01 am    Post subject: Re: Optimization settings Reply with quote

moocha wrote:
Hm... Can't hurt though, one never knows. Paranoia == good :)


thats right.

oh, by the way: i switched to GCC-3.4 and my system feels much faster than with GCC-3.3

CFLAGS="-march=athlon64 -O2 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -mmmx -msse -msse2 -m3dnow -fweb -pipe"

i'll keep in mmx, sse, sse2 and 3dnow just to be sure.
i know i have a athlon64, so the switch to GCC 3.4 gave me a big boost, but i have a Athlon-xp on my server, and its also faster with GCC-3.4 (it feels faster.)
_________________
Encrypt, lock up everything and duct tape the rest
Back to top
View user's profile Send private message
moocha
Watchman
Watchman


Joined: 21 Oct 2003
Posts: 5722

PostPosted: Sat May 22, 2004 11:27 pm    Post subject: Re: Optimization settings Reply with quote

Just confirmed that -fpeel-loops is useless. It's only enabled when doing a profiling compilation, and portage can't do that (yet :D).
Ah well, there goes another one. Shortening CFLAGS is fun.
On a positive note, I ran some tests - and, surprisingly, -ffast-math actually reduces the number of goofs GCC produces, when compiling at any optimization level (provided that one does specify -march so that the internal libgcc routines are used). Without any optimization, GCC-produced code doesn't exhibit any floating point errors. With any optimization turned on, it goofs once in a while (nothing to worry about though, today's floating point algorithms are quite error-tolerant) - and -ffast-math actually causes less serious faults than the default (no -ffast-math). So the conclusion is that one should use -ffast-math and -march= when one uses -O{1,2,3,s}.
_________________
Military Commissions Act of 2006: http://tinyurl.com/jrcto

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin
Back to top
View user's profile Send private message
dhurt
Apprentice
Apprentice


Joined: 14 May 2003
Posts: 278
Location: Davis, CA

PostPosted: Mon May 31, 2004 5:47 pm    Post subject: Reply with quote

Thanks for the update and explanation moocha :D
_________________
"And isn't sanity really just a one-trick pony, anyway? I mean, all you get is one trick, rational thinking, but when you're good and crazy, ooh ooh ooh, the sky's the limit!" -- The Tick
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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