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: >

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 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 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 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 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: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 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 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 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 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 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 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 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-04 Thread Dag Sverre Seljebotn
On 04/05/2011 07:05 AM, Robert Bradshaw wrote: On Mon, Apr 4, 2011 at 6:04 AM, Stefan Behnel wrote: Dag Sverre Seljebotn, 04.04.2011 13:53: On 04/04/2011 01:23 PM, Stefan Behnel wrote: Dag Sverre Seljebotn, 04.04.2011 12:17: CEP up at http://wiki.cython.org/enhancements/prange """ Variable

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread Robert Bradshaw
On Mon, Apr 4, 2011 at 6:04 AM, Stefan Behnel wrote: > Dag Sverre Seljebotn, 04.04.2011 13:53: >> >> On 04/04/2011 01:23 PM, Stefan Behnel wrote: >>> >>> Dag Sverre Seljebotn, 04.04.2011 12:17: CEP up at http://wiki.cython.org/enhancements/prange >>> >>> """ >>> Variable handling >>> >>>

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread Greg Ewing
Nathaniel Smith wrote: Surely it should be 'pfor i in range(...)'. Or 'pfhor', just to let you know it's really something out of this world. http://marathongame.wikia.com/wiki/Pfhor_%28Race%29 -- Greg ___ cython-devel mailing list cython-devel@pytho

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread Dag Sverre Seljebotn
On 04/04/2011 09:26 PM, mark florisson wrote: On 4 April 2011 19:18, Dag Sverre Seljebotn wrote: On 04/04/2011 05:22 PM, mark florisson wrote: On 4 April 2011 13:53, Dag Sverre Seljebotn wrote: On 04/04/2011 01:23 PM, Stefan Behnel wrote: Dag Sverre Seljebotn, 04.04.2011 12:17: CEP up at

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread mark florisson
On 4 April 2011 19:18, Dag Sverre Seljebotn wrote: > On 04/04/2011 05:22 PM, mark florisson wrote: >> >> On 4 April 2011 13:53, Dag Sverre Seljebotn >>  wrote: >>> >>> On 04/04/2011 01:23 PM, Stefan Behnel wrote: Dag Sverre Seljebotn, 04.04.2011 12:17: > > CEP up at http://wiki.c

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread Dag Sverre Seljebotn
On 04/04/2011 05:22 PM, mark florisson wrote: On 4 April 2011 13:53, Dag Sverre Seljebotn wrote: On 04/04/2011 01:23 PM, Stefan Behnel wrote: Dag Sverre Seljebotn, 04.04.2011 12:17: CEP up at http://wiki.cython.org/enhancements/prange """ Variable handling Rather than explicit declaration o

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread Dag Sverre Seljebotn
On 04/04/2011 03:04 PM, Stefan Behnel wrote: That's what I thought, yes. It looks unexpected, sure. That's the clear advantage of using inner functions, which do not add anything new at all. But if we want to add something that looks more like a loop, we should at least make it behave like so

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread mark florisson
On 4 April 2011 13:53, Dag Sverre Seljebotn wrote: > On 04/04/2011 01:23 PM, Stefan Behnel wrote: >> >> Dag Sverre Seljebotn, 04.04.2011 12:17: >>> >>> CEP up at http://wiki.cython.org/enhancements/prange >> >> """ >> Variable handling >> >> Rather than explicit declaration of shared/private varia

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread Dag Sverre Seljebotn
On 04/04/2011 03:27 PM, Nathaniel Smith wrote: On Mon, Apr 4, 2011 at 3:17 AM, Dag Sverre Seljebotn wrote: * A simple and friendly solution that covers, perhaps, 80% of the cases, based on simply replacing range with prange. This is a "merely" aesthetic objection, while remaining agnostic o

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread Sturla Molden
Den 04.04.2011 15:04, skrev Stefan Behnel: What I would like to avoid is having to tell users "and now for something completely different". It looks like a loop, but then there's a whole page of new semantics for it. And this also cannot be used in plain Python code due to the differing scopi

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread Dag Sverre Seljebotn
On 04/04/2011 03:04 PM, Stefan Behnel wrote: Dag Sverre Seljebotn, 04.04.2011 13:53: On 04/04/2011 01:23 PM, Stefan Behnel wrote: Dag Sverre Seljebotn, 04.04.2011 12:17: CEP up at http://wiki.cython.org/enhancements/prange """ Variable handling Rather than explicit declaration of shared/pri

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread Nathaniel Smith
On Mon, Apr 4, 2011 at 3:17 AM, Dag Sverre Seljebotn wrote: >  * A simple and friendly solution that covers, perhaps, 80% of the cases, > based on simply replacing range with prange. This is a "merely" aesthetic objection, while remaining agnostic on the larger discussion, but -- 'for i in prange

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread Stefan Behnel
Dag Sverre Seljebotn, 04.04.2011 13:53: On 04/04/2011 01:23 PM, Stefan Behnel wrote: Dag Sverre Seljebotn, 04.04.2011 12:17: CEP up at http://wiki.cython.org/enhancements/prange """ Variable handling Rather than explicit declaration of shared/private variables we rely on conventions: * Thre

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread Dag Sverre Seljebotn
On 04/04/2011 01:23 PM, Stefan Behnel wrote: Dag Sverre Seljebotn, 04.04.2011 12:17: CEP up at http://wiki.cython.org/enhancements/prange """ Variable handling Rather than explicit declaration of shared/private variables we rely on conventions: * Thread-shared: Variables that are only

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread Stefan Behnel
Dag Sverre Seljebotn, 04.04.2011 12:17: CEP up at http://wiki.cython.org/enhancements/prange """ Variable handling Rather than explicit declaration of shared/private variables we rely on conventions: * Thread-shared: Variables that are only read and not written in the loop body are sha

Re: [Cython] CEP: prange for parallel loops

2011-04-04 Thread Dag Sverre Seljebotn
On 04/04/2011 11:43 AM, Dag Sverre Seljebotn wrote: CEP up at http://wiki.cython.org/enhancements/prange """ This spec is the result of a number of discussions at Cython workshop 1. Quite a few different ways of expressing parallelism was looked at, and finally we decided to split the problem

[Cython] CEP: prange for parallel loops

2011-04-04 Thread Dag Sverre Seljebotn
CEP up at http://wiki.cython.org/enhancements/prange """ This spec is the result of a number of discussions at Cython workshop 1. Quite a few different ways of expressing parallelism was looked at, and finally we decided to split the problem in two: * A simple and friendly solution that cove

[Cython] CEP: prange for parallel loops

2011-04-04 Thread Dag Sverre Seljebotn
CEP up at http://wiki.cython.org/enhancements/prange """ This spec is the result of a number of discussions at Cython workshop 1. Quite a few different ways of expressing parallelism was looked at, and finally we decided to split the problem in two: * A simple and friendly solution that cove