summaryrefslogtreecommitdiff
path: root/openmp/runtime/src/kmp_csupport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'openmp/runtime/src/kmp_csupport.cpp')
-rw-r--r--openmp/runtime/src/kmp_csupport.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/openmp/runtime/src/kmp_csupport.cpp b/openmp/runtime/src/kmp_csupport.cpp
index d39bf9af4334..ac9a93590ad0 100644
--- a/openmp/runtime/src/kmp_csupport.cpp
+++ b/openmp/runtime/src/kmp_csupport.cpp
@@ -18,10 +18,7 @@
#include "kmp_itt.h"
#include "kmp_lock.h"
#include "kmp_stats.h"
-
-#if OMPT_SUPPORT
#include "ompt-specific.h"
-#endif
#define MAX_MESSAGE 512
@@ -3429,13 +3426,18 @@ __kmpc_reduce_nowait(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_vars,
loc, global_tid, num_vars, reduce_size, reduce_data, reduce_func, lck);
__KMP_SET_REDUCTION_METHOD(global_tid, packed_reduction_method);
+ OMPT_REDUCTION_DECL(th, global_tid);
if (packed_reduction_method == critical_reduce_block) {
+ OMPT_REDUCTION_BEGIN;
+
__kmp_enter_critical_section_reduce_block(loc, global_tid, lck);
retval = 1;
} else if (packed_reduction_method == empty_reduce_block) {
+ OMPT_REDUCTION_BEGIN;
+
// usage: if team size == 1, no synchronization is required ( Intel
// platforms only )
retval = 1;
@@ -3536,15 +3538,20 @@ void __kmpc_end_reduce_nowait(ident_t *loc, kmp_int32 global_tid,
packed_reduction_method = __KMP_GET_REDUCTION_METHOD(global_tid);
+ OMPT_REDUCTION_DECL(__kmp_thread_from_gtid(global_tid), global_tid);
+
if (packed_reduction_method == critical_reduce_block) {
__kmp_end_critical_section_reduce_block(loc, global_tid, lck);
+ OMPT_REDUCTION_END;
} else if (packed_reduction_method == empty_reduce_block) {
// usage: if team size == 1, no synchronization is required ( on Intel
// platforms only )
+ OMPT_REDUCTION_END;
+
} else if (packed_reduction_method == atomic_reduce_block) {
// neither master nor other workers should get here
@@ -3556,6 +3563,7 @@ void __kmpc_end_reduce_nowait(ident_t *loc, kmp_int32 global_tid,
tree_reduce_block)) {
// only master gets here
+ // OMPT: tree reduction is annotated in the barrier code
} else {
@@ -3629,13 +3637,17 @@ kmp_int32 __kmpc_reduce(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_vars,
loc, global_tid, num_vars, reduce_size, reduce_data, reduce_func, lck);
__KMP_SET_REDUCTION_METHOD(global_tid, packed_reduction_method);
+ OMPT_REDUCTION_DECL(th, global_tid);
+
if (packed_reduction_method == critical_reduce_block) {
+ OMPT_REDUCTION_BEGIN;
__kmp_enter_critical_section_reduce_block(loc, global_tid, lck);
retval = 1;
} else if (packed_reduction_method == empty_reduce_block) {
+ OMPT_REDUCTION_BEGIN;
// usage: if team size == 1, no synchronization is required ( Intel
// platforms only )
retval = 1;
@@ -3723,10 +3735,13 @@ void __kmpc_end_reduce(ident_t *loc, kmp_int32 global_tid,
// this barrier should be visible to a customer and to the threading profile
// tool (it's a terminating barrier on constructs if NOWAIT not specified)
+ OMPT_REDUCTION_DECL(th, global_tid);
if (packed_reduction_method == critical_reduce_block) {
__kmp_end_critical_section_reduce_block(loc, global_tid, lck);
+ OMPT_REDUCTION_END;
+
// TODO: implicit barrier: should be exposed
#if OMPT_SUPPORT
ompt_frame_t *ompt_frame;
@@ -3749,6 +3764,8 @@ void __kmpc_end_reduce(ident_t *loc, kmp_int32 global_tid,
} else if (packed_reduction_method == empty_reduce_block) {
+ OMPT_REDUCTION_END;
+
// usage: if team size==1, no synchronization is required (Intel platforms only)
// TODO: implicit barrier: should be exposed