[英]multiprocessing.cpu_count returning wrong number of cores
I try to use the following code to decide the number of cores of my laptop: 我尝试使用以下代码来确定笔记本电脑的核心数量:
import multiprocessing
multiprocessing.cpu_count()
The result is 8, but when I open the system report, I can see that I have only 1 CPU with 4 cores. 结果是8,但是当我打开系统报告时,我可以看到我只有1个带有4个内核的CPU。
What's wrong with cpu_count()
? cpu_count()
什么问题?
You have 4 physical cores, but 8 logical processors. 您有4个物理内核,但有8个逻辑处理器。 For example, you may have a processor with hyper-threading .
例如,您可能拥有一个具有超线程的处理器。
From SuperUser: Difference Between Cores and Processors 来自SuperUser: 核心和处理器之间的差异
你有什么CPU,它可能是计算物理核心+虚拟核心。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.