[Cython] Cython 0.15rc2 and parallelization issue

Stefan Behnel stefan_ml at behnel.de
Wed Aug 3 14:27:02 CEST 2011


Francesc Alted, 03.08.2011 14:18:
> 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

That's because it does not declare that it does not require the GIL. Use 
the "nogil" annotation at the end of the function signature.

Stefan


More information about the cython-devel mailing list