[Cython] cython.parallel tasks, single, master, critical, barriers

Jon Olav Vik jonovik at gmail.com
Sun Oct 9 20:54:01 CEST 2011

On Sun, Oct 9, 2011 at 2:57 PM, Dag Sverre Seljebotn
<d.s.seljebotn at astro.uio.no> 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"


More information about the cython-devel mailing list