[Tutor] multiprocessing for nested function
tax botsis
taxbotsis at gmail.com
Tue May 17 21:40:53 CEST 2011
I am trying to start multiple instances using a for statement but this is
not working. Has anyone tried affinity module?
Tax
2011/5/17 Emile van Sebille <emile at fenx.com>
> On 5/17/2011 7:29 AM tax botsis said...
>
> Part of my code includes the following script, which both shows a
>> progress bar (for as long as 'categorize_reports()' is executed) and
>> prints the fileid and the output of the 'document' function; the latter
>> is the one increasing the calculation time (please see my comment). Any
>> ideas on how to use all the cores of my CPU here?
>>
>
> A python instance lives it life on a single processor. Accessing multiple
> cores requires you start multiple python instances. You'd need to
> restructure to provide some form of cooperative independent processing.
> Pyro, stackless, and twisted come to mind. It looks like
> the info at http://wiki.python.org/moin/ParallelProcessing is more up to
> date than my memory...
>
> Emile
>
>
>
>
>> ...
>> def categorize_reports():
>> if __name__ == '__main__':
>> root2 = Tkinter.Tk(className=' Processing Progress')
>> m = Meter(root2, relief='ridge', bd=3)
>> m.pack(fill='x')
>> i=0.0
>> for fileid in fileids():
>> m.set(i, 'Processing will take a few minutes...')
>> i=i+1.000/len(fileids())
>> m.after(1000, lambda: _demo(m, i))
>> print str(fileid), document(fileid) #this slows down the
>> process
>> root2.withdraw()
>> ...
>>
>> Thanks
>> Tax
>>
>>
>>
>> _______________________________________________
>> Tutor maillist - Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>>
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110517/82d96304/attachment.html>
More information about the Tutor
mailing list