[英]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.