I would like to draw figures on multiple cores in parallel with Matplotlib using the Agg backend without having to start multiple Python processes. This could be achieved with multithreading if Matplotlib released the global interpreter lock (GIL) while drawing figures.
I've tried searching the Matplotlib codebase for PyEval_SaveThread
and Py_BEGIN_ALLOW_THREADS
that are necessary to release the GIL. Based on this search it seems that Matplotlib only releases the GIL when resampling images. There are also no PyGILState_Ensure
calls which would happen if new threads were created in an extension except in an OS X specific file. However, I don't really know the Matplotlib source and it is possible the GIL release happens in a dependency.