summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src/include/50/omp.h.var
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2018-12-13 23:14:24 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2018-12-13 23:14:24 +0000
commit6d88e049dc51be8a9ba2e853e17fdf8c4fa6026b (patch)
tree5791e2d26aeb82d58420cb0d8c23811fe7fc5951 /openmp/runtime/src/include/50/omp.h.var
parent66c6c5abea94e3fcaef169f54b0c91e087ec15dc (diff)
downloadbcm5719-llvm-6d88e049dc51be8a9ba2e853e17fdf8c4fa6026b.tar.gz
bcm5719-llvm-6d88e049dc51be8a9ba2e853e17fdf8c4fa6026b.zip
[OpenMP] Implement OpenMP 5.0 affinity format functionality
This patch adds the affinity format functionality introduced in OpenMP 5.0. This patch adds: Two new environment variables: OMP_DISPLAY_AFFINITY=TRUE|FALSE OMP_AFFINITY_FORMAT=<string> and Four new API: 1) omp_set_affinity_format() 2) omp_get_affinity_format() 3) omp_display_affinity() 4) omp_capture_affinity() The affinity format functionality has two ICV's associated with it: affinity-display-var (bool) and affinity-format-var (string). The affinity-display-var enables/disables the functionality through the envirable OMP_DISPLAY_AFFINITY. The affinity-format-var is a formatted string with the special field types beginning with a '%' character similar to printf For example, the affinity-format-var could be: "OMP: host:%H pid:%P OStid:%i num_threads:%N thread_num:%n affinity:{%A}" The affinity-format-var is displayed by every thread implicitly at the beginning of a parallel region when any thread's affinity has changed (including a brand new thread being spawned), or explicitly using the omp_display_affinity() API. The omp_capture_affinity() function can capture the affinity-format-var in a char buffer. And omp_set|get_affinity_format() allow the user to set|get the affinity-format-var explicitly at runtime. omp_capture_affinity() and omp_get_affinity_format() both return the number of characters needed to hold the entire string it tried to make (not including NULL character). If not enough buffer space is available, both these functions truncate their output. Differential Revision: https://reviews.llvm.org/D55148 llvm-svn: 349089
Diffstat (limited to 'openmp/runtime/src/include/50/omp.h.var')
-rw-r--r--openmp/runtime/src/include/50/omp.h.var11
1 files changed, 11 insertions, 0 deletions
diff --git a/openmp/runtime/src/include/50/omp.h.var b/openmp/runtime/src/include/50/omp.h.var
index 7a626bd0711..81b6c854246 100644
--- a/openmp/runtime/src/include/50/omp.h.var
+++ b/openmp/runtime/src/include/50/omp.h.var
@@ -25,6 +25,11 @@
extern "C" {
# endif
+# define omp_set_affinity_format ompc_set_affinity_format
+# define omp_get_affinity_format ompc_get_affinity_format
+# define omp_display_affinity ompc_display_affinity
+# define omp_capture_affinity ompc_capture_affinity
+
# if defined(_WIN32)
# define __KAI_KMPC_CONVENTION __cdecl
# ifndef __KMP_IMP
@@ -235,6 +240,12 @@
extern void __KAI_KMPC_CONVENTION omp_free(void *ptr, const omp_allocator_t *allocator);
#endif
+ /* OpenMP 5.0 Affinity Format */
+ extern void __KAI_KMPC_CONVENTION omp_set_affinity_format(char const *);
+ extern size_t __KAI_KMPC_CONVENTION omp_get_affinity_format(char *, size_t);
+ extern void __KAI_KMPC_CONVENTION omp_display_affinity(char const *);
+ extern size_t __KAI_KMPC_CONVENTION omp_capture_affinity(char *, size_t, char const *);
+
# undef __KAI_KMPC_CONVENTION
# undef __KMP_IMP
OpenPOWER on IntegriCloud