Parallelism in Python

后端 未结 5 972
星月不相逢
星月不相逢 2021-01-07 17:19

What are the options for achieving parallelism in Python? I want to perform a bunch of CPU bound calculations over some very large rasters, and would like to parallelise th

5条回答
  •  有刺的猬
    2021-01-07 18:07

    Generally, you describe a CPU bound calculation. This is not Python's forte. Neither, historically, is multiprocessing.

    Threading in the mainstream Python interpreter has been ruled by a dreaded global lock. The new multiprocessing API works around that and gives a worker pool abstraction with pipes and queues and such.

    You can write your performance critical code in C or Cython, and use Python for the glue.

提交回复
热议问题