[ewg] sched_setaffinity / sched_getaffinity

Jeff Squyres jsquyres at cisco.com
Mon Sep 8 09:45:14 PDT 2008


There's at least one warning in OFED that Betsy mentioned today about  
sched_setaffinity():

     ch3_smp_progress.c:2427: warning: passing argument 3 of
     'sched_setaffinity' from incompatible pointer type

Be advised that the prototypes for sched_setaffinity() and  
sched_getaffinity() have changed multiple times over the life of the  
2.4 and 2.6 kernel series.  Even worse, the the signatures in glibc  
have not always matched those in the kernel -- even in shipping Linux  
distros.

The Open MPI project spun off a tiny library to solve exactly this  
problem (because it really has nothing to do with MPI): the Portable  
Linux Processor Affinity (PLPA) project.  PLPA provides  
plpa_sched_setaffinity() and plpa_sched_getaffinity() API calls with  
constant signatures and will do the Right Thing regardless of what  
version of glibc and/or kernel you have.  PLPA is fully embeddable in  
other software projects (e.g., we embed it in Open MPI; htop also  
embeds it, IIRC).  PLPA's license is BSD.  See the project page here:

     http://www.open-mpi.org/projects/plpa/

Ping me on the PLPA mailing list if you have any questions /  
comments / suggestions / patches / etc.  You have to be subscribed to  
post, sorry.

Enjoy.

-- 
Jeff Squyres
Cisco Systems




More information about the ewg mailing list