[Numpy-discussion] Fast threading solution thoughts

Sturla Molden sturla@molden...
Thu Feb 12 10:53:04 CST 2009


On 2/12/2009 5:24 PM, Gael Varoquaux wrote:

> My two cents: go for cython objects/statements. Not only does code in
> comments looks weird and a hack, but also it means to you have to hack
> the parser. 

I agree with this. Particularly because Cython uses intendation as 
syntax. With comments you would have to use 'end' tags like in Fortran:

!$omp parallel do private(i) shared(n)
do i = 1,n
   !$omp parallel do private(j) shared(i,n)
   do j = i, n
      ! whatever
   end do
   !$omp end parallel do
end do
!$omp end parallel do

But this is Fortran. It is meant to look bad. :)


> Finally cython can be used in a valid Python syntax (at least
> part of it) thanks to decorators giving the types. 

I don't think OpenMP will ever be used from pure Python.

But please, add a -openmp compiler swich in Cython. If it is not there,
all openmp statements should be ignored and translate to nothing.

S.M.



More information about the Numpy-discussion mailing list