I started on the OpenMP support and I believe I’m nearly finished. There are a few things remaining, such as cython.parallel.{threadid,threadsavailable}, but those are minor issues. So far my reduction tests are passing 🙂 Now I just have to figure out if I want to modify the test runner to parse distutils directives… they need to be compiled with -fopenmp and -lgomp. And I’m wondering if I should merge this with my with gil branch, as I want to raise an exception in nogil code when the ‘step’ passed to prange() is 0.

There were some pitfalls when implementing this, at first I thought OpenMP’s restrictions would force you to generate two loops: one for the ascending loops, and one for descending loops — if you don’t know this at Cython compile time. This because you cannot accumulate the target index variable in the increment expression of the for (as the less than operator would change to greater than), nor can you calculate the total amount of steps and accumulate the target index variable in the loop, as you’d have a data dependency between iterations. So the solution is to simply calculate the target index in the loop body with simple arithmetic! target = start + index * step; No data dependency there 🙂


About markflorisson

Blog for the Cython gsoc 2011
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s