Gentoo Forums
Gentoo Forums
Quick Search: in
CFLAGS setting for both atom 330 and athlon64?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
mgnut57
n00b
n00b


Joined: 12 Jan 2008
Posts: 29

PostPosted: Sun Mar 21, 2010 11:35 pm    Post subject: CFLAGS setting for both atom 330 and athlon64? Reply with quote

I have 2 machines, one is an Athlon64 3000+, the other is an Atom 330. I already found that code compiled with
CFLAGS="-march=x86-64 -O3 -pipe -fomit-frame-pointer"
will not work on the Atom system. What I would like to know is what is a good march setting that will run on both the Athlon64 and the Atom 330 in 64-bit mode?

The Athlon 64 processor is an older version -- single core, socket 939.
$ more /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 47
model name : AMD Athlon(tm) 64 Processor 3000+
stepping : 0
cpu MHz : 1808.715
cache size : 512 KB
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt lm 3dnowext 3dnow
up rep_good pni lahf_lm
bogomips : 3617.43
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp tm stc
Back to top
View user's profile Send private message
Mike Hunt
Watchman
Watchman


Joined: 19 Jul 2009
Posts: 5287

PostPosted: Mon Mar 22, 2010 12:26 am    Post subject: Reply with quote

Code:
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}"

Might be right for you. See Safe_Cflags

You can view what -march=native sets like this:
Code:
gcc -### -march=native -E /usr/include/stdlib.h 2>&1 | grep "/usr/libexec/gcc/.*cc1"


And don't use -O3 - it breaks things.
Back to top
View user's profile Send private message
Jaglover
Advocate
Advocate


Joined: 29 May 2005
Posts: 3172
Location: Saint Amant, Acadiana

PostPosted: Mon Mar 22, 2010 1:46 am    Post subject: Reply with quote

Maybe you should tell us why you want those binaries to run on both machines.

--
Yes, Mike, I have a little Jag :D
Back to top
View user's profile Send private message
mgnut57
n00b
n00b


Joined: 12 Jan 2008
Posts: 29

PostPosted: Mon Mar 22, 2010 2:06 am    Post subject: Reply with quote

Jaglover wrote:
Maybe you should tell us why you want those binaries to run on both machines.


So that I can compile on one machine and then just port the binary packages to the other. This makes an "emerge -upD world" much quicker on the second machine. I can even accelerate the compilation on the first machine using distcc with both machines taking part in the compilation.


Last edited by mgnut57 on Mon Mar 22, 2010 2:43 am; edited 1 time in total
Back to top
View user's profile Send private message
mgnut57
n00b
n00b


Joined: 12 Jan 2008
Posts: 29

PostPosted: Mon Mar 22, 2010 2:42 am    Post subject: Reply with quote

Mike Hunt wrote:
Code:
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}"

Might be right for you. See Safe_Cflags

You can view what -march=native sets like this:
Code:
gcc -### -march=native -E /usr/include/stdlib.h 2>&1 | grep "/usr/libexec/gcc/.*cc1"


And don't use -O3 - it breaks things.


Maybe I don't understand, but I think that using "-march=native" is exactly what I don't want to do. If I understand properly, this will make gcc apply optimizations for the host processor, which is most likely to make it not run on the other machine.

From the web page you refer to:
Quote:

Do not use -march=native if you use distcc on nodes with different architectures as this may produce unusable code.
Back to top
View user's profile Send private message
Mike Hunt
Watchman
Watchman


Joined: 19 Jul 2009
Posts: 5287

PostPosted: Mon Mar 22, 2010 12:52 pm    Post subject: Reply with quote

mgnut57 wrote:
Maybe I don't understand, but I think that using "-march=native" is exactly what I don't want to do. If I understand properly, this will make gcc apply optimizations for the host processor, which is most likely to make it not run on the other machine.

From the web page you refer to:
Quote:
Do not use -march=native if you use distcc on nodes with different architectures as this may produce unusable code.

True enough, because you need -march=k8 on one and -march=nocona on the other.

Have a look at the Gentoo Embedded Handbook for clues and ideas.
Back to top
View user's profile Send private message
mgnut57
n00b
n00b


Joined: 12 Jan 2008
Posts: 29

PostPosted: Mon Mar 22, 2010 3:00 pm    Post subject: Reply with quote

Mike Hunt wrote:
mgnut57 wrote:
Maybe I don't understand, but I think that using "-march=native" is exactly what I don't want to do. If I understand properly, this will make gcc apply optimizations for the host processor, which is most likely to make it not run on the other machine.

From the web page you refer to:
Quote:
Do not use -march=native if you use distcc on nodes with different architectures as this may produce unusable code.

True enough, because you need -march=k8 on one and -march=nocona on the other.

Have a look at the Gentoo Embedded Handbook for clues and ideas.


I'm going to try "-mtune=generic", which I think should work. I was hoping that there was a setting that would use more optimizations.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming 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