[Openmp-commits] [PATCH] D27975: fix for the __kmpc_global_num_threads function to return the value of the __kmp_all_nth global var

Yonghong Yan via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Dec 20 02:50:25 PST 2016

yanyh created this revision.
yanyh added a reviewer: tlwilmar.
yanyh added a subscriber: openmp-commits.

As the comments and the function name indicate, the function returns the internal global num of a thread, not the num of a thread within a team, which is what the current function do by returning the value of __kmp_nth global var. This patch fixes that by returning the __kmp_all_nth value.



Index: runtime/src/kmp_csupport.cpp
--- runtime/src/kmp_csupport.cpp
+++ runtime/src/kmp_csupport.cpp
@@ -121,9 +121,9 @@
 __kmpc_global_num_threads(ident_t *loc)
-    KC_TRACE( 10, ("__kmpc_global_num_threads: num_threads = %d\n", __kmp_nth ) );
+    KC_TRACE( 10, ("__kmpc_global_num_threads: num_threads = %d\n", __kmp_all_nth ) );
-    return TCR_4(__kmp_nth);
+    return TCR_4(__kmp_all_nth);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27975.82078.patch
Type: text/x-patch
Size: 493 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20161220/7f07913b/attachment.bin>

More information about the Openmp-commits mailing list