[Cython] Cython 0.15rc2 and parallelization issue
Francesc Alted
faltet at pytables.org
Wed Aug 3 14:18:16 CEST 2011
Hi,
I'm trying to take advantage of the exciting new parallelizing
capabilities recently introduced in forthcoming 0.15 version, but I'm
having a small difficulty. When I try to compile a small demo routing
(attached), I'm getting this error:
$ cython -a mandel.pyx
Error compiling Cython file:
------------------------------------------------------------
...
for pix in prange(num_pixels, nogil=True, schedule="dynamic"):
x = pix % width
y = pix // width
cr = begin_r + (x * span_r / (width + 1.0))
ci = begin_i + (y * span_i / (height + 1.0))
n = MandelbrotCalculate(cr, ci, maxiter)
^
------------------------------------------------------------
mandel.pyx:50:31: Calling gil-requiring function not allowed without gil
While trying to figure out why MandelbrotCalculate does require GIL, I
replaced the "for prange", by a trivial "for range", and the
annotated HTML source reveals that the only line in (light) yellow in
this function is
return n
which is translated as:
/* "mandel.pyx":22
* ti = 2*zr*zi + ci
* zr, zi = tr, ti
* return n # <<<<<<<<<<<<<<
*
* @cython.boundscheck(False)
*/
__pyx_r = __pyx_v_n;
goto __pyx_L0;
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
My guess is that this __Pyx_RefNannyFinishContext() call is preventing
to call the routing from the parallel loop. Is that a bug, a
limitation of current implementation or it is just that I'm missing
something?
Thanks,
--
Francesc Alted
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mandel.pyx
Type: application/octet-stream
Size: 1631 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20110803/cb6d697d/attachment.obj>
More information about the cython-devel
mailing list