[R] Information on the number of CPU's

Luke Tierney luke at stat.uiowa.edu
Tue Sep 9 22:21:49 CEST 2008

The wmic command line utility can also be used to query this; on a
dual-core Vista laptop I get

     C:\Users\luke>wmic cpu get NumberOfCores,NumberOfLogicalProcessors
     NumberOfCores  NumberOfLogicalProcessors
     2              2



Luke Tierney
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu

On Tue, 9 Sep 2008, tolga.i.uzuner at jpmorgan.com wrote:

> Many thanks, that's very helpful.
> Regards,
> Tolga
> ----- Original Message -----
> From: Prof Brian Ripley [ripley at stats.ox.ac.uk]
> Sent: 09/09/2008 20:57 CET
> To: Tolga Uzuner
> Cc: r-help at r-project.org
> Subject: Re: [R] Information on the number of CPU's
> On Tue, 9 Sep 2008, tolga.i.uzuner at jpmorgan.com wrote:
>> Dear R Users,
>> I am on Windows XP SP2 platform, using R version 2.7.2 . I was wondering
>> if there is a way to find out, within R, the number of CPU's on my machine
>> ? I would use this information to set the number of nodes in a cluster,
>> depending on the machine. Sys.info() and .Platform do not carry this
>> information.
> Correct, since
> a) R does not make use of more than 1.
> b) It is really not portable, and not even well-defined.  (How many CPUs has 
> a hyperthreaded dual Xeon?  Some say 2, some say 4.  Do you want CPUs or 
> cores?  If this is a virtualized OS, is the physical number or the logical 
> number?)
> In the case of Windows, how depends on the Windows version.  The w32api (XP 
> or later) call GetNativeSystemInfo will tell you the number of CPUs, for some 
> (unstated) definition of 'CPU'.  Later versions have 
> GetLogicalProcessorInformation, which can give the number of cores.
>> Thanks in advance,
>> Tolga Uzuner
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> Generally, this communication is for informational purposes only
> and it is not intended as an offer or solicitation for the purchase
> or sale of any financial instrument or as an official confirmation
> of any transaction. In the event you are receiving the offering
> materials attached below related to your interest in hedge funds or
> private equity, this communication may be intended as an offer or
> solicitation for the purchase or sale of such fund(s).  All market
> prices, data and other information are not warranted as to
> completeness or accuracy and are subject to change without notice.
> Any comments or statements made herein do not necessarily reflect
> those of JPMorgan Chase & Co., its subsidiaries and affiliates.
> This transmission may contain information that is privileged,
> confidential, legally privileged, and/or exempt from disclosure
> under applicable law. If you are not the intended recipient, you
> are hereby notified that any disclosure, copying, distribution, or
> use of the information contained herein (including any reliance
> thereon) is STRICTLY PROHIBITED. Although this transmission and any
> attachments are believed to be free of any virus or other defect
> that might affect any computer system into which it is received and
> opened, it is the responsibility of the recipient to ensure that it
> is virus free and no responsibility is accepted by JPMorgan Chase &
> Co., its subsidiaries and affiliates, as applicable, for any loss
> or damage arising in any way from its use. If you received this
> transmission in error, please immediately contact the sender and
> destroy the material in its entirety, whether in electronic or hard
> copy format. Thank you.
> Please refer to http://www.jpmorgan.com/pages/disclosures for
> disclosures relating to UK legal entities.
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list