Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multiprocessing python

What are the simplest way to use all cores off a computer for a python program ? In particular, I would want to parallelize a numpy function (which already exists). Is there something like openmp under fortran in python ?

like image 669
PanAkry Avatar asked Mar 12 '12 15:03

PanAkry


2 Answers

Check out the multiprocessing library. It even allows to spread work across multiple computers.

like image 65
rplnt Avatar answered Sep 26 '22 00:09

rplnt


It depends on what you want to do and how numpy is compiled on your machine (in some cases, some multicore use will be automatic). See this page for details.

like image 36
tom10 Avatar answered Sep 26 '22 00:09

tom10