Affinity can result in significant performance improvements for MPI applications. The mpiexec command takes a number of arguments which allow job owners to control MPI process placement, affinity, and other run time parameters.
The affinity type determines how the job scheduler interacts with your applications to assign processor cores to tasks in a job. If the job scheduler sets affinity for a task, it overrides the affinity that is set by the application.
Most cases , It is not necessary to use CPU affinity masks in Windows Server 2012 R2 to confine a workload to specific processor threads . CPU affinity can conflict with the non-uniform memory access (NUMA) architecture used in most modern servers.
The idea behind NUMA is that it is almost not possible for every thread to access the vast amount of available memory at the same speed: Memory closer to a particular core or processor package (socket) can be accessed faster than more distant memory can. So, the server’s scheduling routine will attempt to schedule threads on processors that are closest to the memory where the corresponding workload is running.
CPU affinity is often more appropriate for symmetrical multi-processing (SMP) systems where all processors maintain equal access to memory space (different from a NUMA architecture).
When affinity rules are applied today, it’s usually to test the performance of specific processors (or cores within specific processors). IT administrators can see the current thread affinity for a process using the Get Process Affinity Mask function, or use the SetProcessAffinityMask function to specify affinity for the process’ threads. For alternative , IT administrators may elect to use the SetThreadIdealProcessor function to suggest a preferred (ideal) processor for a thread.