[Cython] CEP: prange for parallel loops

Dag Sverre Seljebotn d.s.seljebotn at astro.uio.no
Mon Apr 4 12:17:56 CEST 2011


CEP up at http://wiki.cython.org/enhancements/prange

"""
This spec is the result of a number of discussions at Cython workshop 1. 
Quite a few different ways of expressing parallelism was looked at, and 
finally we decided to split the problem in two:

  * A simple and friendly solution that covers, perhaps, 80% of the 
cases, based on simply replacing range with prange.

  * Less friendly solutions for the remaining cases. These cases may 
well not even require language support in Cython, or only in indirect 
ways (e.g., cdef closures if normal closures are too expensive).

This document focuses exclusively on the former solution and does not 
intend to cover all use-cases for parallel programming, only the most 
common ones.
"""

Note that me and Mark talked some more on the way to the airport, and 
also I got a couple of more ideas afterwards, so everybody interested 
should probably take a read even if you were there for discussions.

Main post-workshop changes:

  * cython.parallel.firstiteration()/lastiteration # for in-loop if-test 
for thread setup/teardown blocks

  * An idea for how to implement numthreads(), so that we can drop the 
rather complex Context idea.

  * More thoughts on firstprivate/lastprivate


Dag Sverre


More information about the cython-devel mailing list