LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices



Reply
 
Search this Thread
Old 04-12-2008, 02:10 PM   #1
almora99
LQ Newbie
 
Registered: Mar 2008
Posts: 15

Rep: Reputation: 0
GCC compiles so slow with AMD


Hi.
I try to compile some kernel modules (rt73 wireless adapter driver) with two different laptops.
Same OS installed to all of them and up to date. (Fedora 8)

First laptop has 1GB RAM and Intel Core2Duo T5200 @ 1.6Ghz
Second one is has 2GB RAM and AMD Turion TL-58 @ 1.9GHz

Intel compiles modules in ~3 secs.
AMD compiles same modules in ~17 secs.

Why are the results so different?
Should I optimize GCC to work good with AMD?
Or should I optimize whole system to work good with AMD?
 
Old 04-12-2008, 02:59 PM   #2
MasterOfTheWind
Member
 
Registered: Jul 2004
Distribution: Arch, Debian sid, Kubuntu, Slackware 11
Posts: 324

Rep: Reputation: 30
A couple of suggestions:

Make sure that the AMD-based laptop doesn't have power saving on - that most certainly will scale down processor's frequency.

Also make sure that the AMD CPU is recognized as a dual core.
 
Old 04-12-2008, 04:00 PM   #3
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,362

Rep: Reputation: 172Reputation: 172
The dual core thing really should not matter in this case. GCC will pretty much only use one core.

I could not find any charts comparing those two cpus, but if they follow past history(on mobile cpus) the Intel cpu probably just has more horsepower than the AMD. The AMD mobile processors generally worry more about power consumption and price than raw horsepower. That could account for maybe half the discrepancy you are seeing. Just for the record I use AMD.

If power saving is set up correctly it should not matter, but it is fairly common for it to be acting screwy(certainly worth a try).

I do not think attempting to optimize you system (as in recompiling) will make any real difference. The best numbers I have seen on this are well under 5%.
 
Old 04-12-2008, 04:40 PM   #4
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
It wouldn't hurt to recompile GCC with optimizations specific to your CPU if possible, to at least see how much (if any) speed is gained. That said, unless you end-up saving significant amounts of time, it's probably not worth the risk - considering that your recompiled GCC will never be able to get the same amount of testing which the Fedora-provided GCC has. Personally, I'd probably just live with it, it's the performance of the binaries GCC generates which I care about (unless of course I was, for example, compiling something that would take like 7 days with the Fedora GCC and 3 days with my own).

Last edited by win32sux; 04-12-2008 at 04:41 PM.
 
Old 04-12-2008, 06:39 PM   #5
almora99
LQ Newbie
 
Registered: Mar 2008
Posts: 15

Original Poster
Rep: Reputation: 0
OK, there are no lot of things to make gcc run fast.
But this result is so interesting.
Intel 3secs, AMD 17secs.
Intel is 6 times faster at compiling?
There must be something I miss.
Or... I will buy Intel next time, I think.
 
Old 04-12-2008, 06:54 PM   #6
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,362

Rep: Reputation: 172Reputation: 172
As I said in my earlier post:
Quote:
That could account for maybe half the discrepancy you are seeing.
Again note I said MAYBE half. There is something amiss on your AMD setup. Whether it is a miss configured powersave, bad stick of ram, or what else I will not even guess.

I would compare what I payed for each machine (including extra memory etc). Usually the AMD provides more bang for the buck.

Edit: This is a little dated but:

Last edited by lazlow; 04-12-2008 at 07:00 PM.
 
Old 04-12-2008, 07:16 PM   #7
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,623

Rep: Reputation: 214Reputation: 214Reputation: 214
The difference in performance may or may not be CPU related. Use the top command to monitor the %CPU used during the two compiles and see if the CPUs are the bottleneck.

-----------------------
Steve Stites
 
Old 04-13-2008, 06:37 PM   #8
almora99
LQ Newbie
 
Registered: Mar 2008
Posts: 15

Original Poster
Rep: Reputation: 0
lazlow: All of test I made are parallel with tests results on the web as the link you gave. But at compiling I'm missing something I think...


Quote:
Originally Posted by jailbait View Post
The difference in performance may or may not be CPU related. Use the top command to monitor the %CPU used during the two compiles and see if the CPUs are the bottleneck.
Steve Stites
While compiling top displays that max CPU using program is cc (or cc1) and it's near %30.

I'm running laptop with AC power.
When I type "cat /proc/cpuinfo" I can see two core.
I'm sure CPU frequency is at max (1.9GHz) while compiling.
I do not know what should I do.
 
Old 04-13-2008, 08:03 PM   #9
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,362

Rep: Reputation: 172Reputation: 172
Go ahead and post your top.

What distro and version are you running (sorry if I missed it)?

Edit F8 sorry.
 
Old 04-14-2008, 08:03 AM   #10
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,185

Rep: Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136
The performance difference described in this thread is more likely to be a filesystem/disk issue than a CPU issue, but even that can't reasonably explain such a big difference in time.

Quote:
Originally Posted by almora99 View Post
When I type "cat /proc/cpuinfo" I can see two core.
That doesn't tell you whether Linux is able to use both cores. But (as someone else mentioned), gcc wouldn't use both at the same instant anyway, so having Linux able to use both cores only matters if something else is using significant CPU time during the compile (in which case the disk accesses of that something else are more likely to be the real issue).

Quote:
Originally Posted by almora99 View Post
I'm sure CPU frequency is at max (1.9GHz) while compiling.
How are you sure? What did you use to check that? If I'm wrong about this being a filesystem/disk issue then the power saving issue others suggested is such a good theory, you should check that more carefully.
 
Old 04-15-2008, 03:45 PM   #11
almora99
LQ Newbie
 
Registered: Mar 2008
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by johnsfine View Post

How are you sure? What did you use to check that?
I type
cat /proc/cpuinfo |grep MHz
while compiling to see what CPU's current speed is.

And about Filesystem/Disk issue:
I did tests about filesystem/disk issue. On this issue AMD laptop %30 faster than Intel. I think laptop which has Intel CPU has a 4200 RMP HDD.

lazlow:
top command shows CPU usage for cc1 (cc) about %13-%30-%20...
Some periods it does not show about cc, CPU usages of other than cc process are about %0 always.

Should it be near %100 (assuming gcc uses one core) every compiling process?
 
Old 04-15-2008, 03:57 PM   #12
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,185

Rep: Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136
Quote:
Originally Posted by almora99 View Post
I type
cat /proc/cpuinfo |grep MHz
while compiling to see what CPU's current speed is.
I'm pretty sure that method of finding the CPU's current speed wouldn't work. I'll try to remember to test that later to be 100% sure it doesn't work.
 
Old 04-16-2008, 02:55 AM   #13
Electro
Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Compiling requires low latency hard drives to access the files.

The Turion is a K8L and the Core 2 Duo is newer and better (more efficient). Sure the Core 2 Duo processor will be faster.

Multiple processors does help during compiling. One processor will collect the data or compile other sets of data while the second processor will compile the other parts of data. The -j option depends on the design of the program if it can be compile in parallel and to load the processors. Multiple processors also helps doing file system IO tasks.

The utility top shows processor usage in single mode or in separate mode. Hit 1 to toggle through the modes.

I recommend do a re-test with flash memory that includes ECC or SSD with ECC.

Turions were designed to compete against Celerons and Pentium M processors.
 
Old 04-17-2008, 12:00 PM   #14
almora99
LQ Newbie
 
Registered: Mar 2008
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Electro View Post
Compiling requires low latency hard drives to access the files.

The Turion is a K8L and the Core 2 Duo is newer and better (more efficient). Sure the Core 2 Duo processor will be faster.

Multiple processors does help during compiling. One processor will collect the data or compile other sets of data while the second processor will compile the other parts of data. The -j option depends on the design of the program if it can be compile in parallel and to load the processors. Multiple processors also helps doing file system IO tasks.

The utility top shows processor usage in single mode or in separate mode. Hit 1 to toggle through the modes.

I recommend do a re-test with flash memory that includes ECC or SSD with ECC.

Turions were designed to compete against Celerons and Pentium M processors.
I create a ram disk. Results are same...
 
Old 04-17-2008, 06:31 PM   #15
Electro
Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Again the Turion was not designed to compete against the Core 2 Duo. It was designed to compete against a Pentium III and a Celeron (Pentium 4 model). It could also compete against a Pentium M.

Dah, the dual processor Core 2 Duo beats the single processor Turion.

A Turion can process two instructions at a time so its computing factor is 3800 (1900 MHz X 2 instructions per cycle). A Core 2 Duo (set in single processor mode) computing factor is 6400 (1600 MHz X 4 instructions per cycle).

Using tmpfs or ram disk will effect the timing because Linux is doing buffering and caching on it too. tmpfs is not a solid state disk.

I am not an Intel fan. I am more an AMD fan. Though comparing two processors from different times will give you very different results.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GCC compiles, program runs, but only in a CERTAIN directory The_Nerd Programming 16 03-26-2007 08:28 AM
g++ compiles but not gcc senthilpr_in Linux - Software 10 08-29-2005 03:20 PM
C code compiles on windows, but not with gcc MDBlueIce Programming 6 05-23-2005 05:33 PM
gcc, segmentation fault, though compiles... scratch09 Programming 5 11-20-2004 06:11 PM
problem in template function. compiles in vc++ not in gcc 3.0.4 cybercop12us Programming 4 12-12-2002 02:04 AM


All times are GMT -5. The time now is 11:17 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration