[Cython] Another CEP: Parallel block

2011-04-05 Thread Dag Sverre Seljebotn
There's a (much shorter) proposal for a more explicit parallelism construct at http://wiki.cython.org/enhancements/parallelblock This is a little more verbose for the simplest case, but makes the medium-cases that needs work buffers much simpler, and is also more explicit and difficult to get

Re: [Cython] Another CEP: Parallel block

2011-04-05 Thread mark florisson
On 5 April 2011 09:21, Dag Sverre Seljebotn wrote: > There's a (much shorter) proposal for a more explicit parallelism construct > at > > http://wiki.cython.org/enhancements/parallelblock > > This is a little more verbose for the simplest case, but makes the > medium-cases that needs work buffers

Re: [Cython] Another CEP: Parallel block

2011-04-05 Thread Stefan Behnel
mark florisson, 05.04.2011 10:26: On 5 April 2011 09:21, Dag Sverre Seljebotn wrote: Justification for Cython-specific syntax: This is something that is really only useful if you can release the GIL *outside* of the loop. So I feel this is an area where a custom Cython solution is natural, sort

Re: [Cython] Another CEP: Parallel block

2011-04-05 Thread mark florisson
On 5 April 2011 10:34, Stefan Behnel wrote: > mark florisson, 05.04.2011 10:26: >> >> On 5 April 2011 09:21, Dag Sverre Seljebotn wrote: >>> >>> Justification for Cython-specific syntax: This is something that is >>> really >>> only useful if you can release the GIL *outside* of the loop. So I fee

Re: [Cython] Another CEP: Parallel block

2011-04-05 Thread mark florisson
On 5 April 2011 10:44, mark florisson wrote: > On 5 April 2011 10:34, Stefan Behnel wrote: >> mark florisson, 05.04.2011 10:26: >>> >>> On 5 April 2011 09:21, Dag Sverre Seljebotn wrote: Justification for Cython-specific syntax: This is something that is really only useful if

Re: [Cython] Another CEP: Parallel block

2011-04-05 Thread Stefan Behnel
mark florisson, 05.04.2011 10:44: On 5 April 2011 10:34, Stefan Behnel wrote: mark florisson, 05.04.2011 10:26: On 5 April 2011 09:21, Dag Sverre Seljebotn wrote: Justification for Cython-specific syntax: This is something that is really only useful if you can release the GIL *outside* of th

Re: [Cython] Another CEP: Parallel block

2011-04-05 Thread mark florisson
On 5 April 2011 11:01, Stefan Behnel wrote: > mark florisson, 05.04.2011 10:44: >> >> On 5 April 2011 10:34, Stefan Behnel wrote: >>> >>> mark florisson, 05.04.2011 10:26: On 5 April 2011 09:21, Dag Sverre Seljebotn wrote: > > Justification for Cython-specific syntax: This is som

Re: [Cython] Another CEP: Parallel block

2011-04-05 Thread Dag Sverre Seljebotn
On 04/05/2011 11:01 AM, Stefan Behnel wrote: mark florisson, 05.04.2011 10:44: On 5 April 2011 10:34, Stefan Behnel wrote: mark florisson, 05.04.2011 10:26: On 5 April 2011 09:21, Dag Sverre Seljebotn wrote: Justification for Cython-specific syntax: This is something that is really only use

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread Stefan Behnel
mark florisson, 04.04.2011 21:26: For clarity, I'll add an example: def f(np.ndarray[double] x, double alpha): cdef double s = 0 cdef double tmp = 2 cdef double other = 6.6 with nogil: for i in prange(x.shape[0]): # reading 'tmp' makes it firstprivate i

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread mark florisson
On 5 April 2011 12:51, Stefan Behnel wrote: > mark florisson, 04.04.2011 21:26: >> >> For clarity, I'll add an example: >> >> def f(np.ndarray[double] x, double alpha): >>     cdef double s = 0 >>     cdef double tmp = 2 >>     cdef double other = 6.6 >> >>     with nogil: >>         for i in pran

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread Pauli Virtanen
Mon, 04 Apr 2011 21:26:34 +0200, mark florisson wrote: [clip] > For clarity, I'll add an example: [clip] How about making all the special declarations explicit? The automatic inference of variables has a problem in that a small change in a part of the code can have somewhat unintuitive non-local

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread Pauli Virtanen
Tue, 05 Apr 2011 12:55:36 +, 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 > a

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread mark florisson
On 5 April 2011 14:55, Pauli Virtanen wrote: > > Mon, 04 Apr 2011 21:26:34 +0200, mark florisson wrote: > [clip] > > For clarity, I'll add an example: > [clip] > > How about making all the special declarations explicit? The automatic > inference of variables has a problem in that a small change in

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread mark florisson
On 5 April 2011 15:10, Pauli Virtanen wrote: > Tue, 05 Apr 2011 12:55:36 +, Pauli Virtanen wrote: > [clip] >>             # Assignment to non-private variables causes a compile-time >>             # error; this avoids common mistakes, such as forgetting to >>             # declare the reductio

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread Robert Bradshaw
On Tue, Apr 5, 2011 at 3:51 AM, Stefan Behnel wrote: > mark florisson, 04.04.2011 21:26: >> >> For clarity, I'll add an example: >> >> def f(np.ndarray[double] x, double alpha): >>     cdef double s = 0 >>     cdef double tmp = 2 >>     cdef double other = 6.6 >> >>     with nogil: >>         for

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread Dag Sverre Seljebotn
On 04/05/2011 04:53 PM, Robert Bradshaw wrote: On Tue, Apr 5, 2011 at 3:51 AM, Stefan Behnel wrote: mark florisson, 04.04.2011 21:26: For clarity, I'll add an example: def f(np.ndarray[double] x, double alpha): cdef double s = 0 cdef double tmp = 2 cdef double other = 6.6

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread Robert Bradshaw
On Tue, Apr 5, 2011 at 4:52 AM, mark florisson wrote: > On 5 April 2011 12:51, Stefan Behnel wrote: >> mark florisson, 04.04.2011 21:26: >>> >>> For clarity, I'll add an example: >>> >>> def f(np.ndarray[double] x, double alpha): >>>     cdef double s = 0 >>>     cdef double tmp = 2 >>>     cdef

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread Dag Sverre Seljebotn
On 04/05/2011 04:58 PM, Dag Sverre Seljebotn wrote: On 04/05/2011 04:53 PM, Robert Bradshaw wrote: On Tue, Apr 5, 2011 at 3:51 AM, Stefan Behnel wrote: mark florisson, 04.04.2011 21:26: For clarity, I'll add an example: def f(np.ndarray[double] x, double alpha): cdef double s = 0 c

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread Robert Bradshaw
On Tue, Apr 5, 2011 at 5:55 AM, Pauli Virtanen wrote: > Mon, 04 Apr 2011 21:26:34 +0200, mark florisson wrote: > [clip] >> For clarity, I'll add an example: > [clip] > > How about making all the special declarations explicit? The automatic > inference of variables has a problem in that a small cha

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread Robert Bradshaw
On Tue, Apr 5, 2011 at 8:02 AM, Dag Sverre Seljebotn wrote: > On 04/05/2011 04:58 PM, Dag Sverre Seljebotn wrote: >> >> On 04/05/2011 04:53 PM, Robert Bradshaw wrote: >>> >>> On Tue, Apr 5, 2011 at 3:51 AM, Stefan Behnel >>>  wrote: mark florisson, 04.04.2011 21:26: > > For clari

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread Dag Sverre Seljebotn
On 04/05/2011 05:26 PM, Robert Bradshaw wrote: On Tue, Apr 5, 2011 at 8:02 AM, Dag Sverre Seljebotn wrote: On 04/05/2011 04:58 PM, Dag Sverre Seljebotn wrote: On 04/05/2011 04:53 PM, Robert Bradshaw wrote: On Tue, Apr 5, 2011 at 3:51 AM, Stefan Behnel wrote: mark florisson, 04.04.2011 21:

Re: [Cython] CEP: prange for parallel loops

2011-04-05 Thread mark florisson
On 5 April 2011 18:32, Dag Sverre Seljebotn wrote: > On 04/05/2011 05:26 PM, Robert Bradshaw wrote: >> >> On Tue, Apr 5, 2011 at 8:02 AM, Dag Sverre Seljebotn >>  wrote: >>> >>> On 04/05/2011 04:58 PM, Dag Sverre Seljebotn wrote: On 04/05/2011 04:53 PM, Robert Bradshaw wrote: >

[Cython] prange CEP updated

2011-04-05 Thread Dag Sverre Seljebotn
I've done a pretty major revision to the prange CEP, bringing in a lot of the feedback. Thread-private variables are now split in two cases: i) The safe cases, which really require very little technical knowledge -> automatically inferred ii) As an advanced feature, unsafe cases that requi

Re: [Cython] prange CEP updated

2011-04-05 Thread Dag Sverre Seljebotn
On 04/05/2011 10:29 PM, Dag Sverre Seljebotn wrote: I've done a pretty major revision to the prange CEP, bringing in a lot of the feedback. Thread-private variables are now split in two cases: i) The safe cases, which really require very little technical knowledge -> automatically inferred