View previous topic :: View next topic |
Author |
Message |
genfool n00b
Joined: 20 Jul 2004 Posts: 24
|
Posted: Wed Jul 21, 2004 3:12 pm Post subject: P4 2.8 HT Optimizations |
|
|
I'm starting a new, clean install; I want to get it right. But I have a question. What optimizations can I make inside the make.conf?
Right now it's at:
CFLAGS="-O3 -mcpu=i686 -fomit-frame-pointer"
CHOST="i386-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
What can I do to optimize this as much as possible? I also don't know what the deal is with the sub architectures. I know my CPU is under x86, but I don't know what sub arch it's under. I want to optomize as much as possible, even if I don't really know what they mean just as long as they work well. BTW I read that -O2 or something already enable -fomit-frame-pointer, so why is -fomit-frame-pointer paired up with it? Isn't that repetetive?
edit: I printed out the book so that I don't hurt myself (104pp gg). |
|
Back to top |
|
|
GentooBox Veteran
Joined: 22 Jun 2003 Posts: 1168 Location: Denmark
|
Posted: Wed Jul 21, 2004 3:23 pm Post subject: |
|
|
is it a stage1 ?
you should go with this if its a stage1:
Quote: | CFLAGS="-O2 -march=pentium4 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}" |
As far as i know, -O2 dont have -fomit-frame-pointer as default. _________________ Encrypt, lock up everything and duct tape the rest |
|
Back to top |
|
|
genfool n00b
Joined: 20 Jul 2004 Posts: 24
|
Posted: Wed Jul 21, 2004 3:38 pm Post subject: |
|
|
It's stage 1. I read in some GCC manual that -O enables -fomit-frame-pointer, -O2 does what -O does, but with more optimizations, and -O3 has even more optimizations.
From GNU
"-O turns on the following optimization flags:
-fdefer-pop
-fmerge-constants
-fthread-jumps
-floop-optimize
-fif-conversion
-fif-conversion2
-fdelayed-branch
-fguess-branch-probability
-fcprop-registers
-O also turns on -fomit-frame-pointer on machines where doing so does not interfere with debugging."
Why shouldn't I use -O3? I'm not trying to go against your word, but I'm just curious why I should use -O2 instead.
Also, I've been looking for a site that would have information on most, if not all, architectures and sub archs that categorizes the processors.
I have HT technology, so should I have chosen smp kernel at boot, or was the default gentoo kernel fine? Is this kernel just the temporary kernel to run the installation, and the one I compile later is the permanent?
All help appreciated. Thanks. |
|
Back to top |
|
|
Esben Apprentice
Joined: 29 Jun 2002 Posts: 244 Location: Copenhagen/Denmark
|
Posted: Wed Jul 21, 2004 3:57 pm Post subject: |
|
|
-O3 is not neccessarily faster than -O2; and some swear by -Os. -O2 is a safe maiddle road. Besides, sometimes things break at -O3, while the others are relative safe.
I would also add . Might as well use that hyperthreading for compilation... _________________ regards, Esben
True trade is honest, but not merciful. Politics is dishonest, no matter how merciful... and war is neither honest nor merciful.... therefore, choose trade above politics, but politics above war. |
|
Back to top |
|
|
GentooBox Veteran
Joined: 22 Jun 2003 Posts: 1168 Location: Denmark
|
Posted: Wed Jul 21, 2004 4:00 pm Post subject: |
|
|
genfool wrote: | It's stage 1. I read in some GCC manual that -O enables -fomit-frame-pointer, -O2 does what -O does, but with more optimizations, and -O3 has even more optimizations.
From GNU
"-O turns on the following optimization flags:
-fdefer-pop
-fmerge-constants
-fthread-jumps
-floop-optimize
-fif-conversion
-fif-conversion2
-fdelayed-branch
-fguess-branch-probability
-fcprop-registers
-O also turns on -fomit-frame-pointer on machines where doing so does not interfere with debugging."
Why shouldn't I use -O3? I'm not trying to go against your word, but I'm just curious why I should use -O2 instead.
Also, I've been looking for a site that would have information on most, if not all, architectures and sub archs that categorizes the processors.
I have HT technology, so should I have chosen smp kernel at boot, or was the default gentoo kernel fine? Is this kernel just the temporary kernel to run the installation, and the one I compile later is the permanent?
All help appreciated. Thanks. |
You are on the right track, but -fomit-frame-pointer is not enabled by default on x86 CPU's. -fomit-frame-pointer makes it hard to debug on x86 CPU's.
-O3 tends to make executeables larger (longer startup) but -O3 may or may not make the exe files faster.
When you put in the Gentoo 2004 bootcd, then you should select a SMP kernel if you have a P4 with HT.
When you compile your own kernel, remember to activate multiprocessing, or else you wont get HT support. _________________ Encrypt, lock up everything and duct tape the rest |
|
Back to top |
|
|
genfool n00b
Joined: 20 Jul 2004 Posts: 24
|
Posted: Wed Jul 21, 2004 4:44 pm Post subject: |
|
|
I'm already booted in the "gentoo" kerenel or default kernel, so should I restart and choose smp kernel? Smp kernel is the kernel I used last time I installed. Hmm... The reason why I chose the gentoo kernel at boot was because it has a higher resolution plus a pretty decent bg, but I can easily restart at this point. Should I? Also, there was the code "mcpu=i686" and I was just wondering what that was for. Do you know any sites that have all those architectures/sub architectures? Thanks for the help so far; I'll probably use -O2.
Oh yeah, I guess I might as well ask this now. Okay, I'm probably just gonna reboot with SMP kernel (does it really make a difference?), but I was wondering how can I make myself a seperate partition for my home folder and then activate it? I have a boot, swap, and root partition right now.
Also.. MAKEOPTS="-j3" enables HT? |
|
Back to top |
|
|
Esben Apprentice
Joined: 29 Jun 2002 Posts: 244 Location: Copenhagen/Denmark
|
Posted: Wed Jul 21, 2004 5:24 pm Post subject: |
|
|
MAKEOPT="-j3" enable make in parallel... which is an advantage if you have a multicore CPU as you do _________________ regards, Esben
True trade is honest, but not merciful. Politics is dishonest, no matter how merciful... and war is neither honest nor merciful.... therefore, choose trade above politics, but politics above war. |
|
Back to top |
|
|
genfool n00b
Joined: 20 Jul 2004 Posts: 24
|
Posted: Wed Jul 21, 2004 5:51 pm Post subject: |
|
|
Alright thanks for all the replies. Well I'm pretty impatient so I decided to boot into SMP kernel since it was no big, and I decided to try and make a /home partition. So now I have 4 partitions total.
/dev/hda1 is boot
/dev/hda2 is swap
/dev/hda3 is root
/dev/hda4 is home (I hope)
I saw that I had to mkdir for my boot and my root ie "mkdir /mnt/gentoo/boot" and then mount it with command "mount /dev/hda1 /mnt/gentoo/boot". So I decided to do that with home (I'm guessing as best as I can.) "mkdir /mnt/gentoo/home && mount /dev/hda4 /mnt/gentoo/home". Did I do it right? And why don't I have to mkdir for /mnt/gentoo?
Just incase you don't see my last post.. What's -mcpu=i686? Should I leave this out? |
|
Back to top |
|
|
Esben Apprentice
Joined: 29 Jun 2002 Posts: 244 Location: Copenhagen/Denmark
|
Posted: Wed Jul 21, 2004 6:55 pm Post subject: |
|
|
The mounting stuff looks fine to me Remember to update the /etc/fstab with the /home partition when the guide tells you too...
-mcpu=i686 was the pre-3.0 cpu-switch, if I recall correctly. It has been supplanted with something like -mcpu=pentium4. Since you're probably not going to change the CPU on your box, you might as well use the -march=pentium4, which will enable the pentium4-specific instruction (-mcpu merely optimizes the instruction layout for a cputype).
If you really want to know more, you really should search. All you ask have been answered countless of times in these forums if you look...there is a lot more there than I can tell you _________________ regards, Esben
True trade is honest, but not merciful. Politics is dishonest, no matter how merciful... and war is neither honest nor merciful.... therefore, choose trade above politics, but politics above war. |
|
Back to top |
|
|
Beelzebubba n00b
Joined: 10 Dec 2003 Posts: 23 Location: Bologna (IT)
|
Posted: Wed Jul 21, 2004 8:53 pm Post subject: |
|
|
I have same processor as you, here is my cflags:
Code: |
CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer"
|
I also use
and here are the results
Code: |
belial root # genlop -t kdelibs gcc kdebase
* kde-base/kdelibs
Wed Jul 14 21:43:05 2004 >>> kde-base/kdelibs-3.2.2-r1
merge time: 51 minutes and 37 seconds.
* sys-devel/gcc
Wed Jul 14 12:08:01 2004 >>> sys-devel/gcc-3.3.3-r6
merge time: 12 minutes and 15 seconds.
* kde-base/kdebase
Wed Jul 14 22:48:44 2004 >>> kde-base/kdebase-3.2.2
merge time: 1 hour, 5 minutes and 39 seconds.
|
|
|
Back to top |
|
|
GentooBox Veteran
Joined: 22 Jun 2003 Posts: 1168 Location: Denmark
|
Posted: Wed Jul 21, 2004 11:49 pm Post subject: |
|
|
genfool wrote: | I'm already booted in the "gentoo" kerenel or default kernel, so should I restart and choose smp kernel? Smp kernel is the kernel I used last time I installed. Hmm... The reason why I chose the gentoo kernel at boot was because it has a higher resolution plus a pretty decent bg, but I can easily restart at this point. Should I? Also, there was the code "mcpu=i686" and I was just wondering what that was for. Do you know any sites that have all those architectures/sub architectures? Thanks for the help so far; I'll probably use -O2.
Oh yeah, I guess I might as well ask this now. Okay, I'm probably just gonna reboot with SMP kernel (does it really make a difference?), but I was wondering how can I make myself a seperate partition for my home folder and then activate it? I have a boot, swap, and root partition right now.
Also.. MAKEOPTS="-j3" enables HT? |
-mcpu=i686 makes code that works on a i686 and lower.
that means that you can make code that works on a Intel Pentium 4 AND a AMD Athlon-xp CPU.
-march=pentium4 makes code that only works on pentium4, so its more optimized and smaller exe.
OT:
Quote: | I also use
Code:
MAKEOPTS="-j4"
and here are the results Wink
Code:
belial root # genlop -t kdelibs gcc kdebase
* kde-base/kdelibs
Wed Jul 14 21:43:05 2004 >>> kde-base/kdelibs-3.2.2-r1
merge time: 51 minutes and 37 seconds.
* sys-devel/gcc
Wed Jul 14 12:08:01 2004 >>> sys-devel/gcc-3.3.3-r6
merge time: 12 minutes and 15 seconds.
* kde-base/kdebase
Wed Jul 14 22:48:44 2004 >>> kde-base/kdebase-3.2.2
merge time: 1 hour, 5 minutes and 39 seconds.
|
Quote: | genlop -t kdebase
* kde-base/kdebase
Sat Jul 3 18:31:58 2004 >>> kde-base/kdebase-3.2.2
merge time: 42 minutes and 47 seconds.
|
Yet another reason to buy a AMD64 cpu.. :p _________________ Encrypt, lock up everything and duct tape the rest |
|
Back to top |
|
|
genfool n00b
Joined: 20 Jul 2004 Posts: 24
|
Posted: Thu Jul 22, 2004 9:02 am Post subject: |
|
|
Nice. Thanks for all your replies. I was wondering what is this acovea that I've been reading about on the forums. It's a benchmark that shows what cflags should be turned on for your system? Do I use "emerge acovea" and it will install just like that, then do I have to config and make? I'm not sure what to do here, and I don't even know what ebuilds are although I'm starting to think they are really important. Sorry for all these questions. I just emerged system and I'm waiting for it to finish... So if I change my cflags, how can I re-optimize my system "emerge system" again? |
|
Back to top |
|
|
GentooBox Veteran
Joined: 22 Jun 2003 Posts: 1168 Location: Denmark
|
Posted: Thu Jul 22, 2004 1:11 pm Post subject: |
|
|
genfool wrote: | Nice. Thanks for all your replies. I was wondering what is this acovea that I've been reading about on the forums. It's a benchmark that shows what cflags should be turned on for your system? Do I use "emerge acovea" and it will install just like that, then do I have to config and make? I'm not sure what to do here, and I don't even know what ebuilds are although I'm starting to think they are really important. Sorry for all these questions. I just emerged system and I'm waiting for it to finish... So if I change my cflags, how can I re-optimize my system "emerge system" again? |
Acoeva is a benchmark tool that compiles diffrent kinds of programs on your computer with a compiler that yuo choose.
If trys to find the CFLAGS that fits your system, and the flags that you would gain som major performance with.
But acoeva is a benchmark tool, and like any other benchmark tool it can only be used for testing. - The CFLAGS it gives you may or may not make your compiled code better.
ebuilds, that is THE main key to Gentoo Linux.
Gentoo Linux has a nice thing called portage, and portage is a collection of ebuilds.
an ebuild is a file that holds information of a program and portage has something near 80000 ebuilds.
EDIT: Portage just reached 90000 ebuilds.
An ebuild is a file that looks like this:
Code: | cat /usr/portage/app-portage/ufed/ufed-0.35.ebuild |
Quote: | # Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-portage/ufed/ufed-0.35.ebuild,v 1.2 2004/06/24 21:51:44 agriffis Exp $
DESCRIPTION="Gentoo Linux USE flags editor"
HOMEPAGE="http://www.gentoo.org/"
SRC_URI="mirror://gentoo/${P}.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~ppc ~sparc ~mips ~alpha ~arm ~hppa ~amd64 ~ia64 ~ppc64"
IUSE=""
RDEPEND="dev-lang/perl
dev-util/dialog
dev-perl/TermReadKey"
DEPEND=""
src_install() {
newsbin ufed.pl ufed || die
doman ufed.8
dodoc ChangeLog
} |
as you can see, the ebuilds name is "ufed-0.35.ebuild" and it contains information like:
what the program can do
The programs homepage
what depencencies the program has
where to download the program
howto configure and compile the program
how to install the compiled program files.
You can use the program "emerge" to read ebuilds.
for an exsample: "emerge ufed"
emerge ufed finds the ebuild called ufed-0.35 and read the information in the ebuild, downloads the program, unpack it, configure it, compile it and install it.
short said: portage makes every gentoo users dream come true
hope you understand what i just wrote
I am very sorry for my bad english. _________________ Encrypt, lock up everything and duct tape the rest |
|
Back to top |
|
|
GentooBox Veteran
Joined: 22 Jun 2003 Posts: 1168 Location: Denmark
|
Posted: Thu Jul 22, 2004 1:15 pm Post subject: |
|
|
oh, and yes, just do "emerge acovea" and emerge will download and install acovea for you. _________________ Encrypt, lock up everything and duct tape the rest |
|
Back to top |
|
|
genfool n00b
Joined: 20 Jul 2004 Posts: 24
|
Posted: Thu Jul 22, 2004 2:50 pm Post subject: |
|
|
Awsome! Yeah, I understood what you said. I was just wondering how I figure out what version of GCC I have. I'm just guessing I have 3.4? Anyways, isn't the "scripts/bootstrap.sh" command the part that builds my compiler? I was going to try and get acovea earlier, but I'm still in the process of installing my gentoo, so I don't know if I have GCC yet, or if I can even use Acovea yet. If at all possible it would be nice if I could update my system with these new cflags after benchmarking. Is it possible? Thanks for all the help; been great.
edit
Okay, I still don't know what GCC version I have, but I was able to find "emerge -e world", so I guess I can just do that once I change my cflags. |
|
Back to top |
|
|
ronnie n00b
Joined: 21 Jul 2004 Posts: 66
|
Posted: Thu Jul 22, 2004 4:25 pm Post subject: |
|
|
You know there is almost always a --help for each program? |
|
Back to top |
|
|
n3mo l33t
Joined: 28 Mar 2004 Posts: 657 Location: In a Cruel World
|
Posted: Thu Jul 22, 2004 4:33 pm Post subject: |
|
|
I think you could also use if you want all optimizations for your processor. |
|
Back to top |
|
|
GentooBox Veteran
Joined: 22 Jun 2003 Posts: 1168 Location: Denmark
|
Posted: Thu Jul 22, 2004 7:17 pm Post subject: |
|
|
n3mo wrote: | I think you could also use if you want all optimizations for your processor. |
What he means is mmx and sse in the CFLAGS.
I dont have a Pentium4, so i dont know if -march=pentium4 have mmx, sse, sse2 as default. (i think it have them as default)
If you want a 100% stable system, then you should not use acovea, but its your choice. new cflags may or may not make your computer unstable.
If you use a stage1, then the scripts/bootstrap.sh is used to build the compiler and some system libs.
If you emerge a program with some new CFLAGS then it will use the new cflags.
for an exsample:
edit /etc/make.conf, set CFLAGS="-march=pentium4 -pipe -O2"
emerge gcc //it will compile GCC with the CFLAGS you just set.
edit /etc/make.conf again and add -fomit-frame-pointer
emerge gcc //now it will use the new CFLAGS you just set. _________________ Encrypt, lock up everything and duct tape the rest |
|
Back to top |
|
|
taskara Advocate
Joined: 10 Apr 2002 Posts: 3763 Location: Australia
|
Posted: Thu Aug 19, 2004 7:30 am Post subject: |
|
|
hey mate,
you probably also want to look at this:
https://forums.gentoo.org/viewtopic.php?t=169054
It is a howto on getting your system happening with 2.6 headers and nptl (native posix threading library).
native posix is the fastest threading library around, and will help your p4 cpu.
You won't be able to test acovea on your pc until you actually have gentoo installed - so do one first.
I'd recommend staying with gcc 3.3.x atm if you want a smooth sailing system - but I personally use gcc 3.4.1.
Some (only a few these days) don't emerge with gcc 3.4
ATM I'd stick with
Code: | -march=pentium4 -O2 -pipe -fomit-frame-pointer |
and get used to gentoo.. then you can do another build later once you're more comfortable and perhaps more daring to try nptl, gcc 3.4 etc..
Esben, you use MAKEOPTS="-j3", but Beelzebubba you use MAKEOPTS="-j4".
What's the difference there?
Also, -march=pentium4 INCLUDES mmx, sse and sse2 options in your CFLAGS.
And incase it's not clear yet, you want an SMP (multicpu kernel) because that is how you get your hyperthreading working.
I'd go with gentoo-dev-sources or mm-sources for your kernel.
have fun _________________ Kororaa install method - have Gentoo up and running quickly and easily, fully automated with an installer! |
|
Back to top |
|
|
Esben Apprentice
Joined: 29 Jun 2002 Posts: 244 Location: Copenhagen/Denmark
|
Posted: Thu Aug 19, 2004 2:40 pm Post subject: |
|
|
taskara wrote: | Esben, you use MAKEOPTS="-j3", but Beelzebubba you use MAKEOPTS="-j4".
What's the difference there? |
The number of 3 is the number of processes make uses. The usual recommendation is (number of CPUes) + 1, which is why I use 3. Some swear by higher number, though. _________________ regards, Esben
True trade is honest, but not merciful. Politics is dishonest, no matter how merciful... and war is neither honest nor merciful.... therefore, choose trade above politics, but politics above war. |
|
Back to top |
|
|
taskara Advocate
Joined: 10 Apr 2002 Posts: 3763 Location: Australia
|
Posted: Thu Aug 19, 2004 10:19 pm Post subject: |
|
|
Ok thanks Esben - I'll have to start using that on my P4 too
What if you have a single cpu? should you use -j2?
Or is it only for "smp"?
cheers _________________ Kororaa install method - have Gentoo up and running quickly and easily, fully automated with an installer! |
|
Back to top |
|
|
Esben Apprentice
Joined: 29 Jun 2002 Posts: 244 Location: Copenhagen/Denmark
|
Posted: Fri Aug 20, 2004 7:50 am Post subject: |
|
|
taskara wrote: | What if you have a single CPU? should you use -j2?
Or is it only for "smp"? |
It might speed things up; but then again it might slow them down. If you think about it, you'll see that it is the classic memory/CPU trade-off. If you run two processes, you have to fit both into RAM, but then you can switch to the other if one is waiting for data (from the disk, presumably).
Personally, I only use -jn for make install, where I often use 3. But then, when developing for KDE, you tend to run make install a lot _________________ regards, Esben
True trade is honest, but not merciful. Politics is dishonest, no matter how merciful... and war is neither honest nor merciful.... therefore, choose trade above politics, but politics above war. |
|
Back to top |
|
|
taskara Advocate
Joined: 10 Apr 2002 Posts: 3763 Location: Australia
|
Posted: Fri Aug 20, 2004 8:01 am Post subject: |
|
|
IC.. cheers _________________ Kororaa install method - have Gentoo up and running quickly and easily, fully automated with an installer! |
|
Back to top |
|
|
|
|
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
|
|