0

I am trying to do multiprocessing using Python. I have access to 4 x 24Core CPUs.

When I try and detect the amount of CPU using code:

import multiprocessing as mp
mp.cpu_count()

It returns 4 rather than 96, is there any way of making Python detect all 96 cores?

Ben Watson
  • 29
  • 5
  • Does this https://stackoverflow.com/questions/31344582/python-multiprocessing-cpu-count-returns-1-on-4-core-nvidia-jetson-tk1 or https://stackoverflow.com/questions/31346974/portable-way-of-detecting-number-of-usable-cpus-in-python help? If not it probably makes sense if you show how your system is set up. – C Hecht Dec 14 '21 at 16:08
  • also this: https://stackoverflow.com/questions/1006289/how-to-find-out-the-number-of-cpus-using-python – Glauco Dec 14 '21 at 16:13

1 Answers1

0

For python, you can use directly psutil, it is general lib for CPU. I can get the core directly through psutil.cpu_count(). That is the same core I got through htop

dtlam26
  • 1,410
  • 11
  • 19