I want to run a cpu intensive program in Python across multiple cores and am trying to figure out how to write C extensions to do this. Are there any code samples or tutorials
This is a good use of C extension. The keyword you should search for is Py_BEGIN_ALLOW_THREADS
.
http://docs.python.org/c-api/init.html#thread-state-and-the-global-interpreter-lock
P.S. I mean if you processing is already in C, like imaging processing, then release the lock in C extension is good. If your processing code is mainly in Python, other people's suggestion to multiprocessing
is better. It is usually not justify to rewrite the code in C for background processing.