[SciPy-user] conforming to Python GIL...

Travis E. Oliphant oliphant@enthought....
Fri Apr 4 09:06:00 CDT 2008


Pearu Peterson wrote:
> On Thu, April 3, 2008 10:20 pm, 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 is very bad to hear as the display is not updated (after a window
>> popup, left blank, or one can't handle properties display data).
>>
>>
>> Someone can gives an helping hand on this issue ?
>>     
>
> Have you tried to use f2py `threadsafe` statement when wrapping
> fortran code? With the `threadsafe` statement the fortran call
> will be surrounded with Py_BEGIN_ALLOW_THREADS-Py_END_ALLOW_THREADS block.
>   

I thought there was something like that.   Apparently, the scipy 
interfaces do not use this statement, correct?  Perhaps all code used to 
release the GIL, but then the threadsafe statement was added and now 
none of the scipy-f2py code does.


-Travis O.




More information about the SciPy-user mailing list