[Numpy-discussion] parallel loop annotations
Sat Jun 21 17:05:56 CDT 2008
The discussion has moved to :
Quoting Rahul Garg <firstname.lastname@example.org>:
> Thanks for pointing them out. I will look into both of them. I like
> the "with" statement. From an implementation perspective, the "with"
> statement looks simpler since the Python parser seems to discard
> comments and I use the Python parser as front end for compiler.
> For other annotations, I have been using either decorators or strings.
> Decorators are used for type annotating functions. Strings just before
> class declarations are currently necessary for telling the compiler
> about fields of a class.
> Strings can get a little ugly. Its better to use language features
> whenever possible. I will look into ipython's notation.
> More comments welcome :)
> Quoting Stéfan van der Walt <email@example.com>:
>> 2008/6/18 Rahul Garg <firstname.lastname@example.org>:
>>> 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?
>> Is the idea to have the annotations completely separated from the
>> executed source? Otherwise, I'd just as well make it implicit:
>> with parallel(i):
>> for i in range(m):
>> a[i] = b[i] * c[i]
>> That is also roughly the form that Fernando implemented for IPython1,
>> and is very intuitive.
>> What have you been using for other annotations so far? Python itself
>> supports at least one other annotation:
>> # encoding: utf-8
>> so maybe
>> # pragma: parallel for
>> could work.
>> Numpy-discussion mailing list
> Numpy-discussion mailing list
More information about the Numpy-discussion