1

As I understand it, python uses only one core of the CPU (?)

Does numpy use more cores to speed up calculations?

Reason for my question: I plan to buy a computer, and would like to know what CPU is best for fast numpy ( and scipy) calculations.

Michael Szczesny
  • 4,911
  • 5
  • 15
  • 32
  • `numpy` delegates some basic computations to an appropriate [BLAS](https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms) call with multicore support, if available. `numpy` functions implemented in pure `numpy` or `python` typically do not use multiple cores. – Michael Szczesny Jan 06 '23 at 13:45
  • Same question recently [here](https://stackoverflow.com/questions/75023567/why-isnt-numpy-using-more-than-one-thread-for-array-creation-manipulation) (see the comment). There is also [this](https://stackoverflow.com/questions/16617973/why-isnt-numpy-mean-multithreaded?noredirect=1&lq=1) related question. There are few other like this with the same similar answers. – Jérôme Richard Jan 06 '23 at 19:55
  • As for the last question: it is a good idea to have at least 2 memory channels since Numpy codes tends to be memory bound otherwise (thanks to SIMD instructions). A big-little CPU with few cores is certainly the best. For example, an Intel Alder Lake CPU with 2 DDR5 channels. Alternatively, an Apple M2 should do the job also pretty well (AFAIK, it can reach a high memory throughput >80 GiB/s with only 1 core). – Jérôme Richard Jan 06 '23 at 20:01

1 Answers1

0

As I understand it, python uses only one core of the CPU (?)

Yes, plain Python only uses one core.

Does numpy use more cores to speed up calculations?

If you want to parallelize your computations, take a look at Numba. The goal is to parallelize Numpy calculations with little change to the code.

https://numba.pydata.org/

soegaard
  • 30,661
  • 4
  • 57
  • 106