Re: Threaded for loop

2007-01-14 Thread Paul Boddie
[EMAIL PROTECTED] wrote: > > There is a module in development (processing.py) that provides an API like > the threading module but that uses processes under the covers: > > http://mail.python.org/pipermail/python-dev/2006-October/069297.html > > You might find that an interesting alternative.

Re: Threaded for loop

2007-01-14 Thread sturlamolden
John wrote: > I want to do something like this: > > for i = 1 in range(0,N): > for j = 1 in range(0,N): >D[i][j] = calculate(i,j) > > I would like to now do this using a fixed number of threads, say 10 > threads. Why do you want to run this in 10 threads? Do you have 10 CPUs? If you are con

Re: Threaded for loop

2007-01-14 Thread skip
John> Damn! That is bad news. So even if caclulate is independent for John> (i,j) and is computable on separate CPUs (parts of it are CPU John> bound, parts are IO bound) python cant take advantage of this? It will help if parts are I/O bound, presuming the threads which block release

Re: Threaded for loop

2007-01-14 Thread parallelpython
John wrote: > Thanks. Does it matter if I call shell commands os.system...etc in > calculate? > > Thanks, > --j The os.system command neglects important changes in the environment (redirected streams) and would not work with current version of ppsmp. Although there is a very simple workaround: pri

Re: Threaded for loop

2007-01-14 Thread Paul Rubin
"John" <[EMAIL PROTECTED]> writes: > Damn! That is bad news. So even if caclulate is independent for > (i,j) and is computable on separate CPUs (parts of it are CPU bound, > parts are IO bound) python cant take advantage of this? Not at the moment, unless you write C extensions that release the gl

Re: Threaded for loop

2007-01-13 Thread John
Thanks. Does it matter if I call shell commands os.system...etc in calculate? Thanks, --j [EMAIL PROTECTED] wrote: > John wrote: > > I want to do something like this: > > > > for i = 1 in range(0,N): > > for j = 1 in range(0,N): > >D[i][j] = calculate(i,j) > > > > I would like to now do th

Re: Threaded for loop

2007-01-13 Thread John
Damn! That is bad news. So even if caclulate is independent for (i,j) and is computable on separate CPUs (parts of it are CPU bound, parts are IO bound) python cant take advantage of this? Surprised, --j Paul Rubin wrote: > "John" <[EMAIL PROTECTED]> writes: > > I want to do something like this:

Re: Threaded for loop

2007-01-13 Thread John
Damn! That is bad news. So even if caclulate is independent for (i,j) and is computable on separate CPUs (parts of it are CPU bound, parts are IO bound) python cant take advantage of this? Surprised, --Tom Paul Rubin wrote: > "John" <[EMAIL PROTECTED]> writes: > > I want to do something like thi

Re: Threaded for loop

2007-01-13 Thread parallelpython
John wrote: > I want to do something like this: > > for i = 1 in range(0,N): > for j = 1 in range(0,N): >D[i][j] = calculate(i,j) > > I would like to now do this using a fixed number of threads, say 10 > threads. > What is the easiest way to do the "parfor" in python? > > Thanks in advance for

Re: Threaded for loop

2007-01-13 Thread Carl Banks
Dennis Lee Bieber wrote: > On 13 Jan 2007 12:15:44 -0800, "John" <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > > > > > I want to do something like this: > > > > for i = 1 in range(0,N): > > for j = 1 in range(0,N): > >D[i][j] = calculate(i,j) > > > > I would like to now

Re: Threaded for loop

2007-01-13 Thread Paul Rubin
"John" <[EMAIL PROTECTED]> writes: > I want to do something like this: > > for i = 1 in range(0,N): > for j = 1 in range(0,N): >D[i][j] = calculate(i,j) > > I would like to now do this using a fixed number of threads, say 10 > threads. What is the easiest way to do the "parfor" in python? I

Re: Threaded for loop

2007-01-13 Thread skip
John> I want to do something like this: John> for i = 1 in range(0,N): John> for j = 1 in range(0,N): John>D[i][j] = calculate(i,j) John> I would like to now do this using a fixed number of threads, say John> 10 threads. What is the easiest way to do the "parfor" in

Threaded for loop

2007-01-13 Thread John
I want to do something like this: for i = 1 in range(0,N): for j = 1 in range(0,N): D[i][j] = calculate(i,j) I would like to now do this using a fixed number of threads, say 10 threads. What is the easiest way to do the "parfor" in python? Thanks in advance for your help, --j -- http://ma