简体   繁体   English

多CPU Windows机器上的R并行

[英]R parallel on multi-CPU Windows machine

Will R properly recognize all the cores on a multi-CPU Windows 10 Pro 64-bit machine? R是否可以正确识别多CPU Windows 10 Pro 64位计算机上的所有内核? We are designing a parallel computing system with Intel CPUs, using two CPUs on one mainboard. 我们正在设计一个带有Intel CPU的并行计算系统,在一块主板上使用两个CPU。 There will be a total of 32 cores between the 2 CPUs (8 physical cores per CPU, up to 16 logical cores per CPU). 2个CPU之间总共有32个内核(每个CPU 8个物理内核,每个CPU最多16个逻辑内核)。

Before we spend the money, I want some confirmation that my R code will recognize and access all (or nearly all) the cores (usually, I put all but 1 into a cluster). 在花钱之前,我想先确认一下我的R代码将识别并访问所有(或几乎所有)内核(通常,我将除1之外的所有内核放入群集中)。 I am using R doParallel and foreach packages successfully on a Win 10 Pro 64-bit workstation with a single 4-core CPU with 8 logical cores. 我正在带有单个8核CPU的4核CPU的Win 10 Pro 64位工作站上成功使用R doParallel和foreach软件包。 I can run my R code and request 7 cores with no trouble. 我可以运行我的R代码并毫无问题地请求7个内核。

You should be able to use all of your cores in R. R successfully recognizes all available cores on both my laptop and my data science server. 您应该能够使用R中的所有内核。R成功地识别了我的笔记本电脑和数据科学服务器上的所有可用内核。

Once you have access to one of the computers you want to use, you can find out how many cores R recognizes with the detectCores() function from the parallel package. 一旦可以访问要使用的计算机之一,就可以从parallel程序包中找到R通过detectCores()函数可以识别多少个内核。

library(parallel)
detectCores()

Taking a step back, you might want to reconsider the architecture of your system. 退后一步,您可能需要重新考虑系统的体系结构。 If you have to run something so intense that it requires a battalion of multithreaded machines, you might want to think about rewriting your code to be more efficient or possibly integrate Rcpp or move to a different language. 如果您必须运行非常激烈的程序以至于需要一个多线程计算机营,那么您可能要考虑重写代码以提高效率,或者可能集成Rcpp或使用其他语言。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM