<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Python &#8211; parallelizing CPU-bound tasks with multiprocessing</title>
	<atom:link href="http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/feed/" rel="self" type="application/rss+xml" />
	<link>http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/</link>
	<description>Eli Bendersky&#039;s personal website</description>
	<lastBuildDate>Thu, 23 May 2013 12:12:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: jc RAGRIS</title>
		<link>http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/comment-page-1/#comment-1150993</link>
		<dc:creator>jc RAGRIS</dc:creator>
		<pubDate>Thu, 09 May 2013 08:21:55 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=2793#comment-1150993</guid>
		<description>For a year I follow with interest  the project &quot; Supercomputing for Everyone &quot;:
http://www.parallella.org/
The member of the community are either Developing Support for Python and others language!
I googled the words &quot; Python and parallel processing &quot; and I stumbled upon your site.
I just tested your algorithm on my PC (windows 7 with I7 processor and python 2.7)
With the proposed changes from E.A.Neonakis, the program works perfectly.
I verified the proper operation of the parallelization with the task manager in Windows, and miracle, the work is perfectly balanced between the 8 units of the processor.
With the processing algorithm in series only one  unit works!
For 2 million numbers:
Algorithm series: 22 seconds
Parallel algorithm: 9.2 seconds
Conclusion: your algorithm works perfectly.
Congratulations for your article and your work.
And urges the arrival of the electronic board of the firm Parrallella (only $ 100)!</description>
		<content:encoded><![CDATA[<p>For a year I follow with interest  the project &#8221; Supercomputing for Everyone &#8220;:<br />
<a href="http://www.parallella.org/" rel="nofollow">http://www.parallella.org/</a><br />
The member of the community are either Developing Support for Python and others language!<br />
I googled the words &#8221; Python and parallel processing &#8221; and I stumbled upon your site.<br />
I just tested your algorithm on my PC (windows 7 with I7 processor and python 2.7)<br />
With the proposed changes from E.A.Neonakis, the program works perfectly.<br />
I verified the proper operation of the parallelization with the task manager in Windows, and miracle, the work is perfectly balanced between the 8 units of the processor.<br />
With the processing algorithm in series only one  unit works!<br />
For 2 million numbers:<br />
Algorithm series: 22 seconds<br />
Parallel algorithm: 9.2 seconds<br />
Conclusion: your algorithm works perfectly.<br />
Congratulations for your article and your work.<br />
And urges the arrival of the electronic board of the firm Parrallella (only $ 100)!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph</title>
		<link>http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/comment-page-1/#comment-1082671</link>
		<dc:creator>Joseph</dc:creator>
		<pubDate>Fri, 08 Feb 2013 01:07:42 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=2793#comment-1082671</guid>
		<description>E.A. Neonakis -&gt; Unfortunately, I beat my head against this last snippet of code for about 2 hours before I found your comment.  without `&lt;code&gt;multiprocessing__abENT__#46;&lt;/code&gt;` pre-pending the `&lt;code&gt;Queue()&lt;/code&gt;` creation, the Queue was not being shared between processes.  I could see the values being put in the queue in the `&lt;code&gt;worker()&lt;/code&gt;` threads but the (what turned out to be separate) queue would remain empty from the `&lt;code&gt;mp_factorizer()&lt;/code&gt;` context.</description>
		<content:encoded><![CDATA[<p>E.A. Neonakis -&gt; Unfortunately, I beat my head against this last snippet of code for about 2 hours before I found your comment.  without <code class="backtick">multiprocessing&#46;</code> pre-pending the <code class="backtick">Queue()</code> creation, the Queue was not being shared between processes.  I could see the values being put in the queue in the <code class="backtick">worker()</code> threads but the (what turned out to be separate) queue would remain empty from the <code class="backtick">mp_factorizer()</code> context.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: neo</title>
		<link>http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/comment-page-1/#comment-1062552</link>
		<dc:creator>neo</dc:creator>
		<pubDate>Mon, 14 Jan 2013 15:10:18 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=2793#comment-1062552</guid>
		<description>Thanks for the guide. Thanks also to Neonakis, couldn&#039;t have gotten it to work quickly on windows without his additions.</description>
		<content:encoded><![CDATA[<p>Thanks for the guide. Thanks also to Neonakis, couldn&#8217;t have gotten it to work quickly on windows without his additions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: E.A.Neonakis</title>
		<link>http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/comment-page-1/#comment-994965</link>
		<dc:creator>E.A.Neonakis</dc:creator>
		<pubDate>Fri, 12 Oct 2012 07:56:56 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=2793#comment-994965</guid>
		<description>Thank you for this. Please allow me to comment on the modifications necessary to run under WIndows XP:
1. The worker function must be picklable, so move it outside the mp_factorizer to the top level of the module
2. The module will be imported by the parent proceses, so the code calling mp_factorizer must be guarded inside if __name == &#039;__main__&#039;:
3. The multiprocessing Queue implementation should be used, so out_q = Queue() should be replaced by out_q = multiprocessing.Queue()</description>
		<content:encoded><![CDATA[<p>Thank you for this. Please allow me to comment on the modifications necessary to run under WIndows XP:<br />
1. The worker function must be picklable, so move it outside the mp_factorizer to the top level of the module<br />
2. The module will be imported by the parent proceses, so the code calling mp_factorizer must be guarded inside if __name == &#8216;__main__&#8217;:<br />
3. The multiprocessing Queue implementation should be used, so out_q = Queue() should be replaced by out_q = multiprocessing.Queue()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: slater</title>
		<link>http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/comment-page-1/#comment-984463</link>
		<dc:creator>slater</dc:creator>
		<pubDate>Fri, 21 Sep 2012 06:28:04 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=2793#comment-984463</guid>
		<description>Nice guide to multiprocessing and comparison with threading. Thank you.</description>
		<content:encoded><![CDATA[<p>Nice guide to multiprocessing and comparison with threading. Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eliben</title>
		<link>http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/comment-page-1/#comment-896865</link>
		<dc:creator>eliben</dc:creator>
		<pubDate>Tue, 08 May 2012 05:39:23 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=2793#comment-896865</guid>
		<description>&lt;b&gt;prateek&lt;/b&gt;,

Not sure what you want me to fix. Anyhow, I&#039;m not responsible to keep the DZone mirror updated.

I think I tried having a separate Q for each sub-process, but it didn&#039;t matter in terms of performance so I just went with a single Q for simplicity. You can run your own benchmark to compare the two approaches.</description>
		<content:encoded><![CDATA[<p><b>prateek</b>,</p>
<p>Not sure what you want me to fix. Anyhow, I&#8217;m not responsible to keep the DZone mirror updated.</p>
<p>I think I tried having a separate Q for each sub-process, but it didn&#8217;t matter in terms of performance so I just went with a single Q for simplicity. You can run your own benchmark to compare the two approaches.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prateek</title>
		<link>http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/comment-page-1/#comment-896821</link>
		<dc:creator>prateek</dc:creator>
		<pubDate>Tue, 08 May 2012 03:28:22 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=2793#comment-896821</guid>
		<description>http://python.dzone.com/articles/parallelizing-cpu-bound-tasks

Could you correct this information on this website. I was confused because i read your article here and assumed you created one queue per process. 

Also does this implies that if I create a shared queue per process (which is shared between the process itself and the producer/feeder thread) and put the task on these per process shared queues and finally collect results from them , i can get even better speedup due to lesser contention as compared to one shared queue

Thanks for your prompt reply</description>
		<content:encoded><![CDATA[<p><a href="http://python.dzone.com/articles/parallelizing-cpu-bound-tasks" rel="nofollow">http://python.dzone.com/articles/parallelizing-cpu-bound-tasks</a></p>
<p>Could you correct this information on this website. I was confused because i read your article here and assumed you created one queue per process. </p>
<p>Also does this implies that if I create a shared queue per process (which is shared between the process itself and the producer/feeder thread) and put the task on these per process shared queues and finally collect results from them , i can get even better speedup due to lesser contention as compared to one shared queue</p>
<p>Thanks for your prompt reply</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eliben</title>
		<link>http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/comment-page-1/#comment-896816</link>
		<dc:creator>eliben</dc:creator>
		<pubDate>Tue, 08 May 2012 03:01:58 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=2793#comment-896816</guid>
		<description>&lt;b&gt;prateek&lt;/b&gt;,

No, I just create a single `&lt;code&gt;Queue&lt;/code&gt;` and pass it around to all sub-processes. See this quote from the article:

&lt;blockquote&gt;
The one I’ve chosen is to simply create a Queue, and let each worker process put a result dictionary into it.
&lt;/blockquote&gt;</description>
		<content:encoded><![CDATA[<p><b>prateek</b>,</p>
<p>No, I just create a single <code class="backtick">Queue</code> and pass it around to all sub-processes. See this quote from the article:</p>
<blockquote><p>
The one I’ve chosen is to simply create a Queue, and let each worker process put a result dictionary into it.
</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: prateek</title>
		<link>http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/comment-page-1/#comment-896804</link>
		<dc:creator>prateek</dc:creator>
		<pubDate>Tue, 08 May 2012 02:42:15 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=2793#comment-896804</guid>
		<description>I am new to python , and am slightly confused by the code for multiprocessing. You said that you create  an output queue for each of your process but to me it seems like you just create a shared out_q , that you pass as argument to all the processes and then collect the result from the same shared queue .  
 Could you please give more details on what is shared output queue for all processes and a queue for each processes.
 I am confused about :
for i in range(nprocs):
        resultdict.update(out_q.get())

how does this piece of code can collect results from queue from different processes unless it is a shared queue between every process.</description>
		<content:encoded><![CDATA[<p>I am new to python , and am slightly confused by the code for multiprocessing. You said that you create  an output queue for each of your process but to me it seems like you just create a shared out_q , that you pass as argument to all the processes and then collect the result from the same shared queue .<br />
 Could you please give more details on what is shared output queue for all processes and a queue for each processes.<br />
 I am confused about :<br />
for i in range(nprocs):<br />
        resultdict.update(out_q.get())</p>
<p>how does this piece of code can collect results from queue from different processes unless it is a shared queue between every process.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eliben</title>
		<link>http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/comment-page-1/#comment-815236</link>
		<dc:creator>eliben</dc:creator>
		<pubDate>Sun, 29 Jan 2012 18:58:23 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=2793#comment-815236</guid>
		<description>&lt;b&gt;Antoine&lt;/b&gt;,

Yep, thanks to your new GIL implementation! Well done there ;-) Dave Beazley covers it in one of the presentations on the page I linked to.</description>
		<content:encoded><![CDATA[<p><b>Antoine</b>,</p>
<p>Yep, thanks to your new GIL implementation! Well done there <img src='http://eli.thegreenplace.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  Dave Beazley covers it in one of the presentations on the page I linked to.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
