deciding among subprocess, multiprocessing, and thread in Python?

后端 未结 5 837
感情败类
感情败类 2020-11-29 15:10

I\'d like to parallelize my Python program so that it can make use of multiple processors on the machine that it runs on. My parallelization is very simple, in that all the

5条回答
  •  一向
    一向 (楼主)
    2020-11-29 15:34

    Shell out and let the unix out to do your jobs:

    use iterpipes to wrap subprocess and then:

    From Ted Ziuba's site

    INPUTS_FROM_YOU | xargs -n1 -0 -P NUM ./process #NUM parallel processes

    OR

    Gnu Parallel will also serve

    You hang out with GIL while you send the backroom boys out to do your multicore work.

提交回复
热议问题