How to make a foreign function run as fast as possible in Windows?
eryk sun
eryksun at gmail.com
Wed Sep 28 01:04:33 EDT 2016
On Wed, Sep 28, 2016 at 2:13 AM, <jfong at ms4.hinet.net> wrote:
> If the load was distributed by the OS schedules across all cores,
> does it means I can't make one core solely running a piece of codes
> for me and so I have no contol on its performance?
In Unix, Python's os module may have sched_setaffinity() to set the
CPU affinity for all threads in a given process.
In Windows, you can use ctypes to call SetProcessAffinityMask,
SetThreadAffinityMask, or SetThreadIdealProcessor (a hint for the
scheduler). On a NUMA system you can call GetNumaNodeProcessorMask(Ex)
to get the mask of CPUs that are on a given NUMA node. The cmd shell's
"start" command supports "/numa" and "/affinity" options, which can be
combined.
More information about the Python-list
mailing list