简体   繁体   English

我应该针对 R 中的多个物理内核或多个线程进行并行计算吗?

[英]Should I aim for multiple physical cores or multiple threads for parallel computing in R?

I am new to parallel computing and this may be a trivial question.我是并行计算的新手,这可能是一个微不足道的问题。 I am thinking about which processor to choose for parallel computing (on a single machine)?我正在考虑选择哪个处理器进行并行计算(在单台机器上)? In particular, I would like to know whether I should aim for a high number (physical) cores or a high number of threads ?特别是,我想知道我应该瞄准大量(物理)内核还是大量线程

I am working with R (package parallel ) on Windows.我正在 Windows 上使用 R( parallel包)。 Typically, the datasets are not large, so the limit is not the memory but the number and duration of independent processes run on the data.通常,数据集并不大,因此限制不是 memory,而是在数据上运行的独立进程的数量和持续时间。

I understood that parallel makes use of logical cores (ie, hardware threads) but that such threads do not work truly in parallel because they share “execution resources” https://en.wikipedia.org/wiki/Hyper-threading .我知道parallel使用逻辑内核(即硬件线程),但这些线程并不能真正并行工作,因为它们共享“执行资源” https://en.wikipedia.org/wiki/Hyper-threading So, would eg, 4 (physical) cores with 1 thread each result in more speed (throughput) than 2 (physical) cores with 2 threads each (ie, 4 logical cores)?那么,例如,每个具有 1 个线程的 4 个(物理)内核会比每个具有 2 个线程(即 4 个逻辑内核)的 2 个(物理)内核产生更高的速度(吞吐量)吗?

Suggestions on specific processors are also more than welcome.对特定处理器的建议也非常受欢迎。

For memory or I/O intensive workloads, a HT enabled processor provides better performance and power efficiency, at lower cost.对于 memory 或 I/O 密集型工作负载,支持 HT 的处理器以更低的成本提供更好的性能和能效。 For compute intensive workloads, possible gain due to additional logical threads reduces.对于计算密集型工作负载,由于额外的逻辑线程而可能获得的收益会减少。 Your application seems to be compute intensive.您的应用程序似乎是计算密集型的。 If that is the only kind of workload the system has to execute, you can look for system with higher number of physical core processors.如果这是系统必须执行的唯一工作负载,您可以寻找具有更多物理核心处理器的系统。

The problem is there are limited number of processor which doesn't support logical threads.问题是不支持逻辑线程的处理器数量有限。 Most of the processor from Intel support Hyper-threading.英特尔的大多数处理器都支持超线程。 Cost of with and without HT processors is not very different.使用和不使用 HT 处理器的成本差别不大。 With a HT enabled processor a system can handle more diverse workloads.使用支持 HT 的处理器,系统可以处理更多不同的工作负载。 It can multitask more efficiently.它可以更有效地进行多任务处理。

It is possible to disable HT by configuring the BIOS.可以通过配置 BIOS 来禁用 HT。

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

相关问题 在R中并行计算时更改核心数 - Changing the number of cores while parallel computing in R R中的并行计算:如何使用核心 - Parallel Computing in R : how to use the cores 什么时候(如果有的话)我应该告诉R parallel不使用所有内核? - When (if ever) should I tell R parallel to not use all cores? 使用foreach和控制核心数并行运行多个R脚本 - Run multiple R scripts in parallel using foreach and controlling number of cores R并行计算:选择要分配到核心中的对象 - R Parallel computing: select which objects to be distributed into cores 通过doSNOW包进行R并行计算,注册了进程但不占用CPU内核 - R parallel computing by doSNOW package, processes registered but not consuming CPU cores R 的 `parallel::detectCores` 用于检测 Linux 上的物理内核 - R's `parallel::detectCores` to detect physical cores on Linux 如何计算R中每人的多个观察数据以计算OLS和分位数回归? - How should I structure my multiple observations per person data in R for computing OLS and quantile regression? R foreach不使用多核 - R foreach not using multiple cores 使用R中的多个线程/核心以压缩形式保存对象的方法是什么? - What is the method to save objects in a compressed form using multiple threads/cores in R?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM