[R] Programmaticly finding number of processors by R code

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Oct 3 21:55:03 CEST 2010


Without knowing your OS, there is no way anyone can tell you.  And you 
probably want to know 'cores' rather than CPUs. And for some specific 
OSes, you will find answers in the archives.

Beware that this is not a well-defined question: are these 
physical or virtual cores?, and having them in the system and being 
allowed to use them are different questions.

Package 'multicore' is one that attempts to do this in its function 
detectCores (see the source code).  And on Sparc Solaris it is pretty 
useless as it gives virtual CPUs, 8x the number of real CPUs.

On Sun, 3 Oct 2010, Ajay Ohri wrote:

> Dear List
>
> Sorry if this question seems very basic.
>
> Is there a function to pro grammatically find number of processors in
> my system _ I want to pass this as a parameter to snow in some serial
> code to parallel code functions
>
> Regards
>
> Ajay
>
>
>
> Websites-
> http://decisionstats.com
> http://dudeofdata.com
>
>
> Linkedin- www.linkedin.com/in/ajayohri
>
> ______________________________________________
> 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.
>

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



More information about the R-help mailing list