[Numpy-discussion] Fast threading solution thoughts

Dag Sverre Seljebotn dagss@student.matnat.uio...
Thu Feb 12 13:36:27 CST 2009

Dag Sverre Seljebotn wrote:
> Hmm... yes. Care would need to be taken though because Cython might in 
> the future very well generate a "while" loop instead for such a 
> statement under some circumstances, and that won't work with OpenMP. One 
> should be careful with assuming what the C result will be of Cython 
> code. That's why I proposed using an alternative construct which both 
> does the OpenMP stuff and contains the for loop.

As a matter of fact, the next Cython release might prepend all 
for-in-range-loops with an if-test under some circumstances, in order to 
better match Python looping semantics (if the loop isn't executed, the 
loop counter should never be written to -- in contrast with C). So this 
is already happening. OpenMP might need different loop semantics and so 
calls for a different construct.

Dag Sverre

More information about the Numpy-discussion mailing list