CPU affinity list

On a single node, I want to set the cpu affinity to some custom values. For example, “mpirun -np 8” by running 8 processes on core0, core2, core4, … , core8.

I didn’t find such thin on the web. Maybe I missed the point in the documents of lammps. Can someone point me to the right direction?


LAMMPS itself does not do anything about CPU affinity. that would be
the task of the MPI library you use. different MPI implementations
have different ways of specifying this. you need to look into the docs
for your MPI library. the only related option that LAMMPS offers is to
change the ordering of the MPI ranks in the world communicator to
better map the domain decomposition to the network topology. but that
does not touch in any way CPU affinity. LAMMPS is agnostic there.


E.g. for OpenMPI, it is --bind-to core as an argument to mpirun (not to LAMMPS).
There are other options besides “core”.