LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-09-2008, 11:43 AM   #1
rob.rice
Senior Member
 
Registered: Apr 2004
Distribution: slack what ever
Posts: 1,076

Rep: Reputation: 205Reputation: 205Reputation: 205
$CFLAGES and $C++FLAGES what do I set these for to get the most out of my CPU


when I build something from source I want it to match the CPU and use as much of what it has as it can so here is my /proc/cpuinfo file
Code:
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 22
model name      : Intel(R) Celeron(R) CPU          540  @ 1.86GHz
stepping        : 1
cpu MHz         : 1862.100
cache size      : 1024 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
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 tm pbe nx lm constant_tsc up arch_perfmon pebs bts pni monitor ds_cpl tm2 ssse3 cx16 xtpr lahf_lm
bogomips        : 3728.21
clflush size    : 64
not the best CPU but it's best one I have ever had
so what do I set $CFLAGES and $C++FLAGES to
 
Old 08-09-2008, 12:14 PM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
Depends to some extent on the version of gcc you use. Look at the gcc online docs, for the version of gcc you are using, --> http://gcc.gnu.org/onlinedocs/ in the section title "Intel 386 and AMD x86-64 Options" for processor-specific settings.

BTW, it's CXXFLAGS, not C++FLAGS.
 
Old 08-09-2008, 06:47 PM   #3
rob.rice
Senior Member
 
Registered: Apr 2004
Distribution: slack what ever
Posts: 1,076

Original Poster
Rep: Reputation: 205Reputation: 205Reputation: 205
"gcc --version"returns 4.2.3
I've been looking at info gcc but I don't know what options apply to this cpu
other than -mtune=_native_
 
Old 08-09-2008, 11:08 PM   #4
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
Use the 4.2.4 version of the gcc manual.

With a quick search of Google, I can't find any reference to a family 6, model 22 Celeron so I don't know which microarchitecture yours is based on. --mtune=native or --march=native (if you are not building binaries for another machine) works. You can force the -mmmx, -msse, -msse2, and -msse3 since you have those registers. A reasonable optimization level is -O2. You could use -pipe so the compilation process uses pipe instead of intermediate files. Other than that, there's not much else unless you really know what the option is going to do to the resulting binary.
 
Old 08-10-2008, 12:06 AM   #5
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by weibullguy View Post
A reasonable optimization level is -O2.
Why not -O3 ?
 
Old 08-10-2008, 04:24 AM   #6
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
According to this:
http://gentoo-wiki.com/Safe_Cflags#I..._T20xx.2FT21xx

it should be:
Code:
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
@ ErV

I also recommend against using '-O3' because it WILL break some programs. I've had this happen to me and it took a while to debug, and then I found out that changing '-O3' to '-O2' fixed the problem. You can take your chances with '-O3', maybe newer gcc versions will no longer break programs when given this option, but I wouldn't use it if you want to keep your system as stable as possible.
 
Old 08-10-2008, 10:00 AM   #7
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
@H_TeXMeX_H, I'm a Gentoo user and I completely forgot about that page. Thanks!

@ErV, let me join H_TeXMeX_H in strongly discouraging the use of -O3. Some things will, without a doubt, break and you won't notice a difference over using -O2.
 
Old 08-10-2008, 02:41 PM   #8
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Yeah, I like the gentoo-wiki, it has useful info for all Linux users, not just for Gentoo (although many topics are Gentoo-specific).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I set CPU max % usage for a process ? lapin3000 Linux - Software 3 12-01-2007 07:51 PM
CPU Overheat Warning when opening terminal (CPU is not overheating) Virtuality Linux - Newbie 4 05-30-2007 04:10 AM
One CPU, 4 Display. How to set it up using slackware? slackers-bengkulu Slackware 12 05-15-2007 07:05 AM
How to find CPU Cache ? (apart from dmesg|grep CPU) Dark Carnival Linux - Hardware 3 12-22-2005 07:10 PM
please help guys, wrong cpu speed shown with a regular non-mobile cpu !! : ( maku Linux - Hardware 1 01-02-2005 02:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration