Re: [Cython] Some bugs found while testing cython on django
Vitja Makarov writes: > 1. It seems that cython currently doesn't support tuples inside args definition: > def foo((a, b), c): Note that this feature is removed in Python 3. http://www.python.org/dev/peps/pep-3113/ ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel
Re: [Cython] cython.parallel tasks, single, master, critical, barriers
On Sun, Oct 9, 2011 at 2:57 PM, Dag Sverre Seljebotn wrote: >>> with parallel.single(): >>> same as master, except any thread may do the execution >>> >>> An optional keyword argument 'nowait' specifies whether there will be a >>> barrier at the end. The default is to wait. > > I like > > if parallel.is_master(): > ... > explicit_barrier_somehow() # see below > > better as a Pythonization. One could easily support is_master to be used in > other contexts as well, simply by assigning a status flag in the master > block. > > Using an if-test flows much better with Python I feel, but that naturally > lead to making the barrier explicit. But I like the barrier always being > explicit, rather than having it as a predicate on all the different > constructs like in OpenMP Personally, I think I'd prefer find context managers as a very readable way to deal with parallelism, similar to the "threading" module: http://docs.python.org/library/threading.html#using-locks-conditions-and-semaphores-in-the-with-statement ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel
Re: [Cython] cython.parallel tasks, single, master, critical, barriers
On Sun, Oct 9, 2011 at 9:01 PM, mark florisson wrote: > On 9 October 2011 19:54, Jon Olav Vik wrote: >> Personally, I think I'd prefer context managers as a very >> readable way to deal with parallelism > > Yeah it makes a lot of sense for mutual exclusion, but 'master' really > means "only the master thread executes this peace of code, even though > other threads encounter the same code", which is more akin to 'if' > than 'with'. I see your point. However, another similarity with "with" statements as an encapsulated "try..finally" is when there's a barrier at the end of the block. I can live with some magic if it saves me from having a boilerplate line of "barrier" everywhere 8-) ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel