If you're using intel mpi, affinity is covered in the getting started guide. For the most usual cases, it's automatic. If you need to deal with priorities (unlikely), it seems beyond the scope of this forum.
You should be able to do so with the _MPI_PIN_PROCESSOR_LIST environment setting (refer to: https://software.intel.com/en-us/node/528898).
Also, its' best for you to post your questions in the Intel Clusters and HPC Technology forum where you'll get those issues resolved by support folks specialized in MPI. So, I'll transfer your issue to that forum and someone will respond to you accordingly and I'll let them know as well.
Tim is correct, I would generally keep the defaults unless you're doing something very specific. The Intel MPI Library does a good job of handling MPI rank placement and affinity out of the box. If you're wondering which processes are pinned to which cores, you can set I_MPI_DEBUG=5 and that'll print a pinning table.
Hope this helps. Let me know if you have other questions.