| View previous topic :: View next topic |
| Author |
Message |
discomfitor l33t


Joined: 21 Feb 2003 Posts: 927 Location: None
|
Posted: Tue Jan 20, 2004 11:05 am Post subject: How to (USUALLY) find the best CFLAGS |
|
|
Ever heard of acovea? It's a program that uses "An Evolutionary Analysis of GNU C Optimizations" to find the best C(XX)FLAGS. It is mainly designed for gcc 3.4 right now, but it can be changed to work with 3.3 by removing the 3.4 only options from the config files.
Try it out! _________________ There is no substitute for experience.
Imperfection indicates a lack of effort. |
|
| Back to top |
|
 |
Crimson Rider Guru


Joined: 23 Jun 2003 Posts: 462 Location: Delft, the Netherlands
|
Posted: Tue Jan 20, 2004 2:48 pm Post subject: |
|
|
That sounds awesome.
I just checked it out and it is supra cool. I love GA, I use it for fun and profit myself.
"When the problem is complex I bring out the GA"
Gotta love that. Wonder how usefull it will be in getting the best flags. _________________ Code, justify, code - Pitr Dubovich |
|
| Back to top |
|
 |
discomfitor l33t


Joined: 21 Feb 2003 Posts: 927 Location: None
|
Posted: Tue Jan 20, 2004 5:39 pm Post subject: |
|
|
I've used my results for a while and it does seem to have a large gain in speed. The only problem is that some things don't compile with them because they're too aggressive. That's when I go back to my old hand-picked ones. _________________ There is no substitute for experience.
Imperfection indicates a lack of effort. |
|
| Back to top |
|
 |
Krigare Tux's lil' helper


Joined: 12 Nov 2003 Posts: 92 Location: ::1
|
Posted: Tue Jan 20, 2004 7:57 pm Post subject: excellent |
|
|
This is indeed something everyone wanted to know but couldn't find the answer for.
Great Shot Darckness! _________________ Together we are strong. |
|
| Back to top |
|
 |
discomfitor l33t


Joined: 21 Feb 2003 Posts: 927 Location: None
|
Posted: Tue Jan 20, 2004 8:25 pm Post subject: |
|
|
Let me know if you have trouble configuring it or something. I usually gave it about 50 generations and let it go overnight to make sure it got the most accurate results. Then again, I did it a bunch of times. _________________ There is no substitute for experience.
Imperfection indicates a lack of effort. |
|
| Back to top |
|
 |
TheEternalVortex Apprentice


Joined: 15 Oct 2002 Posts: 207 Location: San Jose, CA
|
Posted: Wed Jan 21, 2004 4:56 am Post subject: |
|
|
Which are the options that one would need to take out to get this to work with gcc 3.3?
BTW, there is an ebuild for acovea, apparently. _________________ -- Andy |
|
| Back to top |
|
 |
d99ma Tux's lil' helper

Joined: 21 Jul 2003 Posts: 148 Location: Lund, Sweden
|
Posted: Wed Jan 21, 2004 10:57 am Post subject: |
|
|
| Sounds good, but an initial look gave me the impression that -Os is not considered? |
|
| Back to top |
|
 |
nephros Advocate


Joined: 07 Feb 2003 Posts: 2139 Location: Graz, Austria (Europe - no kangaroos.)
|
Posted: Wed Jan 21, 2004 11:38 am Post subject: |
|
|
quickly hacked-together ebuild, please test:
EDIT: update: there is a fancier ebuild in the older thread too.
| Code: |
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: $
DESCRIPTION="ACOVEA implements a genetic algorithm to find the \"best\" options for compiling programs with the GNU Compiler Collection (GCC)."
HOMEPAGE="http://www.coyotegulch.com/acovea/"
SRC_URI="http://www.coyotegulch.com/acovea/${P}.tar.bz2"
LICENSE=""
SLOT="0"
KEYWORDS="~x86"
DEPEND=""
RDEPEND=">=sys-devel/gcc-3.4"
S=${WORKDIR}/${P}
MY_EXAMPLES="/usr/share/acovea"
src_compile() {
./build.sh || die
}
src_install() {
insinto ${MY_EXAMPLES}
dodir ${INSDESTTREE}
doins almabench.c fftbench.cpp huffbench.c lpbench.c manbench.c manbench.cpp treebench.c
exeinto /usr/bin
doexe gavg gccacovea
dodoc README LICENSE.SVFL
}
pkg_postinst() {
einfo ""
einfo "example benchmark files have been installed to ${MY_EXAMPLES}"
einfo ""
ewarn "${P} comes with a special license, called the SVFL."
ewarn "It has been copied to /usr/share/doc/${PF}/LICENSE.SVFL"
ewarn "Please read it before using this."
ewarn ""
}
|
_________________ Please put [SOLVED] in your topic if you are a moron.
Last edited by nephros on Fri Jan 23, 2004 11:58 pm; edited 3 times in total |
|
| Back to top |
|
 |
viperlin Veteran

Joined: 15 Apr 2003 Posts: 1319 Location: UK
|
Posted: Wed Jan 21, 2004 11:44 am Post subject: |
|
|
wow this looks nice, maybe it could be used in the automated gentoo install  |
|
| Back to top |
|
 |
discomfitor l33t


Joined: 21 Feb 2003 Posts: 927 Location: None
|
Posted: Wed Jan 21, 2004 3:14 pm Post subject: |
|
|
Probably not fit for automated install since you have to spend some time on it for it to be of any real value.
As for options you need to take out for gcc 3.3, I looked at the config where all the options are listed, then went through the gcc man page and checked for them. If I didn't see one (or didn't want it tested) I removed it.
Currently my CFLAGS (for the apps that compile with them) are:
| Code: | | CFLAGS="-march=pentium4 -O3 -pipe -fPIC -fmove-all-movables -ftracer -fnew-ra -ffinite-math-only -finline-functions -mfpmath=sse -finline-limit=662 -fomit-frame-pointer -momit-leaf-frame-pointer" |
and CXXFLAGS:
| Code: | | CXXFLAGS="-march=pentium4 -O3 -pipe -fPIC -freduce-all-givs -momit-leaf-frame-pointer -mfpmath=sse -finline-limit=625 -finline-functions -ffinite-math-only -fno-trapping-math" |
I'm on a P4 2.5ghz, and I've been using these flags for several months without stability issues. _________________ There is no substitute for experience.
Imperfection indicates a lack of effort. |
|
| Back to top |
|
 |
discomfitor l33t


Joined: 21 Feb 2003 Posts: 927 Location: None
|
Posted: Wed Jan 21, 2004 5:09 pm Post subject: |
|
|
Also, -fnew-ra will cause some compilings to crash. _________________ There is no substitute for experience.
Imperfection indicates a lack of effort. |
|
| Back to top |
|
 |
TheEternalVortex Apprentice


Joined: 15 Oct 2002 Posts: 207 Location: San Jose, CA
|
Posted: Thu Jan 22, 2004 1:37 am Post subject: |
|
|
Could you post your updated config so as to save me the trouble? _________________ -- Andy |
|
| Back to top |
|
 |
MighMoS Guru


Joined: 24 Apr 2003 Posts: 416 Location: @ ~
|
Posted: Thu Jan 22, 2004 2:20 am Post subject: |
|
|
| Darckness wrote: | Probably not fit for automated install since you have to spend some time on it for it to be of any real value.
As for options you need to take out for gcc 3.3, I looked at the config where all the options are listed, then went through the gcc man page and checked for them. If I didn't see one (or didn't want it tested) I removed it.
Currently my CFLAGS (for the apps that compile with them) are:
| Code: | | CFLAGS="-march=pentium4 -O3 -pipe -fPIC -fmove-all-movables -ftracer -fnew-ra -ffinite-math-only -finline-functions -mfpmath=sse -finline-limit=662 -fomit-frame-pointer -momit-leaf-frame-pointer" |
and CXXFLAGS:
| Code: | | CXXFLAGS="-march=pentium4 -O3 -pipe -fPIC -freduce-all-givs -momit-leaf-frame-pointer -mfpmath=sse -finline-limit=625 -finline-functions -ffinite-math-only -fno-trapping-math" |
I'm on a P4 2.5ghz, and I've been using these flags for several months without stability issues. |
Why would you put -fPIC in your CFLAGS? I thought it was just for libraries... |
|
| Back to top |
|
 |
discomfitor l33t


Joined: 21 Feb 2003 Posts: 927 Location: None
|
Posted: Thu Jan 22, 2004 6:07 am Post subject: |
|
|
MighMoS: There's a couple libs that don't put -fPIC in their flags for some reason, and this fixes that problem. Doesn't cause any other issues.
TheEternalVortex: I do not currently have acovea installed, so I can't post my config. Just look for the options you've never seen before. They are likely to not be in 3.3. _________________ There is no substitute for experience.
Imperfection indicates a lack of effort. |
|
| Back to top |
|
 |
masseya Bodhisattva


Joined: 17 Apr 2002 Posts: 2602 Location: Baltimore, MD
|
Posted: Fri Jan 23, 2004 3:54 pm Post subject: |
|
|
Just wanted to point out the older discussion on this topic that nephros brought to my attention.
finding the best optimization flags via genetic algorithm _________________ if i never try anything, i never learn anything..
if i never take a risk, i stay where i am.. |
|
| Back to top |
|
 |
discomfitor l33t


Joined: 21 Feb 2003 Posts: 927 Location: None
|
Posted: Fri Jan 23, 2004 6:56 pm Post subject: |
|
|
Yeah, I saw that, but it was in the wrong forum, so I decided to get something going here in the hopes that more people would see it. _________________ There is no substitute for experience.
Imperfection indicates a lack of effort. |
|
| Back to top |
|
 |
Crimson Rider Guru


Joined: 23 Jun 2003 Posts: 462 Location: Delft, the Netherlands
|
Posted: Fri Jan 23, 2004 11:41 pm Post subject: |
|
|
Hmm, it doesn't seem to have support for Athlon yet. _________________ Code, justify, code - Pitr Dubovich |
|
| Back to top |
|
 |
Krigare Tux's lil' helper


Joined: 12 Nov 2003 Posts: 92 Location: ::1
|
Posted: Sat Jan 24, 2004 10:52 am Post subject: |
|
|
I'm getting really crazy now, i've tried to figure it out how to use this correctly but i've failed all those times. I'm getting COMPILE FAILED errors all over the place, here is an example of those errors:
| Code: | COMPILE FAILED:
gcc -lrt -std=gnu99 -Dacovea_generic -O1 -o ACOVEA57F61D1D -fno-merge-constants -fno-thread-jumps -fno-omit-frame-pointer -fno-guess-branch-probability -fno-delayed-branch -fno-loop-optimize -fno-crossjumping -foptimize-sibling-calls -fcse-follow-jumps -fgcse -fexpensive-optimizations -fstrength-reduce -frerun-cse-after-loop -frerun-loop-opt -fcaller-saves -fstrict-aliasing -freorder-blocks -falign-loops -falign-jumps -funit-at-a-time -frename-registers -fweb -fmove-all-movables -freduce-all-givs -fpeel-loops -ftracer -funswitch-loops -fbranch-target-load-optimize /usr/share/acovea/almabench.c
cc1: unrecognized option `-fno-if-conversion'
cc1: unrecognized option `-fno-if-conversion2'
cc1: unrecognized option `-fno-crossjumping'
cc1: unrecognized option `-fweb' |
The command i've used is
| Code: | | # gccacovea -app /usr/share/acovea/almabench |
My gcc-version
| Code: | * sys-devel/gcc
Latest version available: 3.2.3-r3
Latest version installed: 3.2.3-r3
Size of downloaded files: 20,716 kB
Homepage: http://www.gnu.org/software/gcc/gcc.html
Description: The GNU Compiler Collection. Includes C/C++ and java compilers |
However, at the bottom of this, after it shows me the statistics, i get segfault, this occur at the very end of the termination after all the zeroes i got on the statistics (those after "Option counts:"). I'm using an Intel P4 2ghz.
Greatful for every help i can get. _________________ Together we are strong. |
|
| Back to top |
|
 |
jkalderash Tux's lil' helper


Joined: 07 Jul 2003 Posts: 111
|
Posted: Tue Feb 03, 2004 6:26 am Post subject: |
|
|
| Anyone know what's up with the website for acovea? I haven't been able to access it since I found this thread yesterday... |
|
| Back to top |
|
 |
discomfitor l33t


Joined: 21 Feb 2003 Posts: 927 Location: None
|
Posted: Tue Feb 03, 2004 6:06 pm Post subject: |
|
|
Krigare: those options are not supported by gcc 3.2, you need to edit the config file to remove them _________________ There is no substitute for experience.
Imperfection indicates a lack of effort. |
|
| Back to top |
|
 |
Birnenpfluecker Guru


Joined: 01 Sep 2003 Posts: 315 Location: Lage, Germany
|
Posted: Tue Feb 03, 2004 10:40 pm Post subject: |
|
|
| @ Darckness: The link is down, can you please fix it? |
|
| Back to top |
|
 |
charlieg Advocate


Joined: 30 Jul 2002 Posts: 2149 Location: Manchester UK
|
Posted: Wed Feb 04, 2004 10:35 am Post subject: |
|
|
| Krigare wrote: | | I'm getting really crazy now, i've tried to figure it out how to use this correctly but i've failed all those times. |
I think it's aimed at GCC 3.4 / 3.5 so that might be the reason. _________________ Want Free games?
Free Gamer - open source games list & commentary
Open source web-enabled rich UI platform: Vexi |
|
| Back to top |
|
 |
nevynxxx Veteran

Joined: 12 Nov 2003 Posts: 1123 Location: Manchester - UK
|
Posted: Wed Feb 04, 2004 1:02 pm Post subject: |
|
|
The website is still down, I get "he requested URL /acovea/ was not found on this server." does anyone know of a mirror of the bz2 so I can grab and install it? _________________ My Public Key
Wanted: Instructor in the art of Bowyery |
|
| Back to top |
|
 |
TenPin Guru


Joined: 26 Aug 2002 Posts: 500 Location: Kansas City
|
Posted: Thu Feb 05, 2004 8:50 pm Post subject: |
|
|
| I'd be very interested to know the optimal CFLAGS for compiling mozilla-firebird because I have quite a slow machine and firebird is the only thing that could do to be more snappy. |
|
| Back to top |
|
 |
jrz Apprentice


Joined: 19 Mar 2003 Posts: 272 Location: Sacramento, CA USA
|
Posted: Fri Feb 06, 2004 9:04 am Post subject: |
|
|
for great justice! someone who has the source file plz put it up or send it to someone who can host!
 _________________ Press F1 for Help. |
|
| Back to top |
|
 |
|