You are not logged in.

#1 2011-11-30 11:27:58

stifler83
Member
Registered: 2011-01-27
Posts: 56

optimization make.conf

Hi guys, I'd like to know if somebody can help me with mine make.conf. in particular I want to know what can I add or remove and why. Features and cflags are the things the most of all I'd like to improve.
I've got an i7 processor.

ACCEPT_KEYWORDS="amd64"
FEATURES="${FEATURES} mini-manifest parallel-fetch userfetch buildpkg candy ccache fixlafiles parallel-install fail-clean getbinpkg news preserve-libs prelink-checksums distcc-pump collision-protect sandbox"

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-mtune=native -march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j5"

EMERGE_DEFAULT_OPTS="--ask --verbose --quiet"
PORTAGE_BINHOST=/usr/portage/packages

CCACHE_SIZE="5G"
CCACHE_DIR="/var/cache/ccache"

USE="acpi alsa /
bash-completion /
cracklib crypt cdr curl /
dvdr /
gnutls /
ithreads ipv6 /
libnotify lm_sensors /
ncurses networkmanager nsplugin /
posix policykit /
samba symlink ssl sse sse2 ssse3 sse3 sse4_1 /
threads /
udev upnp /
vim-syntax /
xinerama /
zsh-completion /
-ppp -qt4 -kde -gnome -gtk -doc -handbook -wicd"

LINGUAS="it"

INPUT_DEVICES="evdev"
VIDEO_CARDS="intel nvidia"

SYNC="git://github.com/funtoo/portage-mini-2010.git rsync://rsync3.fr.gentoo.org/gentoo-portage"
GENTOO_MIRRORS="http://mirror.switch.ch/ftp/mirror/gentoo/ http://gentoo.wheel.sk/ http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/"

APACHE2_MODULES="${APACHE2_MODULES} apache2_modules_auth_digest"

QEMU_SOFTMMU_TARGETS="arm i386 ppc ppc64 x86_64"
QEMU_USER_TARGETS="arm i386 ppc ppc64 x86_64"

ACCEPT_LICENSE="*"

PORTDIR_OVERLAY=/opt/my_overlay/
source /var/lib/layman/make.conf

FETCHCOMMAND="/usr/bin/wget -t 5 --passive-ftp -P \${DISTDIR}/\${FILE} \${URI}"
RESUMECOMMAND="/usr/bin/wget -c -t 5 --passive-ftp -P \${DISTDIR}/\${FILE} \${URI}" 

Thank you guys

Offline

#2 2011-11-30 12:29:21

Judge
Staff
From: Germany, NRW, Heiligenhaus
Registered: 2011-07-03
Posts: 283

Re: optimization make.conf

Without knowing anything about your hardware, noone can answer that.

Offline

#3 2011-11-30 13:25:16

stifler83
Member
Registered: 2011-01-27
Posts: 56

Re: optimization make.conf

HARDWARE:

2nd generation Intel® Core™ i7-2640M processor 2.80 GHz with Turbo Boost 2.0 up to 3.50 GHz
8GB Shared Dual Channel DDR3 1333MHz Memory
Intel® HM67
NVIDIA® GeForce® GT 525M 1GB graphics with Optimus
Elemental Silver Aluminum 15.6" HD (720P) WLED Display with Webcam
High Definition Audio +Waves MaxxAudio® 3
5.1 Surround sound can be supported via HDM
Up to 750GB SATA hard drive (7200RPM)
Slot load 8x DVD+/-RW (reads & writes to CD/DVD) (9.5mm)

Battery
8-Cell Lithium Ion Primary Battery (64WHr, 2.2AHr)
Up to 8 hours, 22 minutes5 of battery life

10/100/1000 Ethernet network standard, opt external USB Modem
Intel® Centrino® Advanced-N 6230 802.11 agn (2x2)
Bluetooth 3.0
Intel® Wireless Display ready

This is the hardware smile

Offline

#4 2011-11-30 16:04:44

Cloud
Member
Registered: 2011-09-20
Posts: 10

Re: optimization make.conf

The -mtune=native is redundant and unnecessary, otherwise you've already reached the maximum amount of safe optimization (see here http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel). Anything more is unsupported and potentially dangerous and in my opinion not worth it due to only negligible speedups and in some cases can even be slower.

Offline

#5 2011-11-30 16:11:56

Judge
Staff
From: Germany, NRW, Heiligenhaus
Registered: 2011-07-03
Posts: 283

Re: optimization make.conf

I agree.

Offline

#6 2011-11-30 16:32:02

jasn
Member
From: Annapolis, MD
Registered: 2011-01-09
Posts: 181

Re: optimization make.conf

Here's the cpu specific part of my make.conf for my i7-2820QM laptop, (CFLAGS chosen from here);

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=corei7-avx -O2 -pipe"
CXXFLAGS="${CFLAGS}"
EMERGE_DEFAULT_OPTS="--jobs=8 --load-average=8 --with-bdeps y"
FEATURES="fixpackages localpatch parallel-fetch parallel-install"
MAKEOPTS="-j9 -l8"

Depending on what version of gcc you're using, you could change your CFLAGS, (btw as pointed out previously, specifying -march=cpu-type implies -mtune=cpu-type, so you don't really need both), but then again as suggested, you can stick with what you have since gcc 4.2 introduced the -march=native option, which automatically detects CPU features and sets the options appropriately, (source). Also you can consider changing your MAKEOPTS, and related, numbers. A good howto on the subject is here.

Good Luck..

Last edited by jasn (2011-12-01 15:33:48)

Offline

#7 2011-11-30 16:39:58

overkill
Member
Registered: 2011-09-13
Posts: 243

Re: optimization make.conf

ACCEPT_KEYWORDS="amd64"

So you are using "stable"?  Did you unmask the new toolchain? If you did not and you are still using gcc-4.4.5, then -march=native might not support your cpu.  I thought I read somewhere that gcc-4.4* for intel's i* series needs -march=core2,  -mnoavx, and -mtune=generic or something like that.  If you are using gcc-4.6* then -march=native should be fine.  You can check what -march=native outputs with:

echo "" | gcc -march=native -v -E - 2>&1 | grep cc1

Offline

#8 2011-12-07 18:13:27

stifler83
Member
Registered: 2011-01-27
Posts: 56

Re: optimization make.conf

Thank you everybody for your support. I'm trying to optimize the system with what you said to me.

Offline

#9 2011-12-07 20:44:24

whiteghost
Member
From: north dakota
Registered: 2010-10-10
Posts: 155

Re: optimization make.conf

Offline

#10 2012-02-29 11:32:41

jtshs256
New member
Registered: 2011-08-13
Posts: 2

Re: optimization make.conf

Maybe you can recomplie gcc with "graphite" USE enabled and then add "-floop-interchange -floop-strip-mine -floop-block" to your CFLAGS.
It's quite stable on my gentoo box with gcc-4.5.3-r2.

Offline

#11 2012-03-09 04:22:33

PaddyMac
Member
From: Alabama, USA
Registered: 2011-08-20
Posts: 128

Re: optimization make.conf

I've been playing with different CFLAGS a lot lately myself. My current CFLAGS are set up like this:

AGGRESSIVE="-fgcse-after-reload -finline-functions -fpredictive-commoning -fstack-protector -ftree-vectorize"
AGGRESSIVE2="-fselective-scheduling -fselective-scheduling2 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops"
GRAPHITE="-fgraphite-identity -floop-block -floop-interchange -floop-strip-mine -ftree-loop-distribution"
CFLAGS="-O2 -march=athlon-xp -pipe ${GRAPHITE} ${AGGRESSIVE} ${AGGRESSIVE2}"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2"

Having it set up like this makes it easier to read and easier to add/subtract flags. For example if I have a compile failure I comment out anything other than "-O2 -march=athlon-xp -pipe" to test it without the flags. Though notably the only flag I've ever been able to pin any problems on is -flto. -flto may be good for some programs, but it still isn't reliable enough to enable all the time.

One flag you may want to play with is -fprofile-use but I don't think this is something you necessarily want to enable all the time. It makes compile time significantly longer, and I'm not convinced that it has all the bugs worked out. But supposedly it can result in significantly faster binaries.

The flags I'm mostly toying with are the ones that optimize scheduling. There's actually quite a few of them. But instead of me rambling on and on, go to http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html and you can read about the various flags. If nothing else, I do agree that you should at least try enabling graphite.

Last edited by PaddyMac (2012-03-12 16:11:21)

Offline

#12 2012-03-12 14:25:35

jasn
Member
From: Annapolis, MD
Registered: 2011-01-09
Posts: 181

Re: optimization make.conf

Thanks for the CFLAGS tips. I've incorporated all of them into my /etc/make.conf exactly as you outlined and I agree, it's an elegant way to do this. (BTW, I believe that you have a typo in your post. I think that the line beginning with AGRESSIVE2=[...], should actually be AGGRESSIVE2=[...])

Then for the heck of it, I re-emerged everything on my laptop Funtoo/x86_64/Gnome 3.x system, (emerge info here, and here's my emptytree world list). Anyway, It took me 9 hours and 20 minutes for my system to go through the entire set of 1717 packages, and by using the --keep-going setting for emerge, only 9 packages didn't emerge cleanly at first. They were;

dev-lang/tcl-8.5.11
app-arch/arj-3.10.22-r3
dev-scheme/guile-1.8.8-r1
dev-libs/poco-1.4.2_p1
sys-libs/glibc-2.13-r4
dev-python/pygame-1.9.2_pre20120101
media-gfx/imagemagick-6.7.5.3-r1
dev-lang/ruby-1.9.3_p125
dev-java/icedtea-7.2.1

I then re-emerged those specific packages directly, without making any changes to my new CFLAGS, and the following three, emerged successfully;

app-arch/arj-3.10.22-r3
dev-libs/poco-1.4.2_p1
dev-lang/ruby-1.9.3_p125

I then commented out the AGGRESSIVE2 settings in my /etc/make.conf and the following two, emerged successfully;

dev-python/pygame-1.9.2_pre20120101
media-gfx/imagemagick-6.7.5.3-r1

I then commented out both the AGGRESSIVE and the AGGRESSIVE2 settings in my /etc/make.conf and the following two, emerged successfully;

dev-scheme/guile-1.8.8-r1
sys-libs/glibc-2.13-r4

Finally the last two packages emerged successfully by commenting out AGGRESSIVE, AGGRESSIVE2, and GRAPHITE in my /etc/make.conf;

dev-lang/tcl-8.5.11
dev-java/icedtea-7.2.1

Thanks again!

Jason

Last edited by jasn (2012-03-12 14:26:43)

Offline

#13 2012-03-12 16:01:21

PaddyMac
Member
From: Alabama, USA
Registered: 2011-08-20
Posts: 128

Re: optimization make.conf

So can you tell any significant performance difference? And by the way, thanks for pointing out the typo!

Last edited by PaddyMac (2012-03-12 16:02:01)

Offline

#14 2012-03-12 16:31:20

jasn
Member
From: Annapolis, MD
Registered: 2011-01-09
Posts: 181

Re: optimization make.conf

Well that's the weird part. My system feels more responsive, but I'm always reticent to say something like that because of re-emerging my whole system may have fixed something that I wasn't aware of. For example I use the live ebuilds for my xf86-video-ati, libdrm, and mesa components, so who knows what gets picked up when re-emerging those. Anyway, I think that it was an improvement, and it's always fun to tinker around like this.

Thanks again..

Last edited by jasn (2012-03-12 16:31:51)

Offline

#15 2012-03-13 04:25:12

jtshs256
New member
Registered: 2011-08-13
Posts: 2

Re: optimization make.conf

So has anyone tried to compile the whole @world with clang/dragonegg yet?

Offline

#16 2012-03-14 03:40:06

PaddyMac
Member
From: Alabama, USA
Registered: 2011-08-20
Posts: 128

Re: optimization make.conf

Cndy has a thread about LLVM/Clang: http://forums.funtoo.org/viewtopic.php?id=1166

Something I've been reading about this evening is the Gold linker. It's something you already have installed on your system if you have a recent binutils version, and you probably didn't even know it. It has a few additional features. You can use 'binutils-config' to enable it as your default linker. One of the features, Identical Code Folding, according to tests can reduce generated code size by an average of 7% (at least with large binaries): http://www.gccsummit.org/2010/view_abst … ent_key=18

I've enabled Gold and have added these linker flags "-Wl,--detect-odr-violations -Wl,--map-whole-files -Wl,--preread-archive-symbols -Wl,--icf=safe -Wl,--threads". I'll let you know if anything blows up.

<sigh> I didn't want to do it, but I think somewhere along the way I became a ricer. LOL

Last edited by PaddyMac (2012-03-14 03:42:36)

Offline

#17 2012-03-24 17:11:02

jasn
Member
From: Annapolis, MD
Registered: 2011-01-09
Posts: 181

Re: optimization make.conf

Just as a followup, I used the instructions here to setup per package CFLAGs, with one exception to the instructions. Instead of steps 2 and 3 there;

2) Create /etc/portage/env/<pkg_cat>/
3) Link /etc/portage/env/<pkg_cat>/<pkg_name_withoutversion> to the custom CFLAGS file

I add the <package_category>/<package_name> to my /etc/portage/package.env file along with the custom cflag configuration file that I created in /etc/portage/env/. That method is described in the Funtoo Clang wiki page here.

Now I can emerge my world without stopping to edit my /etc/make.conf.

Last edited by jasn (2012-05-19 01:01:41)

Offline

#18 2012-05-18 22:49:33

goro
Member
Registered: 2012-05-08
Posts: 50

Re: optimization make.conf

stifler83 wrote:

CCACHE_SIZE="5G"

http://blog.flameeyes.eu/2010/07/debunk … yths-redux

It seems like our own (Gentoo’s) documentation is still reporting that using ccache makes build “10 to 5 times faster”. I’ll call this statement for what it is: bullshit

Offline

Board footer

Powered by FluxBB