Issue
I am using a Mac OS with 8 cores. When running a .py
file from terminal,
I use python file.py
. But I am wondering if it is possible to specify which core to use. Something like python file.py core 6
This might be helpful while running heavy repetitive work with few change in variables.
Solution
You are looking for the processor affinity
on Mac OS. According to this it is unsupported.
OS X does not export interfaces that identify processors or control thread placement—explicit thread to processor binding is not supported. Instead, the kernel manages all thread placement. Applications expect that the scheduler will, under most circumstances, run its threads using a good processor placement with respect to cache affinity.
Answered By - Yuri G. Answer Checked By - Willingham (WPSolving Volunteer)