Index: src/i18n/en_US.txt =================================================================== --- src/i18n/en_US.txt +++ src/i18n/en_US.txt @@ -396,7 +396,7 @@ AdaptiveNotSupported "%1$s: Adaptive locks are not supported; using queuing." EnvSyntaxError "%1$s: Invalid symbols found. Check the value \"%2$s\"." EnvSpacesNotAllowed "%1$s: Spaces between digits are not allowed \"%2$s\"." -BoundToOSProcSet "%1$s: pid %2$d thread %3$d bound to OS proc set %4$s" +BoundToOSProcSet "%1$s: pid %2$d tid %3$d thread %4$d bound to OS proc set %5$s" CnsLoopIncrIllegal "%1$s error: parallel loop increment and condition are inconsistent." NoGompCancellation "libgomp cancellation is not currently supported." AffHWSubsetNonUniform "KMP_HW_SUBSET ignored: non-uniform topology." Index: src/kmp_affinity.cpp =================================================================== --- src/kmp_affinity.cpp +++ src/kmp_affinity.cpp @@ -4326,8 +4326,7 @@ char buf[KMP_AFFIN_MASK_PRINT_LEN]; __kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN, th->th.th_affin_mask); - KMP_INFORM(BoundToOSProcSet, "KMP_AFFINITY", (kmp_int32)getpid(), gtid, - buf); + KMP_INFORM(BoundToOSProcSet, "KMP_AFFINITY", (kmp_int32)getpid(),__kmp_gettid(), gtid, buf); } # if KMP_OS_WINDOWS @@ -4389,8 +4388,7 @@ char buf[KMP_AFFIN_MASK_PRINT_LEN]; __kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN, th->th.th_affin_mask); - KMP_INFORM(BoundToOSProcSet, "OMP_PROC_BIND", (kmp_int32)getpid(), - gtid, buf); + KMP_INFORM(BoundToOSProcSet, "OMP_PROC_BIND", (kmp_int32)getpid(), __kmp_gettid(), gtid, buf); } __kmp_set_system_affinity(th->th.th_affin_mask, TRUE); } @@ -4708,7 +4706,7 @@ char buf[KMP_AFFIN_MASK_PRINT_LEN]; __kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN, mask); KMP_INFORM(BoundToOSProcSet, "KMP_AFFINITY", (kmp_int32)getpid(), - tid, buf); + __kmp_gettid(), tid, buf); } __kmp_set_system_affinity( mask, TRUE ); KMP_CPU_FREE_FROM_STACK(mask); @@ -4869,7 +4867,7 @@ char buf[KMP_AFFIN_MASK_PRINT_LEN]; __kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN, mask); KMP_INFORM(BoundToOSProcSet, "KMP_AFFINITY", (kmp_int32)getpid(), - tid, buf); + __kmp_gettid(), tid, buf); } __kmp_set_system_affinity( mask, TRUE ); KMP_CPU_FREE_FROM_STACK(mask); Index: src/kmp_wrapper_getpid.h =================================================================== --- src/kmp_wrapper_getpid.h +++ src/kmp_wrapper_getpid.h @@ -21,6 +21,17 @@ // On Unix-like systems (Linux* OS and OS X*) getpid() is declared in standard headers. #include #include + #include + #if KMP_OS_DARWIN + //OS X + #define __kmp_gettid() syscall(SYS_thread_selfid) + #elif defined(SYS_gettid) + // Hopefully other Unix systems define SYS_gettid syscall for getting os thread id + #define __kmp_gettid() syscall(SYS_gettid) + #else + #warning No gettid found, use getpid instead + #define __kmp_gettid() getpid() + #endif #elif KMP_OS_WINDOWS @@ -29,6 +40,7 @@ // Let us simulate Unix. typedef int pid_t; #define getpid _getpid + #define __kmp_gettid() GetCurrentThreadId() #else