help-gnu-emacs
[Top][All Lists]
Advanced

[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: Peter Dyballa
Subject: Re: Getting Number of CPU(-core)s and giving it as the --jobs argument to GNU Make
Date: Tue, 11 Sep 2007 23:52:58 +0200


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. 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`

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.

--
Mit friedvollen Grüßen

  Pete

Der Bezug einer Zeitung oder der Kauf eines Buches gibt niemand das Recht, an die Verfasserinnen von Artikeln oder Büchern dreiste Briefe zu schreiben.
                                            (Friedrich Sieburg)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]