[Rd] R with ATLAS avoids Linux cpu affinity

Chris Jewell chris.jewell at warwick.ac.uk
Mon Dec 6 16:43:34 CET 2010

Hi all,

I have a problem with cpu affinity in my R-2.11.1 installation compiled against ATLAS running on a Linux (Ubuntu 10.04) cluster under GridEngine.  I wish to use Grid Engine's core binding feature to bind user processes into the number of cores they request on the cluster, thus preventing badly behaved multi-threaded libraries from consuming more cores than requested.  An example of this is R compiled against multithreaded ATLAS, which needs to be bound into a single core if a user submits a 1 core job.  Grid Engine achieves this through the sched_setaffinity system call under Linux 2.6.  For most applications (including if I write a test C program that uses ATLAS BLAS), this works well, and prevents threads from 'leaking' outside the cpu set they are assigned.  However, R appears to be able to avoid the core binding.  This is *very* strange as I was under the impression that any child processes or threads inherit the cpu affinity of the parent.

Does anyone have experience of this and could offer a comment or solution?



Dr Chris Jewell
Department of Statistics
University of Warwick
Tel: +44 (0)24 7615 0778

More information about the R-devel mailing list