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.
What's wrong with cpu_count()
?
You have 4 physical cores, but 8 logical processors. For example, you may have a processor with hyper-threading .
From SuperUser: Difference Between Cores and Processors
你有什么CPU,它可能是计算物理核心+虚拟核心。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.