From chris.jewell at warwick.ac.uk  Mon Dec  6 16:43:34 2010
From: chris.jewell at warwick.ac.uk (Chris Jewell)
Date: Mon, 6 Dec 2010 15:43:34 +0000
Subject: [Rd] R with ATLAS avoids Linux cpu affinity
Message-ID: <91017BEA-2AF0-4040-888A-6C09D0690B9C@warwick.ac.uk>

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?

Thanks,

Chris

--
Dr Chris Jewell
Department of Statistics
University of Warwick
Coventry
CV4 7AL
UK
Tel: +44 (0)24 7615 0778



[Rd] R with ATLAS avoids Linux cpu affinity
Chris Jewell