[Openmp-commits] [PATCH] D51944: openmp: Use glibc wrappers for accessing cpu affinity mask
Jonathan Peyton via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Tue Sep 11 14:57:27 PDT 2018
jlpeyton added a comment.
To avoid the glibc version issue, can we just switch the `mask_t` from `unsigned char` to `unsigned long`? This is the actual underlying type for cpuset according to the man page. This would require different changes, particularly `__kmp_affin_mask_size`. I think that in z_Linux_util.cpp:`__kmp_determine_affinity_capable()` (where `__kmp_affin_mask_size` is set), you could change `__kmp_affin_mask_size` to be the closest multiple of `sizeof(unsigned long)`, then the `Mask()` constructor would perform `__kmp_allocate(sizeof(unsigned long)*__kmp_affin_mask_size);`. Most of the mask API stays the same, but in `set|get_system_affinity()`, have the size argument be `sizeof(unsigned long)*__kmp_affin_mask_size` for the system calls.
Does this make sense?
Repository:
rOMP OpenMP
https://reviews.llvm.org/D51944
More information about the Openmp-commits
mailing list