[CentralOH] Fwd: Re: Stackless Python

Bryan Harris bryan.harris at udri.udayton.edu
Wed Oct 28 22:30:12 CET 2009

The processing module sticks each thread in a different python process.  The 
syntax is identical to the threading library so it's two lines of code to 
switch from threating to processing.  I'm going to try that and see how much 
better it does.

import processing as threading
from processing import Process as Thread

I'll check back with benchmarks.

Bryan Harris
Research Engineer
Structures and Materials Evaluation Group
bryan.harris at udri.udayton.edu
(937) 229-5561
On Wednesday 28 October 2009 05:16:56 pm you wrote:
> I should take my own advice :)
> The GIL *won't* let python threads run across multiple cores, so even if
> the os thread model supports it, cpython can't take advantage. I didn't
> realize the GIL was that intrusive.
> You could try running your app in Jython which does not have a GIL.
> Or rewrite it to use multiple processes.
> On Wed, Oct 28, 2009 at 5:03 PM, Bryan Harris
> <bryan.harris at udri.udayton.edu
> > wrote:
> > >Maybe if you let the group know the problem you need to solve, someone
> > > can provide some better direction.
> >
> > I have written a long script which takes a whole directory of
> > stress-strain test data, massages it, and spits out a new data file along
> > with a bunch of images of the results. I wrote a multi-threaded version a
> > while back, but it actually ran much slower than the single thread
> > version and I noticed it never used more than one processor at a time.
> >
> >
> > Maybe I did something wrong. It performed slower on a single or a
> > multiprocessor machine. I noticed the same behavior on my development
> > machine, Ubuntu linux and on a windows machine in the lab. In theory, it
> > ought to be able to do file i/o on one file while the other crunches on
> > calculations, thus saving time. It didn't work that way though.
> >
> >
> >
> >
> > _______________________________________________
> > CentralOH mailing list
> > CentralOH at python.org
> > http://mail.python.org/mailman/listinfo/centraloh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/mailman/private/centraloh/attachments/20091028/81fe1689/attachment-0001.htm>

More information about the CentralOH mailing list