From: Konrad H. <hi...@cn...> - 2003-05-06 10:26:39
|
On Wednesday 30 April 2003 08:47, Andrew P. Lentvorski, Jr. wrote: > 1) Does numpy (or numarray) release the Python GIL? No. > 2) If not, why not? Is this simply something I could fix by making the > changes myself, or are there larger reasons for not releasing the GIL? There is one good reason, which is that the GIL release code doesn't nest= =2E If=20 NumPy released the GIL during its operations, then any C code that uses N= umPy=20 functions would have to reacquire the GIL before calling NumPy, then=20 re-release the GIL afterwards. In most real-life situations, it is simple= r=20 and presumably more efficient to release the GIL once for a block of=20 numerical computations, which would include many calls to NumPy functions= =2E One could of course release the GIL not within the functions that are par= t of=20 the NumPy C API, but in a thin wrapper around it that is directly called = from=20 Python. The only other problem that I see is the general object type arrays, whic= h=20 make calls back into the Python interpreter. Konrad. --=20 -------------------------------------------------------------------------= ------ Konrad Hinsen | E-Mail: hi...@cn... Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais -------------------------------------------------------------------------= ------ |