[Cython] CEP: prange for parallel loops

mark florisson markflorisson88 at gmail.com
Tue Apr 5 15:57:50 CEST 2011


On 5 April 2011 15:10, Pauli Virtanen <pav at iki.fi> wrote:
> Tue, 05 Apr 2011 12:55:36 +0000, Pauli Virtanen wrote:
> [clip]
>>             # Assignment to non-private variables causes a compile-time
>>             # error; this avoids common mistakes, such as forgetting to
>>             # declare the reduction variable.
>>             alpha += 42
>>             alpha123 = 9
>>             ptr = 94
>
> Actually, I'm not sure this is absolutely necessary -- life is tough,
> especially if you are programming in parallel, and there are limits to
> hand-holding.
>
> However, an explicit declaration could be added for turning the error off
> for the (rare) cases where this makes sense (e.g. setting a shared flag)
>
>        cdef cython.parallel.shared[double] some_flag

I think that unless we add support for critical, single or master
sections, or the atomic construct, we should also disallow assigning
to shared variables entirely.

> --
> Pauli Virtanen
>
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> http://mail.python.org/mailman/listinfo/cython-devel
>


More information about the cython-devel mailing list