Jeff Squyres, le Mon 09 Nov 2009 08:05:47 -0500, a écrit :
> Fair enough.  What about if we have an AC check for  
> pthread_setaffinity_np and use that if it exists, and if it doesn't  
> use the PLPA way?

Err, remember that pthread_setaffinity_np alone doesn't permit to bind
another process, and suffers from the same size parameter kludge (it has
been introduced in 2003).

> BTW, how does pthread_setaffinity_np() work?  Does it check the  
> running kernel and ensure to do the Right Thing?

Like sched_setaffinity does, yes.

> That was definitely a problem in the past -- kernel and glibc would
> mismatch in terms of set/getaffinity (which was included in many
> distros).

They have been fixed at the same time, 2004-03-18.

Maybe what we can do is using PLPA's functions if __GLIBC__ is <=
2 and __GLIBC_MINOR__ is < the first version which is known to be
correct or if CPU_SET can't be compiled, and rely on the glibc
functions else.  Of course we have to rely on glibc in any case for
pthread_setaffinity_np().

Samuel

Reply via email to