Re: run a function in another processor in python

2010-12-13 Thread News123
On 12/09/2010 10:54 AM, Astan Chee wrote: > Hi, > I've got a python script that calls a function many times with various > arguments and returns a result. What I'm trying to do is run this > function each on different processors and compile the result at the > end based on the function result. The

Re: run a function in another processor in python

2010-12-11 Thread Peter Otten
Astan Chee wrote: > Sorry about that, here is a summary of my complete code. I haven't cleaned > it up much or anything, but this is what it does: > > import time > import multiprocessing > > test_constx =0 > test_consty =0 > > def functionTester(x): > global test_constx You don't need to de

Re: run a function in another processor in python

2010-12-10 Thread Astan Chee
Sorry about that, here is a summary of my complete code. I haven't cleaned it up much or anything, but this is what it does: import time import multiprocessing test_constx =0 test_consty =0 def functionTester(x): global test_constx global test_consty print "constx " + str(test_constx) pr

Re: run a function in another processor in python

2010-12-10 Thread Peter Otten
geremy condra wrote: > On Fri, Dec 10, 2010 at 4:42 AM, Astan Chee wrote: >> On Fri, Dec 10, 2010 at 1:37 AM, Peter Otten <__pete...@web.de> wrote: >>> >>> I can't replicate the crash. However, your problem looks like there is a >>> ready-to-use solution: >>> >>> >>> http://docs.python.org/librar

Re: run a function in another processor in python

2010-12-10 Thread geremy condra
On Fri, Dec 10, 2010 at 4:42 AM, Astan Chee wrote: > On Fri, Dec 10, 2010 at 1:37 AM, Peter Otten <__pete...@web.de> wrote: >> >> I can't replicate the crash. However, your problem looks like there is a >> ready-to-use solution: >> >> >> http://docs.python.org/library/multiprocessing.html#using-a-

Re: run a function in another processor in python

2010-12-10 Thread MRAB
On 10/12/2010 17:52, Dennis Lee Bieber wrote: On Fri, 10 Dec 2010 23:02:24 +1100, Astan Chee declaimed the following in gmane.comp.python.general: for thread in threads: if not thread.is_alive(): threads.remove(thread) I can see a potential flaw ju

Re: run a function in another processor in python

2010-12-10 Thread Astan Chee
On Fri, Dec 10, 2010 at 1:37 AM, Peter Otten <__pete...@web.de> wrote: > I can't replicate the crash. However, your problem looks like there is a > ready-to-use solution: > > http://docs.python.org/library/multiprocessing.html#using-a-pool-of-workers > > -- > http://mail.python.org/mailman/listinf

Re: run a function in another processor in python

2010-12-10 Thread Astan Chee
I just saw this: http://bugs.python.org/issue8094 which seem to be similar to what I'm having. Does anyone know if there is a fix for it? Thanks again On Fri, Dec 10, 2010 at 11:02 PM, Astan Chee wrote: > Thanks for that. I'll try and see if it makes any difference but I'm using > python 2.6 not

Re: run a function in another processor in python

2010-12-10 Thread Astan Chee
Thanks for that. I'll try and see if it makes any difference but I'm using python 2.6 not 3 Are the multiprocessing modules different? That code (or whatever is using the multiprocessing module) seems to cause infinite python processes on my machine and eventually kills it. I'm running python 2.6 o

Re: run a function in another processor in python

2010-12-09 Thread geremy condra
On Thu, Dec 9, 2010 at 5:03 AM, Astan Chee wrote: > Thanks but I'm having trouble with that module too. Currently what I > have is something like this: > > import sys > import os > import multiprocessing > > import time > > def functionTester(num): >    return ((num+2)/(num-2))**2 > > num_args = [

Re: run a function in another processor in python

2010-12-09 Thread Peter Otten
Astan Chee wrote: > Thanks but I'm having trouble with that module too. Currently what I > have is something like this: > > import sys > import os > import multiprocessing > > import time > > def functionTester(num): > return ((num+2)/(num-2))**2 > > num_args = [61,62,33,7,12,16,19,35,36,3

Re: run a function in another processor in python

2010-12-09 Thread Astan Chee
Thanks but I'm having trouble with that module too. Currently what I have is something like this: import sys import os import multiprocessing import time def functionTester(num): return ((num+2)/(num-2))**2 num_args = [61,62,33,7,12,16,19,35,36,37,38,55,56,57,63] max_result = 0 start = ti

Re: run a function in another processor in python

2010-12-09 Thread Jean-Michel Pichavant
Astan Chee wrote: Hi, I've got a python script that calls a function many times with various arguments and returns a result. What I'm trying to do is run this function each on different processors and compile the result at the end based on the function result. The script looks something like this

run a function in another processor in python

2010-12-09 Thread Astan Chee
Hi, I've got a python script that calls a function many times with various arguments and returns a result. What I'm trying to do is run this function each on different processors and compile the result at the end based on the function result. The script looks something like this: import time def