[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting Number of CPU(-core)s and giving it as the --jobs argument t
From: |
Dieter Wilhelm |
Subject: |
Re: Getting Number of CPU(-core)s and giving it as the --jobs argument to GNU Make |
Date: |
Wed, 12 Sep 2007 00:11:03 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> Am 11.09.2007 um 22:20 schrieb Dieter Wilhelm:
>
>> That's a bit confusing, I thought I had *one* processor with *two*
>> cores and the content in /proc/cpuinfo claims two processor, 0 and 1
>> with two cores, respectively, where am I wrong?
>
> HT – hyper-threading (parallel pipelines and parallel memory buses).
> Many modern intel CPUs claim they are two (Xeons are four, or even
> eight, I think). They are right, somehow: mostly you can assume that
> in your case four commands are (can be) executed at the same time.
I see, thanks for the explanation.
> For your PC 'make -j 4' will improve compilation time. So doing in
> bash
>
> cores=`grep cores /proc/cpuinfo | wc -l`
> if [ $cores -eq 0 ]; then cores=1; fi
> procs=`grep processor /proc/cpuinfo | wc -l`
> thrds=`expr $cores \* $procs`
Wait! I'm not the guy which asked for this make related problem. I'm
just a miscellaneous ignorant who sneaked into this threat, I'm sorry
for that.
>
> or in (t)csh
>
> set cores=`grep cores /proc/cpuinfo | wc -l`
> if ($cores == 0) set cores=1
> set procs=`grep processor /proc/cpuinfo | wc -l`
> set thrds=`expr $cores \* $procs`
>
> would determine how many compilation threads can be executed in
> $thrds. And it should also work when the CPU has no core ... Solaris,
> AIX, HP-UX, IRIX ... have their own commands.
>
>
> Anyway, a modern GNU make is able to determine by itself what's best.
> This is done via 'make -j' without a limiting number.
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany