From: "J.A. Magallon" <jamagallon@able.es>
To: Dan Maas <dmaas@maasdigital.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Distinguish real vs. virtual CPUs?
Date: Tue, 22 Mar 2005 02:12:52 +0000 [thread overview]
Message-ID: <1111457572l.9192l.0l@werewolf.able.es> (raw)
In-Reply-To: <20050321202726.A7630@morpheus> (from dmaas@maasdigital.com on Tue Mar 22 02:27:26 2005)
On 03.22, Dan Maas wrote:
> Is there a canonical way for user-space software to determine how many
> real CPUs are present in a system (as opposed to HyperThreaded or
> otherwise virtual CPUs)?
>
This is 2xXeonHT, is, 4 cpus on 2 packages:
cat /proc/cpuinfo:
processor : 0
...
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
processor : 1
...
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
processor : 2
...
physical id : 3
siblings : 2
core id : 3
cpu cores : 1
processor : 3
...
physical id : 3
siblings : 2
core id : 3
cpu cores : 1
So something like:
cat /proc/cpuinfo | grep 'core id' | uniq | wc -l
would give you the number of packages or 'real cpus'. Then you have to
choose which ones are unrelated. Usually evens are siblings of odds, but
I won't trust on it...
> We have an application that for performance reasons wants to run one
> process per CPU. However, on a HyperThreaded system /proc/cpuinfo
> lists two CPUs, and running two processes in this case is the wrong
> thing to do. (Hyperthreading ends up degrading our performance,
> perhaps due to cache or bus contention).
>
I always hear people about HT 'degrading' performance. Obviously you don't
get a 200%, but it is always better than 100%. With my simulation code,
in which I did not anything special for HT (it uses my 4 cpus as 'real' ones),
I usually get a 125-130% gain. So the theoretical performance loos true.
Your application behaviour has to be really nasty to run slower with 2 threads
on an HT-P4 that with one thread.
Hope this helps.
--
J.A. Magallon <jamagallon()able!es> \ Software is like sex:
werewolf!able!es \ It's better when it's free
Mandrakelinux release 10.2 (Cooker) for i586
Linux 2.6.11-jam6 (gcc 3.4.3 (Mandrakelinux 10.2 3.4.3-6mdk)) #1
next prev parent reply other threads:[~2005-03-22 3:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-22 1:27 Distinguish real vs. virtual CPUs? Dan Maas
2005-03-22 1:56 ` Dave Jones
2005-03-22 11:55 ` Dr. David Alan Gilbert
2005-03-22 15:02 ` not for amd " Tom Vier
2005-03-22 2:01 ` Daniel Andersen
2005-03-22 2:12 ` J.A. Magallon [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-03-22 4:29 Pallipadi, Venkatesh
2005-03-22 21:26 ` Bill Davidsen
2005-03-22 21:38 ` Jan Engelhardt
2005-03-23 17:52 ` Tom Vier
2005-03-23 21:32 ` Bill Davidsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1111457572l.9192l.0l@werewolf.able.es \
--to=jamagallon@able.es \
--cc=dmaas@maasdigital.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox