[Numpy-discussion] [SciPy-user] conforming to Python GIL...
Thu Apr 3 15:25:17 CDT 2008
On 03/04/2008, Travis E. Oliphant <email@example.com> wrote:
> fred wrote:
> > Hi,
> > I use a lot of ConVeX OPTimsation and fortran (via f2py) routines in my
> > Traits app.
> > As I want to compute the data and want to display them, I use threads.
> > The issue I get is that data displayed (using Chaco2) are not updated
> > (app is frozen) while computing the input data.
> > From D. Morrill's answer (the Traits guru ;-)), it appears that cvxopt
> > (and solve() from scipy, in fact) and fortran modules does not release
> > the "Python GIL (Global Intepreter Lock)".
> This requires a bit of effort to solve. We need to in multiple places...
> 1) release the GIL
> 2) put semaphores into code that is not thread-safe.
> f2py should be modified to handle this. Other could should be
> modified to handle it as well.
> I suspect NumPy should grow an API to handle the semaphore thing easily
> (I think Python already has one), so these may be able to be wrapped
> into the MACROS already available for releasing the GIL.
What is the story on f2py's releasing of the GIL? I had understood
that wrapper code was able to declare the wrapped code to be
thread-safe, so that the GIL was released while it executed. Is the
problem here that cvxopt is not threadsafe? I guess the best solution
then is to make a cvxopt- (and related routines)-specific lock?
More information about the Numpy-discussion