High multi-threading using Python
I want to running large-scale mathematical operations using Python multi-threading; I need software for many computer to do this. What is the best way?
Thanks.
This is my idea:
- use c to开发者_如何转开发 handle the core code of python
- setup a software to handle the multi-threading
- and so on
You should check this Post regarding parallel and cluster computing, as for using c check Cython
Python threads are good for IO bound loads, but CPU bound loads end up fighting over processor time as the global interpreter lock forces all threads to execute one at a time even on a multi core machine. You would be better looking at the multiprocessing module and deploying as many processes as you need and have them talk with pipes or sockets(if you are using a cluster).
IPython has a module for parallel computing that sounds like it would fit the bill.
精彩评论