Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Settings in make.conf affects compilation only?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
kbzium
Tux's lil' helper
Tux's lil' helper


Joined: 31 Jul 2012
Posts: 146

PostPosted: Wed Jan 02, 2013 8:07 am    Post subject: Settings in make.conf affects compilation only? Reply with quote

Hello,

does settings in make.conf affect compilation only or general speed of applications after it? I mean if for instance sse4 is enabled during compilation, does this software use it later alone?

Here's my config
Code:
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="x86_64-pc-linux-gnu"
# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
USE="-gtk -gnome gt4 kde dvd alsa cdr mmx sse sse2 sse3 ssse3 sse4_1 sse4_2 apache2 scanner"


And this looks quite concerning...!
Code:
kboom@kboom ~ $ gcc '-###' -e -v -march=native /usr/include/stdlib.h
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.4/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.4/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.5.4/work/gcc-4.5.4/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.4 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.4/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.4 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.4/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.4/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.4/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --disable-lto --enable-nls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.5.4/python --enable-checking=release --disable-libgcj --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.5.4 p1.1, pie-0.4.7'
Thread model: posix
gcc version 4.5.4 (Gentoo 4.5.4 p1.1, pie-0.4.7)
COLLECT_GCC_OPTIONS='-e' '-v'
 "/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.4/cc1" "-quiet" "/usr/include/stdlib.h" "-D_FORTIFY_SOURCE=2" "-march=core2" "-mcx16" "-msahf" "-maes" "-mpclmul" "-mpopcnt" "-mavx" "--param" "l1-cache-size=32" "--param" "l1-cache-line-size=64" "--param" "l2-cache-size=8192" "-mtune=generic" "-quiet" "-dumpbase" "stdlib.h" "-auxbase" "stdlib" "-o" "/tmp/cc6L1chH.s" "--output-pch=/usr/include/stdlib.h.gch"


while flags in cpuinfo are
Code:
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl x
topology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts
dtherm tpr_shadow vnmi flexpriority ept vpid


What's more how about:
Code:
USE="-gtk -gnome gt4 kde dvd alsa cdr mmx sse sse2 sse3 ssse3 sse4_1 sse4_2 apache2 scanner"


Maybe this may affect performance of an running application? If so, what should i set there too?

Thank you!
Back to top
View user's profile Send private message
Gentoo64
n00b
n00b


Joined: 21 Oct 2011
Posts: 45
Location: ::

PostPosted: Wed Jan 02, 2013 10:44 am    Post subject: Reply with quote

If your cpu supports for eg sse 4.2, then any program with the USE flag sse4_2 will take advantage of it. A lot of programs have support for things like sse etc by default with no optional use flags. As you have sse 4.2 support on your cpu then sse4_2 USE is right.
The make.conf just includes the compile time stuff which can affect the performance of the program when it's run, so the CFLAGS have an effect, and the USE removes / includes support for certain things. The main thing that would speed up compilation speed on its own is makejobs, which looks like you haven't set. Most people will use a makejobs of the number of your cpu cores, or add 1 on, so if your cpu is quad core try adding the line MAKEJOBS="-j5" to the /etc/portage/make.conf and you should compile much much faster than with default.
Back to top
View user's profile Send private message
kbzium
Tux's lil' helper
Tux's lil' helper


Joined: 31 Jul 2012
Posts: 146

PostPosted: Wed Jan 02, 2013 12:21 pm    Post subject: Reply with quote

Ok so i run into idea to compare:

my cpu spec flags:
Quote:
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl x
topology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid


and those valid to be used in make.conf
Code:
3dfx
3dnow
X
Xaw3d
a52
aac
aalib
accessibility
acl
acpi
adns
afs
aim
alsa
altivec
ao
apache2
apm
aqua
atm
audiofile
ayatana
avahi
bash-completion
bcmath
berkdb
bidi
bindist
blas
bluetooth
bootstrap
boundschecking
branding
bsf
build
bzip2
cairo
calendar
canna
caps
cdb
cdda
cddb
cdinstall
cdparanoia
cdr
cgi
cjk
clamav
coreaudio
cracklib
crypt
cscope
css
ctype
cups
curl
curlwrappers
custom-cflags
cvs
cxx
dbi
dbm
dbus
debug
dedicated
dga
directfb
djvu
doc
dri
dts
dv
dvb
dvd
dvdr
eds
emacs
emboss
encode
enscript
evo
examples
exif
expat
fam
fastcgi
fbcon
ffmpeg
fftw
firebird
flac
flatfile
fltk
fontconfig
foomaticdb
fortran
freetds
freewnn
frontbase
ftp
gcj
gd
gdbm
geoip
ggi
gif
gimp
glut
gmp
gnome
gnome-keyring
gnuplot
gnutls
gphoto2
gpm
gps
graphviz
gsl
gsm
gstreamer
gtk
gtkhtml
guile
gzip
handbook
hardened
hddtemp
hdf5
hscolour
ibm
iconv
icq
icu
idn
ieee1394
imagemagick
imap
imlib
infiniband
inifile
introspection
iodbc
ios
ipod
ipv6
iwmmxt
jabber
jack
java
java6
javascript
jbig
jingle
jit
joystick
jpeg
jpeg2k
kde
kdeprefix
kerberos
kolab
kontact
ladspa
lame
lapack
lash
latex
lcms
ldap
libass
libcaca
libedit
libffi
libnotify
libsamplerate
libwww
lirc
livecd
lm_sensors
lua
lzma
lzo
m17n-lib
mad
maildir
matroska
matrox
mbox
memlimit
mhash
migemo
mikmod
milter
mime
minimal
mmap
mms
mmx
mng
modplug
modules
mono
motif
mozilla
mp3
mp4
mpeg
mpi
mplayer
msn
mssql
mtp
mule
multilib
musepack
musicbrainz
mysql
mysqli
nas
ncurses
neXt
neon
netboot
netcdf
networkmanager
nis
nls
nntp
nocd
nocxx
nptl
nsplugin
ocaml
ocamlopt
oci8
oci8-instant-client
odbc
offensive
ofx
ogg
old-linux
openal
openexr
opengl
openmp
oracle
orc
osc
oscar
oss
pam
pch
pcmcia
pcntl
pcre
pda
pdf
perl
php
plasma
plotutils
png
policykit
portaudio
posix
postgres
postscript
ppds
prefix
prelude
profile
pulseaudio
python
qdbm
qmail-spp
qt4
quicktime
radius
raw
rdesktop
readline
recode
rss
ruby
samba
sasl
savedconfig
scanner
sdl
seamonkey
selinux
semantic-desktop
session
sharedmem
shorten
simplexml
skey
slang
slp
smartcard
smp
sndfile
snmp
soap
sockets
socks5
sound
source
sox
speex
spell
sqlite
sqlite3
sse
sse2
sse3
ssl
startup-notification
static
static-libs
subversion
suid
svg
svga
sybase
sybase-ct
symlink
syslog
systemd
sysvipc
szip
taglib
tcl
tcmalloc
tcpd
test
theora
threads
tidy
tiff
timidity
tk
tokenizer
truetype
uclibc
udev
unicode
upnp
upnp-av
usb
v4l
vanilla
vcd
vdpau
vhosts
videos
vim-syntax
vnc
vorbis
wayland
wavpack
wddx
webkit
wifi
win32codecs
wmf
wxwidgets
x264
xattr
xcb
xcomposite
xemacs
xface
xft
xine
xinerama
xinetd
xml
xmlrpc
xmp
xmpp
xosd
xpm
xscreensaver
xsl
xv
xvid
yahoo
yaz
zeroconf
zlib
zsh-completion


Maybe i should just include those that match?
Back to top
View user's profile Send private message
Gentoo64
n00b
n00b


Joined: 21 Oct 2011
Posts: 45
Location: ::

PostPosted: Wed Jan 02, 2013 6:36 pm    Post subject: Reply with quote

The USE flags are mostly not cpu related but include support for certain features. I remember what I did when I first installed Gentoo was go through the big list of USE flags and add the ones I definately want globally in my make.conf. If you use alsa and want programs to support it just add alsa to your use flags. Do that for any others, same with removing support, ie if you know you're not going to use pulseaudio then put -pulseaudio in there.
Back to top
View user's profile Send private message
kbzium
Tux's lil' helper
Tux's lil' helper


Joined: 31 Jul 2012
Posts: 146

PostPosted: Wed Jan 02, 2013 8:18 pm    Post subject: Reply with quote

I see. Last thing:

Code:
kboom@kboom ~ $ echo "" | gcc -march=native -v -E - 2>&1 | grep cc1
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.4/cc1 -E -quiet -v - -D_FORTIFY_SOURCE=2 -march=core2 -mcx16 -msahf -maes -mpclmul -mpopcnt -mavx --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -mtune=generic


what about cache level 3?! And why is it core2?
Back to top
View user's profile Send private message
toralf
Advocate
Advocate


Joined: 01 Feb 2004
Posts: 2692
Location: Hamburg/Germany

PostPosted: Wed Jan 02, 2013 8:42 pm    Post subject: Reply with quote

kbzium wrote:
And why is it core2?
Because you set "march=native" and therefore the gcc expanded it to your system specific values.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 2287
Location: Canada

PostPosted: Wed Jan 02, 2013 9:02 pm    Post subject: Reply with quote

Gentoo64 wrote:
The USE flags are mostly not cpu related but include support for certain features. I remember what I did when I first installed Gentoo was go through the big list of USE flags and add the ones I definately want globally in my make.conf. If you use alsa and want programs to support it just add alsa to your use flags. Do that for any others, same with removing support, ie if you know you're not going to use pulseaudio then put -pulseaudio in there.


Most of the needed USE flags are set/unset when you choose the appropriate profile, and need not be explicitly played with manually.
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Wed Jan 02, 2013 9:29 pm    Post subject: Reply with quote

"-march=native" in CFLAGS will override things like USE="sse4_2" at compile
time. If gcc has a use for sse4_2 instructions in the code it compiles, with
"-march=native" it will check the cpu itself to see if that cpu architecture
supports the sse4_2 instructions. That goes for sets of instructions supported
by some x86 or x86_64 cpus but not others.

The USE flag will mainly affect packages like openssl, multimedia stuff,
graphics code, compression/decompression, encryption/decryption, etc,
where some package has assembler level support for those specialized
instructions that is enabled or disabled at compile time with a GNU configure
command line option (or some alternative for build trees that do not use
GNU configure). The ebuild for the package will check the USE flags and
call configure accordingly with the parameter to enable or disable that
asm code in the package that it is compiling.

If openssl is built with sse support, then it will use sse instructions every
time it runs. Whether it uses any sse4_2 instructions depends on whether
there are any in the openssl source code as well as whether the ebuild
sees the sse4_2 USE flag.

The USE flags are a Portage feature rather than a gcc feature. They are
a way to tell Portage ebuilds how to configure packages for compiling,
how to configure installation, etc.
_________________
TIA
Back to top
View user's profile Send private message
kbzium
Tux's lil' helper
Tux's lil' helper


Joined: 31 Jul 2012
Posts: 146

PostPosted: Thu Jan 03, 2013 8:44 am    Post subject: Reply with quote

Take a look here:
http://forums.gentoo.org/viewtopic-t-861618-start-75.html

He put "march=native" in his config and he got

Code:
Linux1 billydv # echo "" | gcc -march=native -v -E - 2>&1 | grep cc1
/usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.0/cc1 -E -quiet -v - -D_FORTIFY_SOURCE=2 -march=corei7-avx -mcx16 -msahf -maes -mpclmul -mpopcnt -mavx --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -mtune=corei7-avx


When run on mine:
Code:
kboom@kboom-laptop ~ $ echo "" | gcc -march=native -v -E - 2>&1 | grep cc1
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.4/cc1 -E -quiet -v - -D_FORTIFY_SOURCE=2 -march=core2 -mcx16 -msahf -maes -mpclmul -mpopcnt -mavx --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=3072 -mtune=generic


and if i use march=corei7-avx i get no other flags:
Code:
kboom@kboom-laptop ~ $ echo "" | gcc -march=corei7-avx -v -E - 2>&1 | grep cc1
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.4/cc1 -E -quiet -v - -D_FORTIFY_SOURCE=2 -march=corei7-avx
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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