When I am running analysis or plotting scripts on a Linux workstation, I often employ a "poor man's" parallel processing: starting multiple instances of a script with different parameters to decrease the amount of time until I get my results. I have noticed that instead of nicely shifting each new process to a separate core on the workstation, sometimes the processes will get stacked on one core. I figured out how to manually move them around with a lot of googling one day, so I am hoping to save someone the same trouble. Note that this will not work on a Mac.
- Start your processes
- Find the process PIDs with
top
or your favorite method - Check which node the processes are running on with
taskset -p [PID]
for each process PID - If the node number is the same for multiple processes, you will want to change the node being used to spread them out. If your Linux machine has 12 nodes, choose a different number between 0 and 11 from the other process. Change the process node with
taskset -p [CORE NUMBER] [PID]
- Another check to
top
should show that the processes are now each allowed to use 100% of the CPU per node instead of sharing.