Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Advice regarding multiprocessing module

Reply
Thread Tools

Re: Advice regarding multiprocessing module

 
 
Dave Angel
Guest
Posts: n/a
 
      03-11-2013
On 03/11/2013 01:57 AM, Abhinav M Kulkarni wrote:
>
>
> <SNIP>
> * My laptop has quad-core Intel i5 processor, so I thought using
> multiprocessing module I can parallelize my code (basically
> calculate gradient in parallel on multiple cores simultaneously).

<SNIP>
> * As a result I end up creating a process for each data point (instead
> of a thread that I would ideally like to do, so as to avoid process
> creation overhead).


Seems you only need 4 processes, as you have 4 cores. Instead of
creating a new one each time, reuse the same 4 processes, letting each
do a quarter of the data.

It's not the process creation that's particularly slow, but all the
initialization of starting another instance of Python. If you're on
Linux, you might be able to speed that up by using fork, but I don't
specifically know.



--
DaveA
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Advice regarding multiprocessing module Oscar Benjamin Python 0 03-11-2013 03:58 PM
Re: Advice regarding multiprocessing module Abhinav M Kulkarni Python 0 03-11-2013 02:57 PM
Advice regarding multiprocessing module Abhinav M Kulkarni Python 0 03-11-2013 05:57 AM
Question regarding multiprocessing and error: Can't pickle <type tleeuwenburg@gmail.com Python 1 10-14-2009 05:11 AM
multiprocessing module (PEP 371) sturlamolden Python 6 06-08-2008 04:33 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57