Multiprocessing.Pool makes Numpy matrix multiplication slower

后端 未结 8 2032
感动是毒
感动是毒 2020-11-27 20:05

So, I am playing around with multiprocessing.Pool and Numpy, but it seems I missed some important point. Why is the pool version much

8条回答
  •  孤街浪徒
    2020-11-27 20:42

    Your code is correct. I just ran it my system (with 2 cores, hyperthreading) and obtained the following results:

    $ python test_multi.py 
    30.8623809814
    19.3914041519
    

    I looked at the processes and, as expected, the parallel part showing several processes working at near 100%. This must be something in your system or python installation.

提交回复
热议问题