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 scoping behaviour.
I've been working on something similar, which does not involve any
changes to Cython, and will work from Python as well. It's been
discussed before, basically it involves wrapping a loop in a closure,
and then normal Python scoping rules applies.
cdef int n
@parallel
def _parallel_loop(parallel_env):
cdef int i, s0, s1
for s0,s1 in parallel_env.range(n):
for i in range(s0,s1):
pass
I am not happy about the verbosity of the wrapper compared to
for i in prange(n):
pass
but this is the best I can do without changing the compiler. Notice e.g.
that the loop becomes two nested loops, which is required for efficient
work scheduling.
Progress is mainly limited by lack of time and personal need. If I ned
parallel computing I use Fortran or an optimized LAPACK library (e.g. ACML).
Sturla
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel