Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What CFLAGS should i use?
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
lea0014
n00b
n00b


Joined: 09 Mar 2010
Posts: 24

PostPosted: Wed Aug 14, 2013 6:08 pm    Post subject: What CFLAGS should i use? Reply with quote

Hi there, i'm installing a new box with an AMD FX-6300 processor. Of course, im following the handbook to install the system, but when i have to set the CFLAGS variable, the handbook is not handy at all. So, as far i could see, -march=native is what should i take.
Here comes the deal; i want to run a distcc service at the FX system, and the wiki says:
Quote:
Starting with GCC 4.3.0, the compiler supports the -march=native switch which turns on CPU autodetection and optimizations that are worth being enabled on the processor the GCC is running at. This is a problem with distcc as it allows mixing of code optimized for different processors (like AMD Athlon and Intel Pentium). Don't use -march=native or -mtune=native in your CFLAGS or CXXFLAGS when compiling with distcc .

Help! (probably i need some explanations about distcc?)

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


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Wed Aug 14, 2013 7:21 pm    Post subject: Reply with quote

I believe distcc uses the target system's -march setting when doing remote compile. So, it is okay to use -march=native on the big machine, but you cannot use it on the smaller target machines (assuming lesser instruction set) as that would tell distcc to build binaries with instructions they cannot use (since it is gcc itself deciding what 'native' means, not portage).

If you do "man gcc" you will find the possible choices for -march= on x86 somewhere around line 9000 or so.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21607

PostPosted: Wed Aug 14, 2013 8:22 pm    Post subject: Reply with quote

Last time I checked, distcc uses the source system's -march setting when using -march=native by way of refusing to distribute the work to remote nodes if the arguments include -march=native.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Fri Aug 16, 2013 2:43 am    Post subject: Reply with quote

Here's a script I have that outputs the actual flags -march=native expands to; I use this for distcc on my own machines:
Code:
#!/bin/bash
echo $(
    gcc -v -march=native -x c /dev/null 2>&1 | \
    grep -- '-march' | \
    egrep -o -- '-+(m|param )[-_=.a-zA-Z0-9]+' | \
    sort -u
)
Back to top
View user's profile Send private message
CrUpf
n00b
n00b


Joined: 13 Dec 2008
Posts: 12
Location: /home/crupf

PostPosted: Sat Aug 24, 2013 11:16 pm    Post subject: Reply with quote

As the FX-6300 is a Piledriver cpu, and Piledriver is based on Bulldozer, I would suggest something like:
CFLAGS="-O2 -march=bdver1 -mtune=bdver1"

See here:
http://en.wikipedia.org/wiki/Piledriver_%28microarchitecture%29
http://en.wikipedia.org/wiki/Bulldozer_%28microarchitecture%29

http://gcc.gnu.org/gcc-4.6/changes.html
Quote:
Support for AMD Bulldozer (family 15) processors is now available through the -march=bdver1 and -mtune=bdver1 options.


Actually I would be quite interested if you could encrypt one of your drives and test how fast your CPU/drive is working due to the AES instruction set compared to a comparable unencrypted drive.
Back to top
View user's profile Send private message
Schnulli
Guru
Guru


Joined: 25 Jun 2010
Posts: 320
Location: Bremen DE

PostPosted: Sat Aug 31, 2013 9:57 pm    Post subject: Reply with quote

you shouldnt use march=native with gcc 4.3 because its only supported above gcc >4.6 ;) its dangerous then .....
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