[Tutor] No speedup in

Andreas Kostyrka andreas at kostyrka.org
Sat Apr 21 21:35:49 CEST 2007


* Thanos Panousis <pthanos at gmail.com> [070421 19:56]:
> You cannot get around the GIL in python.
> 
> Maybe you could try passing chunks of your matrix that are copies of
> the submatrises you want to multiply using threads. This way it will
> be different objects, thus no GIL....I could be awfully wrong though,
> I am a beginner in threads as well.

That won't help either. The G in GIL stands for global. There are
basically two way around this:

a) use multiple processes (aka fork), and communicate the results back
to the main program.
b) use a C-language level extension to do the heavy lifting, and make
this extension give up the GIL, while doing the heavy lifting.

Andreas

> 
> On 4/21/07, FAN Ying Wai <danfan1981 at yahoo.com> wrote:
> > Hi,
> > I am using Python Thread library for my parallel
> > processing course
> > project. I am doing matrix convolution on a
> > multi-processor machine. I
> > just found out that no speed-up is obtained with
> > threading. It is
> > probably because of something called GIL in Python.
> > How can I get around
> > that GIL and get speed-up?
> > Thanks in advance.
> > Daniel
> >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list