Running Python code on different processors

To ensure quality on a critical multi-core (8) workstation, I want to run the same code on different processors, but not in parallel or simultaneously.

I need to run it 8 times, one launch for each processor.

I do not know how to choose the processor that I want.

How can this be done in Python?

+6
python multicore qa
source share
2 answers

On Linux with schedutils , I believe that you would use taskset -c X python foo.py to run this particular Python process on CPU X (the exact way you define your processors may vary, but I think numbers like 1, 2, 3, ... should work anywhere). I'm sure Windows, BSD versions, etc. They have similar commands to support the direct assignment of processors, but I do not know them.

+4
source share

What process is going on, on which kernel is your OS normal. In linux, there is a set of tasks from the schedutils package to explicitly run the program on the processor.

Python 2.6 has a multiprocessing module that executes python functions and runs them in separate processes, possibly moving each new process to a different core.

+3
source share

All Articles