Skip to content

Support for the ICVs tool-var and display-affinity-var in ompd_enumerate_icvs() and ompd_get_icv_from_scope() #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions libompd/src/omp-icv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
macro (cancel_var, "cancel-var", ompd_scope_address_space, 0) \
macro (max_task_priority_var, "max-task-priority-var", ompd_scope_address_space, 0) \
macro (debug_var, "debug-var", ompd_scope_address_space, 0) \
macro (display_affinity_var, "display-affinity-var", ompd_scope_address_space, 0) \
macro (tool_var, "tool-var", ompd_scope_address_space, 0) \
macro (levels_var, "levels-var", ompd_scope_parallel, 1) \
macro (active_levels_var, "active-levels-var", ompd_scope_parallel, 0) \
macro (thread_limit_var, "thread-limit-var", ompd_scope_address_space, 0) \
Expand Down Expand Up @@ -236,6 +238,42 @@ static ompd_rc_t ompd_get_debug(
return ret;
}

static ompd_rc_t ompd_get_display_affinity(
ompd_address_space_handle_t *addr_handle, /* IN: handle for the address space */
ompd_word_t *display_affinity_val /* OUT: display affinity value */
) {
ompd_address_space_context_t *context = addr_handle->context;
if (!context)
return ompd_rc_stale_handle;
ompd_rc_t ret;

if (!callbacks) {
return ompd_rc_error;
}
ret = TValue(context, "__kmp_display_affinity")
.castBase("__kmp_display_affinity")
.getValue(*display_affinity_val);
return ret;
}

static ompd_rc_t ompd_get_tool(
ompd_address_space_handle_t *addr_handle, /* IN: handle for the address space */
ompd_word_t *tool_val /* OUT: tool value */
) {
ompd_address_space_context_t *context = addr_handle->context;
if (!context)
return ompd_rc_stale_handle;
ompd_rc_t ret;

if (!callbacks) {
return ompd_rc_error;
}
ret = TValue(context, "__kmp_tool")
.castBase("__kmp_tool")
.getValue(*tool_val);
return ret;
}

static ompd_rc_t ompd_get_level(
ompd_parallel_handle_t *parallel_handle, /* IN: OpenMP parallel handle */
ompd_word_t *val /* OUT: nesting level */
Expand Down Expand Up @@ -605,6 +643,10 @@ ompd_rc_t ompd_get_icv_from_scope(void *handle, ompd_scope_t scope,
return ompd_get_max_task_priority((ompd_address_space_handle_t *)handle, icv_value);
case ompd_icv_debug_var:
return ompd_get_debug((ompd_address_space_handle_t *)handle, icv_value);
case ompd_icv_display_affinity_var:
return ompd_get_display_affinity((ompd_address_space_handle_t *)handle, icv_value);
case ompd_icv_tool_var:
return ompd_get_tool((ompd_address_space_handle_t *)handle, icv_value);
case ompd_icv_levels_var:
return ompd_get_level((ompd_parallel_handle_t *)handle, icv_value);
case ompd_icv_active_levels_var:
Expand Down
1 change: 1 addition & 0 deletions runtime/src/kmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ extern kmp_nested_proc_bind_t __kmp_nested_proc_bind;
extern int __kmp_display_affinity;
extern char *__kmp_affinity_format;
static const size_t KMP_AFFINITY_FORMAT_SIZE = 512;
extern int __kmp_tool;
#endif // OMP_50_ENABLED

#if KMP_AFFINITY_SUPPORTED
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/kmp_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4682,7 +4682,7 @@ static void __kmp_stg_print_omp_cancellation(kmp_str_buf_t *buffer,
#endif

#if OMP_50_ENABLED && OMPT_SUPPORT
static int __kmp_tool = 1;
int __kmp_tool = 1;

static void __kmp_stg_parse_omp_tool(char const *name, char const *value,
void *data) {
Expand Down
2 changes: 2 additions & 0 deletions runtime/src/ompd-specific.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ OMPD_SIZEOF(__kmp_max_nth) \
OMPD_SIZEOF(__kmp_stksize) \
OMPD_SIZEOF(__kmp_omp_cancellation) \
OMPD_SIZEOF(__kmp_max_task_priority) \
OMPD_SIZEOF(__kmp_display_affinity) \
OMPD_SIZEOF(__kmp_tool) \
OMPD_SIZEOF(ompd_state) \
OMPD_SIZEOF(__kmp_gtid) \
OMPD_SIZEOF(__kmp_nth) \
Expand Down