Pin processes to specific cores in multiprocessing.Pool

published on
Pinning processes to specific cpu cores (a.k.a. cpu affinity) is important both for performance analysis and improvement. However in Python, especially when you use high-level interfaces, it is tricky to do it because Python does not support cpu affinity directly. This post explains how to pin processes to specific cpu cores when you use multiprocessing.Pool. Note: this post is only for Linux, but not for OSX. I didn’t even try it on a Mac as I don’t have one, but I doubt it works because this kind of low-level OS interfaces differ much in Linux and OSX. Read More...