Running Python code in different processors

multicore, python

Solution

In Linux with schedutils, I believe you'd use taskset `-c X python foo.py` to run that specific Python process on CPU `X` (exactly how you identify your CPUs may vary, but I believe numbers such as 1, 2, 3, ... should work anywhere). I'm sure Windows, BSD versions, etc, have similar commands to support direct processor assignment, but I don't know them.

Problem

In order to do quality assurance in a critical multicore (8) workstation, I want to run the same code in different processors but not in parallel or concurrently. I need to run it 8 times, one run for each processor. What I don't know is how to select the processor I want. How can this be accomplished in Python?

Original source