Index: runtime/src/kmp.h =================================================================== --- runtime/src/kmp.h +++ runtime/src/kmp.h @@ -536,6 +536,7 @@ # define KMP_CPU_CLR(i,mask) hwloc_bitmap_clr((hwloc_cpuset_t)mask, (unsigned)i) # define KMP_CPU_ZERO(mask) hwloc_bitmap_zero((hwloc_cpuset_t)mask) # define KMP_CPU_COPY(dest, src) hwloc_bitmap_copy((hwloc_cpuset_t)dest, (hwloc_cpuset_t)src) +# define KMP_CPU_AND(dest, src) hwloc_bitmap_and((hwloc_cpuset_t)dest, (hwloc_cpuset_t)dest, (hwloc_cpuset_t)src) # define KMP_CPU_COMPLEMENT(max_bit_number, mask) \ { \ unsigned i; \ @@ -546,6 +547,8 @@ hwloc_bitmap_set((hwloc_cpuset_t)mask, i); \ } \ } \ + hwloc_bitmap_and((hwloc_cpuset_t)mask, (hwloc_cpuset_t)mask, \ + (hwloc_cpuset_t)__kmp_affinity_get_fullMask()); \ } \ # define KMP_CPU_UNION(dest, src) hwloc_bitmap_or((hwloc_cpuset_t)dest, (hwloc_cpuset_t)dest, (hwloc_cpuset_t)src) @@ -638,6 +641,15 @@ } \ } +# define KMP_CPU_AND(dest, src) \ + { \ + size_t __i; \ + for (__i = 0; __i < __kmp_affin_mask_size; __i++) { \ + ((kmp_affin_mask_t *)(dest))[__i] \ + &= ((kmp_affin_mask_t *)(src))[__i]; \ + } \ + } + # define KMP_CPU_COMPLEMENT(max_bit_number, mask) \ { \ size_t __i; \ @@ -645,6 +657,7 @@ ((kmp_affin_mask_t *)(mask))[__i] \ = ~((kmp_affin_mask_t *)(mask))[__i]; \ } \ + KMP_CPU_AND(mask, __kmp_affinity_get_fullMask()); \ } # define KMP_CPU_UNION(dest, src) \ @@ -717,6 +730,15 @@ } \ } +# define KMP_CPU_AND(dest, src) \ + { \ + int __i; \ + for (__i = 0; __i < __kmp_num_proc_groups; __i++) { \ + ((kmp_affin_mask_t *)(dest))[__i] \ + &= ((kmp_affin_mask_t *)(src))[__i]; \ + } \ + } + # define KMP_CPU_COMPLEMENT(max_bit_number, mask) \ { \ int __i; \ @@ -724,6 +746,7 @@ ((kmp_affin_mask_t *)(mask))[__i] \ = ~((kmp_affin_mask_t *)(mask))[__i]; \ } \ + KMP_CPU_AND(mask, __kmp_affinity_get_fullMask()); \ } # define KMP_CPU_UNION(dest, src) \ @@ -758,7 +781,8 @@ # define KMP_CPU_CLR(i,mask) (*(mask) &= ~(((kmp_affin_mask_t)1) << (i))) # define KMP_CPU_ZERO(mask) (*(mask) = 0) # define KMP_CPU_COPY(dest, src) (*(dest) = *(src)) -# define KMP_CPU_COMPLEMENT(max_bit_number, mask) (*(mask) = ~*(mask)) +# define KMP_CPU_AND(dest, src) (*(dest) &= *(src)) +# define KMP_CPU_COMPLEMENT(max_bit_number, mask) (*(mask) = ~*(mask)); KMP_CPU_AND(mask, __kmp_affinity_get_fullMask()) # define KMP_CPU_UNION(dest, src) (*(dest) |= *(src)) # endif /* KMP_GROUP_AFFINITY */ @@ -863,9 +887,7 @@ extern int __kmp_set_system_affinity(kmp_affin_mask_t const *mask, int abort_on_error); extern void __kmp_affinity_bind_thread(int which); -# if KMP_OS_LINUX extern kmp_affin_mask_t *__kmp_affinity_get_fullMask(); -# endif /* KMP_OS_LINUX */ extern char const * __kmp_cpuinfo_file; #endif /* KMP_AFFINITY_SUPPORTED */