Python how to parallelize loops

后端 未结 2 918
有刺的猬
有刺的猬 2021-01-27 10:11

I am very new to multi-threading and multi-processing and trying to make for loop parallel. I searched similar questions, and created code based on multiprocessing module.

2条回答
  •  深忆病人
    2021-01-27 11:00

    p.map does the looping for you, so remove the for i in gn:.

    That is, p.map applies fun1 to each element of gen1, so gn is one of those elements.

提交回复
热议问题