[Numpy-discussion] parallel loop annotations
Wed Jun 18 10:47:47 CDT 2008
I have been working on a Python to C compiler called unPython (updates
coming tomorow). One of the features I want to work on is parallel
loop annotations similar to OpenMP for C. Given the multicore
revolution, and given the lack of real concurrency in CPython, such a
feature will be desirable.
One pseudo-C example of this :
#pragma openmp parallel for
for(i=0;i<m;i++) a[i] = b[i]*c[i];
The additional annotation tells the compiler that the loop is
parallel. The compiler and runtime takes care of spawning threads etc.
I want to add a similar annotation to Python
example usage :
"pragma parallel for"
for i in xrange(m): a[i] = b[i]*c[i]
The interpreter ignores such strings and the code will of course
execute serially but such strings can potentially be used by compilers.
Any thoughts on this? What form of annotations would you like to see?
Is it pythonic?
More information about the Numpy-discussion