Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] Mixing Linux's CPU-shielding with mpirun's bind-to-core
From: Siddhartha Jana (siddharthajana24_at_[hidden])
Date: 2013-08-17 23:34:52


Hi,

My requirement:
1. Avoid the OS from scheduling tasks on cores 0-7 allocated to my process.
2. Avoid rescheduling of processes to other cores.

My solution: I use Linux's CPU-shielding.
[ Man page:
http://www.kernel.org/doc/man-pages/online/pages/man7/cpuset.7.html
]
I create a cpuset called "socket1" with cores 8-15 in the dev fs. I iterate
through all the tasks in /dev/cpuset/tasks and copy them to
/dev/cpuset/socket1/tasks
I create a cpuset called "socket0" with cores 0-7 .
At the start of the application, (before MPI_Init()), I schedule my MPI
process on the cpuset as follows:
------------------------------------------------------
sprintf(str,"/bin/echo %d >> /dev/cpuset/socket0/tasks ",mypid);
system(str);
------------------------------------------------------
In order to ensure that my processes remain bound to the cores, I am
passing the --bind-to-core option to mpirun. I do this, instead of using
sched_setaffinity from within the application. Is there a chance that
mpirun's "binding-to-core" will clash with the above ?

While this solution seems to work temporarily, I am not sure whether this
is good solution, given mpirun's own techniques of binding to cores,
scheduling processes by slot, et al.

Will mpirun's bind-by-slot technique guarantee cpu shielding?

I would be highly obliged if some one could direct me to the right
direction.

Many thanks
Sincerely
Siddhartha Jana