Unix Technical Forum

Compile with optimizations

This is a discussion on Compile with optimizations within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> Excuse my simple question, but I din't find a clear answer in the web. I compiled lame with optimizations ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-20-2008, 08:50 PM
korgman
 
Posts: n/a
Default Compile with optimizations

Excuse my simple question, but I din't find a clear answer in the web.

I compiled lame with optimizations (--enable-expopt=full) and I saw
x3 faster processing.

I will start to encode xvid, some optimized packages needed for Pentium3
Found only i486 tgzs, so I want to compile with optimizations.

Found that I need to insert (where?) this flag:
-march=Pentium3 (possibly -O3?)

Some programs (like lame) have options to optimize in ./configure,
some others not:

1. How I can compile with cflags? (the ./configure confuses me..)

1b. Maybe it's better to add "export CFLAGS="-O3 -march=Pentium3" in
~/.profile? I think it's dangerous, because some configure want their
own flags.

2. Is dangerous (crash) to have some programs (let's say lame) compiled
with _no_ optimizations (or libraries) and some other programs that
depends from them to be with optimizations?

3. When you have an optimized Pentium 3 Slackware packages the i686 in
filename is misleading, because i686 is Pentium MMX, right? So, what
about the filename? lame-x.x-iP3-xyyy.tgz is ok?

I am interest to stability, I don't bother to gain 3% faster processing.
--
Please excuse my english writing!
Slackware 11
Knowledge report: Newbie with custom kernel
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-20-2008, 08:50 PM
Eef Hartman
 
Posts: n/a
Default Re: Compile with optimizations

korgman <korgie@gmail.com> wrote:
> 3. When you have an optimized Pentium 3 Slackware packages the i686 in
> filename is misleading, because i686 is Pentium MMX, right? So, what
> about the filename? lame-x.x-iP3-xyyy.tgz is ok?


Just an answer to this:
no, Pentium (the original one) and Pentium-MMX are "i586", while
Pentium-Pro, Pentium-II (= Pentium-Pro with MMX) and Pentium-III are i686
(the P4 is a rather special case as it's something IN-between a i686 and a
i786 (the Itanium), they had already used the i786 id before the P4 came out).

If you use "cat /proc/cpuinfo" you'll get something like this:
vendor_id : GenuineIntel
cpu family : 6
for a i686 (and "family 5" for a 586, of course), but
vendor_id : GenuineIntel
cpu family : 15
for a Pentium 4. Just to be complete, Core 2 (etc) processors are also
"family 15", although they're not given the name Pentium at all anymore.

AMD Athlon's are either family 6 or family 15, depending on the specific
cpu (but AuthenticAMD, of course).

In practice you won't see many i586's anymore as they didn't come any higher
then 200 MHz.
--
************************************************** ******************
** Eef Hartman, Delft University of Technology, dept. EWI/TW **
** e-mail: E.J.M.Hartman@math.tudelft.nl, fax: +31-15-278 7295 **
** snail-mail: P.O. Box 5031, 2600 GA Delft, The Netherlands **
************************************************** ******************
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-20-2008, 08:50 PM
korgman
 
Posts: n/a
Default Re: Compile with optimizations

On 2007-01-30, Eef Hartman <E.J.M.Hartman@math.tudelft.nl> wrote:
> no, Pentium (the original one) and Pentium-MMX are "i586", while
> Pentium-Pro, Pentium-II (= Pentium-Pro with MMX) and Pentium-III are i686
> (the P4 is a rather special case as it's something IN-between a i686 and a
> i786 (the Itanium), they had already used the i786 id before the P4 came out).


Ok, I don't disagree, Pentium 3 is on i686 family. BUT it has extra
SSE commands. So, if I compile a package for Pentium3 (with mmx, sse)
it will run on Pentium 2 or Pentium Pro? Thus my question if the name
i686 is correct or P3 is better.

--
Please excuse my english writing!
Slackware 11
Knowledge report: One year, still plenty to learn
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-20-2008, 08:50 PM
korgman
 
Posts: n/a
Default Re: Compile with optimizations

On 2007-01-30, korgman <korgie@gmail.com> wrote:
> Thus my question if the name i686 is correct or P3 is better.


Hmmm, just checked avidemux form slacky.it, allthough is labeled
as i486 it has SSE optimizations. My worries are lower..

--
Please excuse my english writing!
Slackware 11
Knowledge report: One year, still plenty to learn
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-20-2008, 08:50 PM
Henrik Carlqvist
 
Posts: n/a
Default Re: Compile with optimizations

korgman <korgie@gmail.com> wrote:
> So, if I compile a package for Pentium3 (with mmx, sse)
> it will run on Pentium 2 or Pentium Pro?


This is the difference between -march and -mtune. If you use the argument
-march=pentium3 to gcc it might generate code that requires a pentium3
CPU. If you instead use the argument -mtune=pentium3 gcc will do its best
to optimze the code for pentium3 but still being backwards compatible.

> Thus my question if the name
> i686 is correct or P3 is better.


If you don't care about compability with other i686 CPUs but only want max
optimization for pentium3 go for "-march=pentium3" and name the arch part
of the package something like p3 or pentium3 to show this. If you want
backwards compability in your package but still think that performance is
most important on a pentium3 cpu you can do something like: "-march=i486
-mtune=pentium3" and then name the package i486.

regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc1(at)poolhem.se Examples of addresses which go to spammers:
root@localhost postmaster@localhost

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:51 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com