I am trying to run 1200 iterations of a function with different values using multiprocessing. Is there a way I can set the priority and affinities of the processors within the function itself ? Here is an example of what I am doing :
with multiprocessing.Pool(processes=3) as pool:
r = pool.map(func, (c for c in combinations))
I want each of the 3 processes to have high priority using psutil, and the cpu_affinity to be specified. While I can use: psutil.Process().HIGH_PRIORITY_CLASS
withing func
, how should I specify different affinities for the three processors?