http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58642
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2013-10-07 Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 30964 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30964&action=edit gomp-pr58642.patch Can you please try this patch? From the above it seems there is no easy way to find out what is the minimum size to make pthread_getaffinity_np pass, on the other side it should be fine to pass smaller size to pthread_setaffinity_np. So, what the patch tries to do is if the initial pthread_getaffinity_np failed with EINVAL, it will retry with larger sizes, and, once it succeeds, tries to find out the required minimum size that covers all the currently available CPUs. The minimum size for successful pthread_getaffinity_np will then be used for further pthread_getaffinity_np calls, while gomp_cpuset_size will be used for the places bitmasks and pthread_setaffinity_np calls.