You are not logged in.

#1 2008-09-21 20:58:13

dninja
Member
From: Sheffield, UK
Registered: 2006-04-29
Posts: 374
Website

is it worth recompiling for dual core?

I've just bought a new pc with dual core. Is it worth building none/some/all apps from source to take advantage of the second processor?

My guess is only some apps will benefit from having two processors, things like multimedia, can anyone confirm?

Offline

#2 2008-09-21 20:59:33

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: is it worth recompiling for dual core?

dninja wrote:

I've just bought a new pc with dual core. Is it worth building none/some/all apps from source to take advantage of the second processor?

My guess is only some apps will benefit from having two processors, things like multimedia, can anyone confirm?

It should be automatic.

Offline

#3 2008-09-21 21:12:22

bwalk
Member
Registered: 2007-03-21
Posts: 177

Re: is it worth recompiling for dual core?

No, it is not. Most code is not optimised for multicore architectures. And as skottish said, both cores will be used automatic for many processes.

Offline

#4 2008-09-21 21:14:22

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: is it worth recompiling for dual core?

It should be handled by the kernel, so no recompile needed for multiple processors/cores.


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#5 2008-09-21 21:29:27

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: is it worth recompiling for dual core?

dninja wrote:

I've just bought a new pc with dual core. Is it worth building none/some/all apps from source to take advantage of the second processor?

My guess is only some apps will benefit from having two processors, things like multimedia, can anyone confirm?

Surprisingly few common user programs take advantage of multi core systems. Even in multimedia.
I even remember reading a couple of years ago the mplayer guys bashing even the idea of multi core support.
It has changed a tiny bit today, but still there are no codecs which use threads for decoding (even in Windows CoreAVC is the only one afaik) and multimedia programs like mplayer don't split the work between the cores.
You can run them twice though.

Offline

#6 2008-09-21 21:49:49

dninja
Member
From: Sheffield, UK
Registered: 2006-04-29
Posts: 374
Website

Re: is it worth recompiling for dual core?

ok, I won't then.

One last question on it, in my makepkg.conf file, should I set the CFLAGS and CXXFLAGS to -O3 for a dual core? Number of processors + 1.

Offline

#7 2008-09-21 21:56:25

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: is it worth recompiling for dual core?

The -O flag has nothing to do with the number of processors.  It ranges from -O0 (none) to -O3 (all) optimizations.  The difference between -O2 and -O3 is minimal but sticking with -O2 can help with stability.

Offline

#8 2008-09-21 21:57:26

klixon
Member
From: Nederland
Registered: 2007-01-17
Posts: 525

Re: is it worth recompiling for dual core?

You're confusing the -O flag of the compiler with the -j flag for make
-O specifies the level of optimisation the compiler should apply whilst compiling (more optimisation tends to use more memory and is not always benefial). It tries to optimise the compiled code
-j tells make how many concurrent jobs it can start (usually (number of processor + 1) )

Last edited by klixon (2008-09-21 21:58:51)


Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!

Offline

#9 2008-09-21 22:00:28

dninja
Member
From: Sheffield, UK
Registered: 2006-04-29
Posts: 374
Website

Re: is it worth recompiling for dual core?

OK, sorry, should I do -j3?

Offline

#10 2008-09-21 23:33:59

dsr
Member
Registered: 2008-05-31
Posts: 187

Re: is it worth recompiling for dual core?

In answer to your first question, programs that support SMP (symmetric multiprocessing--the use of multiple cores/CPUs) should not need to be recompiled with a different ./configure flag (e.g. /var/abs/extra/gimp/PKGBUILD says that the GIMP is compiled with --enable-mp by default on Arch). However, modern CPUs (whether multi-core or not) support various optimizations (specific to each CPU) that may improve performance beyond Arch's default CFLAGS, which on i686 is CFLAGS="-march=i686 -mtune=generic -O2 -pipe". Using ABS, you can recompile [core], [extra], [community], and [testing] packages with your own CFLAGS, which you should probably copy from the wiki according to your specific CPU. Just note that you probably won't notice much of a difference in performance, if any, from Arch's default CFLAGS, so I don't recommend recompiling all your software from source. Let me refer you to CRUX or Gentoo if you want to follow that road. tongue Of course, you should still set CPU-specific CFLAGS in your /etc/makepkg.conf because they apply to the AUR as well as ABS. While it's probably not worth recompiling all your software just to optimize a little bit further, you might as well optimize your AUR builds since you have to compile from source anyway.

In answer to your second question, yes you should use MAKEFLAGS="-j3". I've never had a program fail to compile because of make -j3, and it almost doubles the speed of compilation. Definitely use it. Actually, according to this, MAKEFLAGS="-j2" might be slightly faster, but I've always followed the convention of adding 1 to the number of processors or cores.

Offline

#11 2008-09-21 23:34:58

Lord Illidan
Member
From: Malta
Registered: 2007-10-25
Posts: 248

Re: is it worth recompiling for dual core?

AFAIK, yes, you should do j3 if you want to take advantage of your dualcore while compiling programs. For me at least, the best advantage of dualcore is the increased multitasking ability.

Offline

#12 2008-09-22 08:35:12

dninja
Member
From: Sheffield, UK
Registered: 2006-04-29
Posts: 374
Website

Re: is it worth recompiling for dual core?

OK, thanks for the info, I've updated makepkg.conf and I'll see if I can spot any difference in compilation time.

I wasn't planning to recompile the full system, just anything that anyone thought would benefit from it. I came to Arch from Gentoo and I'm not bothered about going back at the moment!

Offline

#13 2008-09-22 08:46:31

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: is it worth recompiling for dual core?

Just FTR, some packages won't built with -j3 so if you come across a failed build, this is something you may want to check... (mplayer as this problem, firefox from mercurial has it too and there are some others but it's a minority anyhow)

Offline

#14 2008-09-22 16:41:39

vogt
Member
From: Toronto, Canada
Registered: 2006-11-25
Posts: 389

Re: is it worth recompiling for dual core?

dsr wrote:

In answer to your second question, yes you should use MAKEFLAGS="-j3". I've never had a program fail to compile because of make -j3, and it almost doubles the speed of compilation. Definitely use it.

Theoretically, a parallel build "-j 3" could differ from a sequential build, even if it doesn't fail (a better explanation here).

Builds that fail with -j 3 probably have !makeflags in the options array, since devs who use '-j 3' or higher have already seen those failures before you.

Offline

#15 2008-09-22 16:49:32

dninja
Member
From: Sheffield, UK
Registered: 2006-04-29
Posts: 374
Website

Re: is it worth recompiling for dual core?

That seems to make sense, I'll see what happens with -j3 and if I start having problems I'll go back to -j2 . With the speed of the machine, I don't mind too much waiting for a build, it doesn't take too long regardless of what flag is set.

Offline

#16 2008-09-22 17:03:48

arew264
Member
From: Friendswood, Texas, US
Registered: 2006-07-01
Posts: 394
Website

Re: is it worth recompiling for dual core?

Okay, there is no way to "recompile" for multicore processors. If the author of an application uses multiple threads, they will be farmed out to all CPU cores that are available. If the author didn't use multiple threads, you get no speed boost, no matter how many cores you have.

The fact is that most applications that can be easily multithreaded are. Codecs, media players, and the like... can't multithread effectively. They just don't work that way, in most cases, because they rely on the sequential processing of data.
Media players could, theoretically, decode audio and video separately, or separate graphics from decoding, but the fear of many developers is that switching between the threads on a single core system would cause the media player to perform less than optimally.

You can use CPU specific optimizations, that's the basis of Arch, but you can't compile for SMP, it's either there or not. The kernel will manage up to 4 cores for you (the Arch default), and only applications that take advantage of threading/multiprocessing will actually see a noticeable speed boost.

Everything will run a bit faster because, well, you effectively have 2 CPU's, and that always gives an advantage.

Last edited by arew264 (2008-09-22 17:07:35)

Offline

#17 2008-09-22 19:58:42

dsr
Member
Registered: 2008-05-31
Posts: 187

Re: is it worth recompiling for dual core?

dninja wrote:

That seems to make sense, I'll see what happens with -j3 and if I start having problems I'll go back to -j2 . With the speed of the machine, I don't mind too much waiting for a build, it doesn't take too long regardless of what flag is set.

No, -j3 and -j2 are essentially the same. If there's instability with a specific package, you would have to use -j1 on that specific package, but the PKGBUILD should do that for you automatically. In short, just leave your MAKEFLAGS as -j3 or -j2 in /etc/makepkg.conf.

Offline

#18 2008-09-22 20:03:57

dsr
Member
Registered: 2008-05-31
Posts: 187

Re: is it worth recompiling for dual core?

arew264 wrote:

but you can't compile for SMP, it's either there or not.

That's not true---see my first post. Certain apps (e.g. the GIMP) are built without SMP support by default but are programmed with it, so you have to pass the appropriate option to ./configure (e.g. './configure --enable-mp' in the case of the GIMP) to enable the app to take advantage of multiple CPUs/cores. However, the PKGBUILD should do that automatically.

Offline

#19 2008-09-22 22:07:14

arew264
Member
From: Friendswood, Texas, US
Registered: 2006-07-01
Posts: 394
Website

Re: is it worth recompiling for dual core?

That's going to be pretty rare (in most cases, that would mean the author has to maintain two completely differently structured versions of the code).
My point is that in about 98% of applications, there is no way to recompile to take advantage of SMP if it isn't already taken advantage of. The PKGBUILD settings should eliminate the last 2% anyway, as you said.

Offline

#20 2008-09-22 22:40:00

dsr
Member
Registered: 2008-05-31
Posts: 187

Re: is it worth recompiling for dual core?

Exactly.

Offline

#21 2008-09-24 15:27:42

whaler
Member
From: Oslo, Norway
Registered: 2008-03-25
Posts: 323

Re: is it worth recompiling for dual core?

Does OpenOffice Calc work faster/better with two or more processors?

Offline

#22 2008-09-24 20:58:16

vogt
Member
From: Toronto, Canada
Registered: 2006-11-25
Posts: 389

Re: is it worth recompiling for dual core?

whaler wrote:

Does OpenOffice Calc work faster/better with two or more processors?

Remember that the j flags speed up the build while hopefully resulting in the same build.

That depends on the design of calc. An overview of what is threaded (not usually for speed, but so that two things can happen without one blocking the other) happens to be here: http://wiki.services.openoffice.org/wik … -Threading

From what I see, Calc does not use multiple threads to speed up calculations. But that could be because I don't use huge data sets.

Offline

#23 2008-09-24 22:11:04

whaler
Member
From: Oslo, Norway
Registered: 2008-03-25
Posts: 323

Re: is it worth recompiling for dual core?

vogt wrote:

From what I see, Calc does not use multiple threads to speed up calculations.

Thank you. From this I conclude that all the fancy capable hardware is for gamers. OpenOffice isn't written in Assembly either... sad

Offline

Board footer

Powered by FluxBB