[Openmp-commits] [PATCH] D55148: [OpenMP] Implement OpenMP 5.0 Affinity Format Functionality

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Nov 30 14:26:34 PST 2018


jlpeyton created this revision.
jlpeyton added reviewers: AndreyChurbanov, tlwilmar.
jlpeyton added a project: OpenMP.
Herald added a subscriber: guansong.

This patch adds the affinity format functionality introduced in OpenMP 5.0.
This patch adds: Two new environment variables:

1. OMP_DISPLAY_AFFINITY=TRUE|FALSE
2. 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.


Repository:
  rOMP OpenMP

https://reviews.llvm.org/D55148

Files:
  runtime/src/dllexports
  runtime/src/i18n/en_US.txt
  runtime/src/include/50/omp.h.var
  runtime/src/include/50/omp_lib.f.var
  runtime/src/include/50/omp_lib.f90.var
  runtime/src/include/50/omp_lib.h.var
  runtime/src/kmp.h
  runtime/src/kmp_affinity.cpp
  runtime/src/kmp_barrier.cpp
  runtime/src/kmp_csupport.cpp
  runtime/src/kmp_ftn_entry.h
  runtime/src/kmp_ftn_os.h
  runtime/src/kmp_global.cpp
  runtime/src/kmp_io.cpp
  runtime/src/kmp_io.h
  runtime/src/kmp_os.h
  runtime/src/kmp_runtime.cpp
  runtime/src/kmp_safe_c_api.h
  runtime/src/kmp_settings.cpp
  runtime/src/kmp_str.cpp
  runtime/src/kmp_str.h
  runtime/src/kmp_stub.cpp
  runtime/test/affinity/format/affinity_display.1.c
  runtime/test/affinity/format/affinity_values.c
  runtime/test/affinity/format/api.c
  runtime/test/affinity/format/api2.c
  runtime/test/affinity/format/check.py
  runtime/test/affinity/format/fields_modifiers.c
  runtime/test/affinity/format/fields_values.c
  runtime/test/affinity/format/helper.h
  runtime/test/affinity/format/increase.c
  runtime/test/affinity/format/nested.c
  runtime/test/affinity/format/nested2.c
  runtime/test/affinity/format/nested_mixed.c
  runtime/test/affinity/format/nested_serial.c
  runtime/test/affinity/format/proc_bind.c
  runtime/test/affinity/format/simple.c
  runtime/test/affinity/format/simple_env.c
  runtime/test/lit.cfg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55148.176203.patch
Type: text/x-patch
Size: 91336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20181130/cd67fd76/attachment-0001.bin>


More information about the Openmp-commits mailing list