Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
CFLAGS (Gentoo wiki) make.conf
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
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Sat Oct 10, 2015 8:30 am    Post subject: CFLAGS (Gentoo wiki) make.conf Reply with quote

I want to ask about the march settings in make.conf

https://wiki.gentoo.org/wiki/Safe_CFLAGS

Quote:
Ivy Bridge
Core i3/i5/i7 & Xeon E3/E5/E7 *V1

vendor_id : GenuineIntel
cpu family : 6
model : 58
model name : Intel(R) Core(TM) i7-3610QM CPU @ 2.30GHz

FILE /etc/portage/make.conf

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=core-avx-i -O2 -pipe"
CXXFLAGS="${CFLAGS}"


Just by chance I have exactly this
Code:
cat /proc/cpuinfo |grep 3610
model name   : Intel(R) Core(TM) i7-3610QM CPU @ 2.30GHz


On the other topic i saw this:

Code:
roman@ASUS-G75VW ~ $ gcc -march=native -E -v - </dev/null 2>&1 | grep cc1
 /usr/libexec/gcc/x86_64-pc-linux-gnu/5.2.0/cc1 -E -quiet -v - -march=ivybridge -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mno-movbe -maes -mno-sha -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-clwb -mno-pcommit -mno-mwaitx --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=ivybridge -fstack-protector-strong


March native on gentoo's gcc 5.2 slot tells me to use ivybridge.

https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html

Code:
‘ivybridge’
    Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C instruction set support.


Here is my make.conf


Code:
cat /etc/make.conf
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=core-avx-i -Os -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"


ACCEPT_KEYWORDS="~amd64"
GENTOO_MIRRORS="http://gentoo.inode.at/ http://ftp.first-world.info/ http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo ftp://mirror.netcologne.de/gentoo/  ftp://ftp.vectranet.pl/gentoo/ http://distfiles.gentoo.org/   ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo ftp://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp:///ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://distro.ibiblio.org/pub/Linux/distributions/gentoo/ http://distro.ibiblio.org/pub/Linux/distributions/gentoo/ ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo http://csociety-ftp.ecn.purdue.edu/pub/gentoo/ ftp://csociety-ftp.ecn.purdue.edu/pub/gentoo/ ftp://ftp.ussg.iu.edu/pub/linux/gentoo ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/ ftp://ftp.join.uni-muenster.de/pub/linux/distributions/gentoo ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp:///ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://ftp.gentoo.mesh-solutions.com/gentoo/ http://mirror.switch.ch/mirror/gentoo/ ftp://mirror.switch.ch/mirror/gentoo/ ftp://ftp.solnet.ch/mirror/Gentoo"
MAKEOPTS="-j9"

USE="64bit 7zip S3TC X509 aacplus aimodules aio amr amrnb amrwb ao apm apng
     archive ares aspell assistant atmo audacious audiofile automount
     autotrace avx bash-completion battstat bidi binfilter bittorrent bl
     blender-game boo btrfs caja cdda cddax cddb cdio cdparanoia cdr cdrom chm
     cilk clucene clutter clvm consolekit context contrast coverage
     cpufreq_bench cpuload cryptsetup ctypes-python curl custom-optimization
     declarative device-mapper devil dga dhcpcd dia dirac directfb djvu dmraid
     dns dos dv edd emf emovix enca epiphany equalizer evdev ewf exif expat
     f2fs faac faad fat fbcon ffmpeg fftw fits flash flickr flite floppy
     fluidsynth fontconfig fpx ftp fts3 g3dvl gadu gcj gconf gcrypt gd
     gdk-pixbuf gdm ggi gimp git gjs glade glut gmp gmplayer gnutls gold gost
     gpg graphite graphviz grilo groovy groupwise gs gsm gtk3 gucharmap guile
     gzip-el hddtemp hdri hfs hotpixels http icu id3 id3tag idn imagemagick
     imlib imlib2 inkjar inotify introspection ipp irrlicht jabber jack java
     javascript jbig jfs jit joystick jpeg2k justify krb4 ladspa lame lapack
     lasi lcdfilter lcms lensfun libass libev libevent libffi libkms libnl
     libproxy libsamplerate libssh2 libsysfs libv4l libv4l2 libvisual live lqr
     lua lvm lvm2 lxde lximage lzma lzo mapimg matroska md5sum md5sum-external
     mdadm mdev meanwhile mercurial midi mikmod minimal minizip mjpeg mms mmx
     mmxext mng mod modplug mono moonlight motif mpd mpeg2 mpeg3 mpfi mplayer
     mtp multicore multimedia musepack mxit mysql nas nautilus ncat networking
     nntp nping nsplugin ntfs ntfsdecrypt ntfsprogs nut nuv nvcontrol nvidia
     ogre ois openal opencore-amr openexr openrc openssl optimisememory
     optimized-qmake opus orbit osc osmesa oss pango pdfimport perl pipelight
     plotutils pnm postproc postscript pptx prediction pulseaudio pvr python
     qt-dbus quicktime radio rar raw rdoc realtime redland reiser4 reiserfs
     resolvconf rle rrdcgi rtmp rtsp sasl schroedinger script sdl-image sdlgfx
     secure-delete sensors sftp sha1 shine shout silc sip skype smi smp smpeg
     snappy sndfile sound soundex soundtouch sox speex spoof-source sql
     sse2_4way sse2check sse3 sse4 sse4_1 ssse3 staging startup-notification
     stream subversion sync-plugin-portage sysstat system-jsoncpp
     system-sqlite systemtap taglib templates theora threads tinfo tonal
     toolkit-scroll-bars twolame unlock-notify upcall uvm v4l v4l2 vaapi vamp
     vcd vcdinfo vcdx vdpau vhook vlc vlm vpx wacom wav wavpack weather-metar
     weather-xoap webp websockets wifi wikipedia winbind wireshark wma
     wma-fixed wmf x265 xanim xattr xcb xcomposite xfs xft xinerama
     xmlpatterns xmp xosd xpm xps xpsmall xscreensaver xvfb yuv4mpeg yv12
     zephyr zsh-completion zvbi -32bit -Xaw3d -aalib -acl -adns -avahi -bazaar
     -beagle -bloodsuckermaps -bluetooth -bonjour -branding -brasero -bugzilla
     -clamav -clamd -clamdtop -clang -colord -cuda -dane -dc1394 -deblob
     -dhclient -dmx -dso -dvb -dvi -eds -eigen -extra -extras -frei0r -fribidi
     -gdu -geoip -geoloc -ggz -glamor -gles -gles1 -gles2 -glew -glitz -gltf
     -gnome-online-accounts -gnutella -graph -gstreamer -gtkstyle -handbook
     -harfbuzz -iceweasel -ieee1394 -ithreads -kate -kde -latex -ldap -libav
     -libcaca -libnotify -libtiger -lm_sensors -lvm1 -metalink -modpack
     -mozsha1 -mpi -music -musicbrainz -ndiff -nettle -new-login -nls -ntlm
     -nvtt -odalaunch -odbc -odk -opencl -opensslcrypt -openvg -phonon -pidgin
     -pkcs11 -portaudio -qt5 -quvi -r600-llvm-compiler -rubberband -ruby
     -semantic-desktop -sendto -skins -slang -socialweb -speech -spell -sqlite
     -system-binutils -systemd -tcl -tk -tracker -udis86 -vala -wxwidgets
     -wxwindows -xine -xnest -xvmc -zemberek"


#PORTAGE_NICENESS=14

FETCHCOMMAND_RSYNC="rsync -avP \"\${URI}\" \"\${DISTDIR}/\${FILE}\""
RESUMECOMMAND_RSYNC="rsync -avP \"\${URI}\" \"\${DISTDIR}/\${FILE}\""
FEATURES="parallel-fetch  userfetch"
VIDEO_CARDS="nvidia"
ALSA_CARDS="hda-intel"
ACCEPT_LICENSE="*"
LINGUAS="en"
LANG="en"
INPUT_DEVICES="evdev synaptics keyboard mouse wacom joystick"
PORTAGE_ELOG_SYSTEM="save"
PORTAGE_ELOG_CLASSES="warn info error log"

#DISTDIR="/mnt/sdb2/usr/portage/distfiles"

DISTDIR="/Distfiles_delete_me/distfiles/"


PORTDIR="/usr/portage"

PYTHON_TARGETS="python2_7 python3_4"
PYTHON_SINGLE_TARGET="python3_4"
ABI_X86="32 64"


RUBY_TARGETS="ruby22 ruby21"

#needed for ASUS_G75VW, because it has uefi bios
GRUB_PLATFORMS="efi-64"


---

I think that the gentoo wiki should be corrected to march=ivybridge.

After I finished the first rebuilding emerge -e system from (t9500 march-native) I will switch back to march-native.

Any hints for my make.conf? Suggestions?

Quote:
#DISTDIR="/mnt/sdb2/usr/portage/distfiles"

DISTDIR="/Distfiles_delete_me/distfiles/"


The distdir folder will be moved when i freed another hdd and put that disc in the box.

I think about going back to a single python profile like 2.7 or 3.4 and also single ruby profile like ruby 21 or 22. My main motivation is to squeeze down packages.

I removed the lddflags from my make.conf (i needed those on t9500 but i doubt i need that on this box)

..
Back to top
View user's profile Send private message
Keruskerfuerst
Advocate
Advocate


Joined: 01 Feb 2006
Posts: 2288
Location: near Augsburg, Germany

PostPosted: Sun Oct 11, 2015 6:38 am    Post subject: Reply with quote

Change the setting of your cflags from -Os to -O2.

Runs much faster.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Sun Oct 11, 2015 12:35 pm    Post subject: Reply with quote

Well

Code:
cat /etc/make.conf
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"
...


The first run had the other stuff and Os. I read a bit and 03 and Ofast seems like playing with fire. Too much hassle with less benefit.
So I am back to my old settings which i used for years since Turion MT-32(-O2 -pipe -fomit-frame-pointer).
No idea why no one suggests fomit-frame-pointer anymore. When you get crashes you need to rebuild that piece of software anyway to get crash dumps which makes sense. And sometimes rebuilding fix the crashing anyway.

Intel suggests fun-roll loops but i had much troubles in the past on t9500.

I do not get the point of gentoo wiki suggesting other stuff as march native. I moved my installation from my old box. (With encryption, with march native for t9500 (because intel cpus are down compatible usually)). Only the boot process was a pain because of gpt / uefi making fuss.

Gentoo seems to have stabilized 4.9 branch finally. i used that for ages. now i am on 5.2 and those packages which fails are just build with a slot version lower as 5.2.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Sun Oct 11, 2015 1:30 pm    Post subject: Reply with quote

tw04l124 wrote:
I do not get the point of gentoo wiki suggesting other stuff as march native.

You must not use -march=native, if you compile for anoter processor; for instance, if you use distcc.
Back to top
View user's profile Send private message
lost+found
Guru
Guru


Joined: 15 Nov 2004
Posts: 508
Location: North~Sea~Coa~s~~t~~~

PostPosted: Sun Oct 11, 2015 1:38 pm    Post subject: Reply with quote

tw04l124 wrote:
...
No idea why no one suggests fomit-frame-pointer anymore. ...
Starting with GCC 4.6, it's not needed to enable it explicitly, unless -Os is used on x86 instead of the other -O options. - wiki

You're right about the 'Safe CFLAGS' wiki needing a rewrite. It's outdated when using GCC 4.9 and newer.
Back to top
View user's profile Send private message
Keruskerfuerst
Advocate
Advocate


Joined: 01 Feb 2006
Posts: 2288
Location: near Augsburg, Germany

PostPosted: Sun Oct 11, 2015 5:28 pm    Post subject: Reply with quote

You should set Makeopts="-j8"
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Sun Oct 11, 2015 10:12 pm    Post subject: Reply with quote

mv wrote:
tw04l124 wrote:
I do not get the point of gentoo wiki suggesting other stuff as march native.

You must not use -march=native, if you compile for anoter processor; for instance, if you use distcc.


If your gcc do support -march=native, you have no need for any wiki to tell you the value, just a wiki to tell you how to show what values your gcc is using when you are using native.
So i think the wiki is giving away the values for people with a gcc without native, else it is just to wank and it would be better to teach people howto fish then.

For the same reason, someone giving away -march=native on a cpu may differ from what your gcc version is giving, because -march=native output depends on the gcc version in use.
So, there's no mistake if the wiki tells to use -march=core-avx-i with a gcc that doesn't support -march=ivybridge.
I don't know what gcc version was use to get the value in the wiki, that should be something wrote, but hey, it's wiki!
Back to top
View user's profile Send private message
alinefr
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jul 2009
Posts: 112
Location: São Paulo, Brasil

PostPosted: Sun Oct 11, 2015 11:45 pm    Post subject: Reply with quote

Is there any advantage using a specific arch type over native for -march if I reproduce the same flags in the specific as -march=native will produce?
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Mon Oct 12, 2015 12:23 am    Post subject: Reply with quote

alinefr wrote:
Is there any advantage using a specific arch type over native for -march if I reproduce the same flags in the specific as -march=native will produce?

0.

It's even worst, when you set your values over native, any new values in your newer gcc version won't be use.
Take a stupid new arch "corei9", with gcc v4 you may get -march=native == -march=corei7
and once you fix that to -march=corei7 it will stay as-is, even when a new gcc v8 now handle -march=corei9 ; but it won't build for -march=corei9 as you don't use native but corei7.
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2152
Location: Berlin, Germany

PostPosted: Mon Oct 12, 2015 12:45 am    Post subject: Reply with quote

-march=core-avx-i is still supported by current gcc, even though the man page no longer advertises it.

Don't forget that -march implies -mtune which can also have an effect on performance, sometimes even bigger than due to the instruction set differences.
Back to top
View user's profile Send private message
alinefr
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jul 2009
Posts: 112
Location: São Paulo, Brasil

PostPosted: Mon Oct 12, 2015 12:55 am    Post subject: Reply with quote

krinn wrote:
alinefr wrote:
Is there any advantage using a specific arch type over native for -march if I reproduce the same flags in the specific as -march=native will produce?

0.

It's even worst, when you set your values over native, any new values in your newer gcc version won't be use.
Take a stupid new arch "corei9", with gcc v4 you may get -march=native == -march=corei7
and once you fix that to -march=corei7 it will stay as-is, even when a new gcc v8 now handle -march=corei9 ; but it won't build for -march=corei9 as you don't use native but corei7.


Sure, it makes sense. Thanks!
Back to top
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 630

PostPosted: Mon Oct 12, 2015 2:09 am    Post subject: Reply with quote

Just thought I would reiterate what mv said, if you use distcc, you don't want -native, you should explicitly set -march, otherwise you get native of the helper box and bad things can happen if they are different.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Mon Oct 12, 2015 4:39 am    Post subject: Reply with quote

chithanh wrote:
-march=core-avx-i is still supported by current gcc, even though the man page no longer advertises it.

Don't forget that -march implies -mtune which can also have an effect on performance, sometimes even bigger than due to the instruction set differences.


Thanks.

Well gcc vs intel. Sometimes the processors logic knows it better because of its logic. Some article claims this with unroling those loops, => fun-roll-loop instruction. which makes sense, when the intel logic can guess the next instruction and hits the cache more often.
Regarding performance. I hardly got any benefit with changed flags for a turion-mt 32 or penryn t9500 in the days i expierenced with gcc (was years back but still the case) And the gentoo wiki cflags page => discussion, has an intel page which claims that code is faster, i do not trust that intel page at all. It heavily depends if the programmer did a proper job first, if he coded proper for the hardware or just coded.
I am still wondering if Ofast or O3 will benefit in my case ...

@krinn

Thanks

--

I am back to march native with CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"

I am not that fussed about those flags. also so many ebuilds filter out flags these days (i think even glibc, which is heavily used)
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Mon Oct 12, 2015 7:36 am    Post subject: Reply with quote

krinn wrote:
So i think the wiki is giving away the values for people with a gcc without native, else it is just to wank and it would be better to teach people howto fish then.

The Wiki starts by explaining this. Only the rest is a reference of such results, which can be handy in some cases, too.
Back to top
View user's profile Send private message
Keruskerfuerst
Advocate
Advocate


Joined: 01 Feb 2006
Posts: 2288
Location: near Augsburg, Germany

PostPosted: Mon Oct 12, 2015 7:27 pm    Post subject: Reply with quote

-O2 runs faster than -O3, because -O3 enrolls the loops.

You can add some specific complierflags from the list.

See info gcc.
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