summaryrefslogtreecommitdiffstats
path: root/openmp/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'openmp/runtime')
-rw-r--r--openmp/runtime/src/i18n/en_US.txt2
-rw-r--r--openmp/runtime/src/kmp_affinity.cpp10
-rw-r--r--openmp/runtime/src/kmp_wrapper_getpid.h12
3 files changed, 17 insertions, 7 deletions
diff --git a/openmp/runtime/src/i18n/en_US.txt b/openmp/runtime/src/i18n/en_US.txt
index ce09e162956..db69f609d5b 100644
--- a/openmp/runtime/src/i18n/en_US.txt
+++ b/openmp/runtime/src/i18n/en_US.txt
@@ -396,7 +396,7 @@ SyntaxErrorUsing "%1$s: syntax error, using %2$s."
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."
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index 79b9b91df75..8200b9a3d5f 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -4326,8 +4326,7 @@ __kmp_affinity_set_init_mask(int gtid, int isa_root)
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 @@ __kmp_affinity_set_place(int gtid)
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 @@ void __kmp_balanced_affinity( int tid, int nthreads )
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 @@ void __kmp_balanced_affinity( int tid, int nthreads )
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);
diff --git a/openmp/runtime/src/kmp_wrapper_getpid.h b/openmp/runtime/src/kmp_wrapper_getpid.h
index 61a046c37d2..68c2be7915f 100644
--- a/openmp/runtime/src/kmp_wrapper_getpid.h
+++ b/openmp/runtime/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 <sys/types.h>
#include <unistd.h>
+ #include <sys/syscall.h>
+ #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
OpenPOWER on IntegriCloud